csImageMemory Class Reference
Memory image. More...
#include <csgfx/memimage.h>
Inheritance diagram for csImageMemory:

Public Member Functions | |
csImageMemory (int width, int height, int format=CS_IMGFMT_TRUECOLOR) | |
Create a blank image of these dimensions and the specified format. | |
csImageMemory (int width, int height, int depth, int format) | |
Create a blank image of these dimensions and the specified format. | |
csImageMemory (int width, int height, void *buffer, bool destroy, int format=CS_IMGFMT_TRUECOLOR, csRGBpixel *palette=0) | |
Create an instance for this pixel buffer with these dimensions. | |
csImageMemory (int width, int height, const void *buffer, int format=CS_IMGFMT_TRUECOLOR, const csRGBpixel *palette=0) | |
Create an instance from a pixel buffer with these dimensions. | |
csImageMemory (iImage *source) | |
Create an instance that copies the pixel data from another iImage object. | |
csImageMemory (iImage *source, int newFormat) | |
Create an instance that copies the pixel data from another iImage object, and also change the data format. | |
void * | GetImagePtr () |
Get a pointer to the image data that can be changed. | |
csRGBpixel * | GetPalettePtr () |
Get a pointer to the palette data that can be changed. | |
uint8 * | GetAlphaPtr () |
Get a pointer to the alpha data that can be changed. | |
virtual const void * | GetImageData () |
Get image data: returns either (csRGBpixel *) or (unsigned char *) depending on format. | |
virtual int | GetWidth () const |
Query image width. | |
virtual int | GetHeight () const |
Query image height. | |
virtual int | GetDepth () const |
Query image depth (only sensible when the image type is csimg3D). | |
virtual int | GetFormat () const |
Qyery image format (see CS_IMGFMT_XXX above). | |
virtual const csRGBpixel * | GetPalette () |
Get image palette (or 0 if no palette). | |
virtual const uint8 * | GetAlpha () |
Get alpha map for 8-bit paletted image. | |
virtual bool | HasKeyColor () const |
Check if image has a keycolour stored with it. | |
virtual void | GetKeyColor (int &r, int &g, int &b) const |
Get the keycolour stored with the image. | |
void | Clear (const csRGBpixel &colour) |
Clears image to colour. Only works for truecolor images. | |
void | CheckAlpha () |
Check if all alpha values are "non-transparent" and if so, discard alpha. | |
void | SetFormat (int iFormat) |
Convert the image to another format. | |
virtual void | SetKeyColor (int r, int g, int b) |
Set the keycolor. | |
virtual void | ClearKeyColor () |
Remove the keycolor. | |
virtual void | ApplyKeyColor () |
Apply the keycolor, that is, set all pixels which match the keycolor to 0. | |
virtual csImageType | GetImageType () const |
Get the type of the contained image. | |
bool | Copy (iImage *srcImage, int x, int y, int width, int height) |
Copy an image as subpart into this image. | |
bool | CopyScale (iImage *srcImage, int x, int y, int width, int height) |
Copy an image as subpart into this image with scaling sImage to the given size. | |
bool | CopyTile (iImage *srcImage, int x, int y, int width, int height) |
Copy an image as subpart into this image and tile and scale sImage to the given size. | |
void | ConvertFromRGBA (csRGBpixel *iImage) |
Used to convert an truecolor RGB image into requested format. | |
void | ConvertFromPal8 (uint8 *iImage, uint8 *alpha, csRGBpixel *iPalette, int nPalColors=256) |
Used to convert an 8-bit indexed image into requested format. | |
void | ConvertFromPal8 (uint8 *iImage, uint8 *alpha, const csRGBcolor *iPalette, int nPalColors=256) |
Used to convert an 8-bit indexed image into requested format. | |
Protected Member Functions | |
csImageMemory (int iFormat) | |
csImageMemory constructor, only set a format, no dimensions. | |
void | SetDimensions (int newWidth, int newHeight) |
Set the width and height. | |
void | AllocImage () |
Allocate the pixel data buffers. | |
void | EnsureImage () |
Allocate the pixel data buffers if they aren't already. | |
void | FreeImage () |
Free all image data: pixels and palette. | |
Protected Attributes | |
int | Width |
Width of image. | |
int | Height |
Height of image. | |
int | Depth |
Depth of image. | |
void * | Image |
The image data. | |
csRGBpixel * | Palette |
The image palette or 0. | |
uint8 * | Alpha |
The alpha map. | |
int | Format |
Image format (see CS_IMGFMT_XXX above). | |
bool | has_keycolour |
if it has a keycolour. | |
csRGBpixel | keycolour |
keycolour value | |
bool | destroy_image |
If true when these interfaces are destroyed the image is also. |
Detailed Description
Memory image.
Definition at line 32 of file memimage.h.
Constructor & Destructor Documentation
|
csImageMemory constructor, only set a format, no dimensions. Intended to be used by loaders which later call SetDimensions(). |
|
Create a blank image of these dimensions and the specified format.
|
|
Create a blank image of these dimensions and the specified format.
|
|
Create an instance for this pixel buffer with these dimensions. If destroy is set to true then the supplied buffer will be destroyed when the instance is.
|
|
Create an instance from a pixel buffer with these dimensions. A copy of the pixel data is made.
|
|
Create an instance that copies the pixel data from another iImage object.
|
|
Create an instance that copies the pixel data from another iImage object, and also change the data format.
|
Member Function Documentation
|
Allocate the pixel data buffers.
|
|
Apply the keycolor, that is, set all pixels which match the keycolor to 0.
|
|
Check if all alpha values are "non-transparent" and if so, discard alpha.
|
|
Clears image to colour. Only works for truecolor images.
|
|
Remove the keycolor.
|
|
Used to convert an 8-bit indexed image into requested format. Pass a pointer to color indices, a pointer to the alpha mask and a pointer to the palette, and you're done. NOTE: the pointer should be allocated with new uint8 [] and you should not free it after calling this function: the function will free the buffer itself if it is appropriate (or wont if the buffer size/contents are appropriate for target format). Same about palette and alpha. |
|
Used to convert an 8-bit indexed image into requested format. Pass a pointer to color indices, a pointer to the alpha mask and a pointer to the palette, and you're done. NOTE: the pointer should be allocated with new uint8 [] and you should not free it after calling this function: the function will free the buffer itself if it is appropriate (or wont if the buffer size/contents are appropriate for target format). Same about palette and alpha. |
|
Used to convert an truecolor RGB image into requested format. If the image loader cannot handle conversion itself, and the image file is in a format that is different from the requested one, load the image in csRGBpixel format and pass the pointer to this function which will handle the RGB -> target format conversion. NOTE: the pointer should be allocated with new csRGBpixel [] and you should not free it after calling this function: the function will free the buffer itself if it is appropriate (or wont if the buffer size/contents are appropriate for target format). |
|
Copy an image as subpart into this image.
|
|
Copy an image as subpart into this image with scaling sImage to the given size.
|
|
Copy an image as subpart into this image and tile and scale sImage to the given size.
|
|
Allocate the pixel data buffers if they aren't already.
|
|
Free all image data: pixels and palette. Takes care of image data format. |
|
Get alpha map for 8-bit paletted image. RGBA images contains alpha within themself. If image has no alpha map, or the image is in RGBA format, this function will return 0. Reimplemented from csImageBase. Reimplemented in csCommonImageFile. Definition at line 171 of file memimage.h. |
|
Get a pointer to the alpha data that can be changed.
|
|
Query image depth (only sensible when the image type is csimg3D).
Reimplemented from csImageBase. Definition at line 167 of file memimage.h. |
|
Qyery image format (see CS_IMGFMT_XXX above).
Implements iImage. Definition at line 169 of file memimage.h. |
|
Query image height.
Implements iImage. Definition at line 166 of file memimage.h. |
|
Get image data: returns either (csRGBpixel *) or (unsigned char *) depending on format. Note that for RGBA images the csRGBpixel structure contains the alpha channel as well, so GetAlpha (see below) method will return 0 (because alpha is not stored separately, as for paletted images). Implements iImage. Reimplemented in csCommonImageFile. Definition at line 164 of file memimage.h. |
|
Get a pointer to the image data that can be changed.
|
|
Get the type of the contained image.
Reimplemented from csImageBase. Definition at line 208 of file memimage.h. References csImageType. |
|
Get the keycolour stored with the image.
Reimplemented from csImageBase. Definition at line 175 of file memimage.h. References csRGBpixel::blue, csRGBpixel::green, and csRGBpixel::red. |
|
Get image palette (or 0 if no palette).
Reimplemented from csImageBase. Reimplemented in csCommonImageFile. Definition at line 170 of file memimage.h. |
|
Get a pointer to the palette data that can be changed.
|
|
Query image width.
Implements iImage. Definition at line 165 of file memimage.h. |
|
Check if image has a keycolour stored with it.
Reimplemented from csImageBase. Definition at line 173 of file memimage.h. |
|
Set the width and height. This will also free the 'image' buffer to hold the pixel data, but it will NOT allocate a new buffer (thus `image' is 0 after calling this function). You should pass an appropiate pointer to one of ConvertXXX functions below, define the image itself (or assign something to `Image' manually), or call EnsureImage(). |
|
Convert the image to another format. This method will allocate a respective color component if it was not allocated before. For example, you can use this method to add alpha channel to paletted images, to allocate a image for CS_IMGFMT_NONE alphamaps or vice versa, to remove the image and leave alphamap alone. This routine may be used as well for removing alpha channel. |
|
Set the keycolor.
|
Member Data Documentation
|
The alpha map.
Definition at line 61 of file memimage.h. |
|
Depth of image.
Definition at line 50 of file memimage.h. |
|
If true when these interfaces are destroyed the image is also.
Definition at line 69 of file memimage.h. |
|
Image format (see CS_IMGFMT_XXX above).
Definition at line 63 of file memimage.h. |
|
if it has a keycolour.
Definition at line 65 of file memimage.h. |
|
Height of image.
Definition at line 48 of file memimage.h. |
|
The image data. A value of 0 means the Image contents are "undefined". However, this is an internal state only. No operation should fail due undefined image data (although the data may stay undefined). Definition at line 57 of file memimage.h. |
|
keycolour value
Definition at line 67 of file memimage.h. |
|
The image palette or 0.
Definition at line 59 of file memimage.h. |
|
Width of image.
Definition at line 46 of file memimage.h. |
The documentation for this class was generated from the following file:
- csgfx/memimage.h
Generated for Crystal Space by doxygen 1.3.9.1