#include <pngimage.h>
Public Member Functions | |
| PngImage (int _width, int _height, int _bgcolor=0xFFFFFF) | |
| The constructor of an empty 24-bit PNG image. | |
| PngImage (const char *filename) | |
| The constructor which reads a PNG image from a file. | |
| ~PngImage () | |
| The destructor. | |
| void | putPixel (int x, int y, int color=0x000000) |
| Plots a pixel in the image with the given RGB color. | |
| int | getPixel (int x, int y) const |
| Returns the 0xRRGGBB color value of the given pixel or -1 if the pixel is outside the image. | |
| int | width () const |
| Returns the width of the image. | |
| int | height () const |
| Returns the height of the image. | |
| void | save (const char *filename) const |
| Writes the image to a PNG file. | |
Private Member Functions | |
| PngImage (const PngImage &src) | |
| The copy constructor is not allowed. | |
| PngImage & | operator= (const PngImage &src) |
| The assignment operator is not allowed. | |
Private Attributes | |
| int | imgWidth |
| The width of the image in pixels. | |
| int | imgHeight |
| The height of the image in pixels. | |
| unsigned char * | buffer |
| The buffer of the picture in RGB byte sequences. | |
Supports creating a 24-bit image, writing individual pixels, and saving the image to a PNG file.
Definition at line 52 of file pngimage.h.
| PngImage::PngImage | ( | int | _width, | |
| int | _height, | |||
| int | _bgcolor = 0xFFFFFF | |||
| ) | [inline] |
The constructor of an empty 24-bit PNG image.
The default background color is white.
Definition at line 104 of file pngimage.h.
| PngImage::PngImage | ( | const char * | filename | ) | [inline] |
| PngImage::~PngImage | ( | ) | [inline] |
| PngImage::PngImage | ( | const PngImage & | src | ) | [inline, private] |
| void PngImage::putPixel | ( | int | x, | |
| int | y, | |||
| int | color = 0x000000 | |||
| ) | [inline] |
Plots a pixel in the image with the given RGB color.
The color is encoded as 0xRRGGBB. Black by default.
Definition at line 145 of file pngimage.h.
| int PngImage::getPixel | ( | int | x, | |
| int | y | |||
| ) | const [inline] |
Returns the 0xRRGGBB color value of the given pixel or -1 if the pixel is outside the image.
Definition at line 156 of file pngimage.h.
| int PngImage::width | ( | ) | const [inline] |
Returns the width of the image.
Definition at line 164 of file pngimage.h.
References imgWidth.
Referenced by PngImage().
| int PngImage::height | ( | ) | const [inline] |
Returns the height of the image.
Definition at line 169 of file pngimage.h.
References imgHeight.
Referenced by PngImage().
| void PngImage::save | ( | const char * | filename | ) | const [inline] |
Writes the image to a PNG file.
Throws an error text message (const char *) in case of failure.
Definition at line 247 of file pngimage.h.
int PngImage::imgWidth [private] |
The width of the image in pixels.
Definition at line 92 of file pngimage.h.
Referenced by getPixel(), PngImage(), putPixel(), save(), and width().
int PngImage::imgHeight [private] |
The height of the image in pixels.
Definition at line 95 of file pngimage.h.
Referenced by getPixel(), height(), PngImage(), putPixel(), and save().
unsigned char* PngImage::buffer [private] |
The buffer of the picture in RGB byte sequences.
Definition at line 98 of file pngimage.h.
Referenced by getPixel(), PngImage(), putPixel(), save(), and ~PngImage().
1.5.3