cee::Image

class Image : public RefCountedObject

Stores an RGBA image with 8 bits per pixel.

All pixel values are packed with no alignment.

Public Functions

Image()

Constructs an empty image.

Image(const Image &other)

Constructs an image by copying from another image.

Image &operator=(const Image &other)

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

unsigned int width() const

Returns the width of image in pixels.

unsigned int height() const

Returns the height of image in pixels.

unsigned int byteCount() const

Returns the total number of bytes occupied by this image.

Always 4*width*height

bool hasTransparentPixels() const

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

void 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 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 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.

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

Sets the image data from an array of RGBA values.

void clear()

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

unsigned int version() const

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

const unsigned char *rawPointer() const

Returns a raw pointer to the RGBA pixel array.