cee::Image Class Reference

Stores an RGBA image with 8 bits per pixel. More...

Public Member Functions

 Image ()
 Constructs an empty image. More...
 
 Image (const Image &other)
 Constructs an image by copying from another image. More...
 
Imageoperator= (const Image &other)
 Assigns other to this image and returns a reference to this image. More...
 
unsigned int width () const
 Returns the width of image in pixels. More...
 
unsigned int height () const
 Returns the height of image in pixels. More...
 
unsigned int byteCount () const
 Returns the total number of bytes occupied by this image. More...
 
bool hasTransparentPixels () const
 Returns true if the image has any (semi-)transparent pixels (a != 255) More...
 
void getAsRgb (unsigned char rgbDataBuffer[], size_t bufferSizeInBytes) const
 Gets the RGB pixel data of this image object. More...
 
void setFromRgb (const unsigned char rgbData[], unsigned int width, unsigned int height)
 Sets the pixel data of this image object from an array of RGB unsigned byte values. More...
 
void getAsRgba (unsigned char rgbaDataBuffer[], size_t bufferSizeInBytes) const
 Gets the pixel data as an array of RGBA values. More...
 
void setFromRgba (const unsigned char rgbaData[], unsigned int width, unsigned int height)
 Sets the image data from an array of RGBA values. More...
 
void clear ()
 Clears all image bits and sets width and height to zero. More...
 
unsigned int version () const
 Returns the version of the texture. The version is increased whenever the texture is changed. More...
 
const unsigned char * rawPointer () const
 Returns a raw pointer to the RGBA pixel array. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 
Inheritance diagram for cee::Image:
cee::RefCountedObject

Detailed Description

Stores an RGBA image with 8 bits per pixel.

All pixel values are packed with no alignment.

Constructor & Destructor Documentation

cee::Image::Image ( )

Constructs an empty image.

cee::Image::Image ( const Image other)

Constructs an image by copying from another image.

Member Function Documentation

unsigned int cee::Image::byteCount ( ) const

Returns the total number of bytes occupied by this image.

Always 4*width*height

void cee::Image::clear ( )

Clears all image bits and sets width and height to zero.

void cee::Image::getAsRgb ( unsigned char  rgbDataBuffer[],
size_t  bufferSizeInBytes 
) const

Gets the RGB pixel data of this image object.

Each color component is 8 bits.

The RGB pixel values of this image object will be written into the rgbDataBuffer

The rgbDataBuffer needs to be preallocated to the size bufferSizeInBytes. bufferSizeInBytes must be at least the size of the actual image data.

void cee::Image::getAsRgba ( unsigned char  rgbaDataBuffer[],
size_t  bufferSizeInBytes 
) const

Gets the pixel data as an array of RGBA values.

Each color component is 8 bits.

The rgbaDataBuffer needs to be preallocated to the size bufferSizeInBytes. If bufferSizeInBytes is smaller than the size of the actual image data, only the first bufferSizeInBytes number of bytes will be copied.

bool cee::Image::hasTransparentPixels ( ) const

Returns true if the image has any (semi-)transparent pixels (a != 255)

unsigned int cee::Image::height ( ) const

Returns the height of image in pixels.

Image & cee::Image::operator= ( const Image other)

Assigns other to this image and returns a reference to this image.

const unsigned char * cee::Image::rawPointer ( ) const

Returns a raw pointer to the RGBA pixel array.

void cee::Image::setFromRgb ( const unsigned char  rgbData[],
unsigned int  width,
unsigned int  height 
)

Sets the pixel data of this image object from an array of RGB unsigned byte values.

The image will be reallocated to accommodate the specified width and height.

void cee::Image::setFromRgba ( const unsigned char  rgbaData[],
unsigned int  width,
unsigned int  height 
)

Sets the image data from an array of RGBA values.

unsigned int cee::Image::version ( ) const

Returns the version of the texture. The version is increased whenever the texture is changed.

unsigned int cee::Image::width ( ) const

Returns the width of image in pixels.