ImagePng Class Reference

#include <ImagePng.h>

Inheritance diagram for ImagePng:

Image

List of all members.

Public Member Functions

 ImagePng ()
 ImagePng (int startWidth, int startHeight, bool alpha=false, unsigned char fill=0)
virtual ~ImagePng ()
virtual void removeOwnership ()
virtual unsigned char * getBits ()
virtual int getWidth ()
virtual int getHeight ()
virtual int getAlignment ()
virtual int getComponents ()
void clear ()
bool loadFromFile (const std::string &filename, bool readalpha=false)
bool loadFromFile (const std::string &filename, const std::string &alphafilename, bool invert)
bool loadFromBuffer (NetBuffer &buffer, bool readalpha=false)
bool writeToBuffer (NetBuffer &buffer)

Protected Member Functions

void createBlankInternal (int width, int height, bool alpha=false, unsigned char fill=255)

Protected Attributes

bool owner_
unsigned char * bits_
int width_
int height_
bool alpha_

Private Member Functions

 ImagePng (ImagePng &other)
ImagePngoperator= (ImagePng &other)


Detailed Description

Definition at line 27 of file ImagePng.h.


Constructor & Destructor Documentation

ImagePng::ImagePng (  ) 

Definition at line 32 of file ImagePng.cpp.

ImagePng::ImagePng ( int  startWidth,
int  startHeight,
bool  alpha = false,
unsigned char  fill = 0 
)

Definition at line 39 of file ImagePng.cpp.

References createBlankInternal().

ImagePng::~ImagePng (  )  [virtual]

Definition at line 95 of file ImagePng.cpp.

References clear().

ImagePng::ImagePng ( ImagePng other  )  [private]


Member Function Documentation

virtual void ImagePng::removeOwnership (  )  [inline, virtual]

Implements Image.

Definition at line 34 of file ImagePng.h.

References owner_.

virtual unsigned char* ImagePng::getBits (  )  [inline, virtual]

Implements Image.

Definition at line 35 of file ImagePng.h.

References bits_.

Referenced by loadFromFile().

virtual int ImagePng::getWidth (  )  [inline, virtual]

Implements Image.

Definition at line 36 of file ImagePng.h.

References width_.

Referenced by loadFromFile(), and TankAvatar::setFromBuffer().

virtual int ImagePng::getHeight (  )  [inline, virtual]

Implements Image.

Definition at line 37 of file ImagePng.h.

References height_.

Referenced by loadFromFile(), and TankAvatar::setFromBuffer().

virtual int ImagePng::getAlignment (  )  [inline, virtual]

Implements Image.

Definition at line 38 of file ImagePng.h.

virtual int ImagePng::getComponents (  )  [inline, virtual]

Implements Image.

Definition at line 39 of file ImagePng.h.

References alpha_.

Referenced by createBlankInternal(), loadFromFile(), and writeToBuffer().

void ImagePng::clear (  ) 

Definition at line 100 of file ImagePng.cpp.

References bits_, height_, owner_, and width_.

Referenced by createBlankInternal(), and ~ImagePng().

bool ImagePng::loadFromFile ( const std::string filename,
bool  readalpha = false 
)

Overwrite the bitmap with the contents of the given file. If alpha is true then any black areas in the bitmap have full opacity. When creating an alpha bitmap the bitmap is created in RGBA format, otherwise in RGB format.

Definition at line 120 of file ImagePng.cpp.

References NetBuffer::addDataToBuffer(), file, S3D::formatStringBuffer(), loadFromBuffer(), and Logger::log().

Referenced by TankAvatar::getTexture(), ImageFactory::loadAlphaImage(), loadFromFile(), and ImageFactory::loadImage().

bool ImagePng::loadFromFile ( const std::string filename,
const std::string alphafilename,
bool  invert 
)

Definition at line 46 of file ImagePng.cpp.

References createBlankInternal(), getBits(), getComponents(), getHeight(), getWidth(), int(), and loadFromFile().

bool ImagePng::loadFromBuffer ( NetBuffer buffer,
bool  readalpha = false 
)

Definition at line 171 of file ImagePng.cpp.

References alpha_, bits_, createBlankInternal(), S3D::formatStringBuffer(), height_, Logger::log(), NULL, user_png_error(), user_png_warning(), user_read_fn(), and width_.

Referenced by loadFromFile(), ClientConnectionAcceptHandler::processMessage(), and TankAvatar::setFromBuffer().

bool ImagePng::writeToBuffer ( NetBuffer buffer  ) 

Definition at line 297 of file ImagePng.cpp.

References bits_, getComponents(), height_, NULL, user_png_error(), user_png_warning(), user_read_fn(), user_write_fn(), and width_.

void ImagePng::createBlankInternal ( int  width,
int  height,
bool  alpha = false,
unsigned char  fill = 255 
) [protected]

Definition at line 108 of file ImagePng.cpp.

References alpha_, bits_, clear(), getComponents(), height_, and width_.

Referenced by ImagePng(), loadFromBuffer(), and loadFromFile().

ImagePng& ImagePng::operator= ( ImagePng other  )  [private]


Member Data Documentation

bool ImagePng::owner_ [protected]

Definition at line 56 of file ImagePng.h.

Referenced by clear(), and removeOwnership().

unsigned char* ImagePng::bits_ [protected]

Definition at line 57 of file ImagePng.h.

Referenced by clear(), createBlankInternal(), getBits(), loadFromBuffer(), and writeToBuffer().

int ImagePng::width_ [protected]

Definition at line 58 of file ImagePng.h.

Referenced by clear(), createBlankInternal(), getWidth(), loadFromBuffer(), and writeToBuffer().

int ImagePng::height_ [protected]

Definition at line 59 of file ImagePng.h.

Referenced by clear(), createBlankInternal(), getHeight(), loadFromBuffer(), and writeToBuffer().

bool ImagePng::alpha_ [protected]

Definition at line 60 of file ImagePng.h.

Referenced by createBlankInternal(), getComponents(), and loadFromBuffer().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:03 2009 for Scorched3D by  doxygen 1.5.3