#include "PNG.h"
Creates an empty PNG image.
cs225::PNG::PNG |
( |
unsigned int |
width, |
|
|
unsigned int |
height |
|
) |
| |
Creates a PNG image of the specified dimensions.
- Parameters
-
width | Width of the new image. |
height | Height of the new image. |
cs225::PNG::PNG |
( |
PNG const & |
other | ) |
|
Copy constructor: creates a new PNG image that is a copy of another.
- Parameters
-
Destructor: frees all memory associated with a given PNG object.
Invoked by the system.
PNG const & cs225::PNG::operator= |
( |
PNG const & |
other | ) |
|
Assignment operator for setting two PNGs equal to one another.
- Parameters
-
other | Image to copy into the current image. |
- Returns
- The current image for assignment chaining.
bool cs225::PNG::operator== |
( |
PNG const & |
other | ) |
const |
Equality operator: checks if two images are the same.
- Parameters
-
other | Image to be checked. |
- Returns
- Whether the current image is equal to the other image.
bool cs225::PNG::operator!= |
( |
PNG const & |
other | ) |
const |
Inequality operator: checks if two images are different.
- Parameters
-
other | Image to be checked. |
- Returns
- Whether the current image differs from the other image.
bool cs225::PNG::readFromFile |
( |
string const & |
fileName | ) |
|
Reads in a PNG image from a file.
Overwrites any current image content in the PNG.
- Parameters
-
fileName | Name of the file to be read from. |
- Returns
- true, if the image was successfully read and loaded.
bool cs225::PNG::writeToFile |
( |
string const & |
fileName | ) |
|
Writes a PNG image to a file.
- Parameters
-
fileName | Name of the file to be written. |
- Returns
- true, if the image was successfully written.
HSLAPixel & cs225::PNG::getPixel |
( |
unsigned int |
x, |
|
|
unsigned int |
y |
|
) |
| const |
Pixel access operator.
Gets a pointer to the pixel at the given coordinates in the image. (0,0) is the upper left corner. This pointer allows the image to be changed.
- Parameters
-
x | X-coordinate for the pixel pointer to be grabbed from. |
y | Y-coordinate for the pixel pointer to be grabbed from. |
- Returns
- A pointer to the pixel at the given coordinates.
unsigned int cs225::PNG::width |
( |
| ) |
const |
Gets the width of this image.
- Returns
- Width of the image.
unsigned int cs225::PNG::height |
( |
| ) |
const |
Gets the height of this image.
- Returns
- Height of the image.
void cs225::PNG::resize |
( |
unsigned int |
newWidth, |
|
|
unsigned int |
newHeight |
|
) |
| |
Resizes the image to the given coordinates.
Attempts to preserve existing pixel data in the image when doing so, but will crop if necessary. No pixel interpolation is done.
- Parameters
-
newWidth | New width of the image. |
newHeight | New height of the image. |
Computes a hash of the contents of the image.
The documentation for this class was generated from the following files: