PngImage Class Reference

An interface to the PNG library. More...

#include <pngimage.h>

List of all members.

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.
PngImageoperator= (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.


Detailed Description

An interface to the PNG library.

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.


Constructor & Destructor Documentation

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.

References buffer, imgHeight, and imgWidth.

PngImage::PngImage ( const char *  filename  )  [inline]

The constructor which reads a PNG image from a file.

Throws an error text message (const char *) in case of failure.

Definition at line 176 of file pngimage.h.

References buffer, height(), imgHeight, imgWidth, and width().

PngImage::~PngImage (  )  [inline]

The destructor.

Definition at line 128 of file pngimage.h.

References buffer.

PngImage::PngImage ( const PngImage src  )  [inline, private]

The copy constructor is not allowed.

Definition at line 135 of file pngimage.h.


Member Function Documentation

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.

References buffer, imgHeight, and imgWidth.

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.

References buffer, imgHeight, and imgWidth.

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.

References buffer, imgHeight, and imgWidth.

PngImage & PngImage::operator= ( const PngImage src  )  [inline, private]

The assignment operator is not allowed.

Definition at line 140 of file pngimage.h.


Member Data Documentation

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().


The documentation for this class was generated from the following file:
Generated on Sun Mar 28 17:47:59 2010 for The Conley-Morse Graphs Software by  doxygen 1.5.3