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

Public Member Functions | |
virtual void | ApplyKeycolor () |
virtual void | ApplyKeyColor () |
Apply the keycolor, that is, set all pixels which match the keycolor to 0. | |
void | CheckAlpha () |
Check if all alpha values are "non-transparent" and if so, discard alpha. | |
void | Clear (const csRGBpixel &colour) |
Clears image to colour. Only works for truecolor images. | |
virtual void | ClearKeycolor () |
virtual void | ClearKeyColor () |
Remove the keycolor. | |
void | ConvertFromPal8 (uint8 *iImage, uint8 *alpha, const csRGBcolor *iPalette, int nPalColors=256) |
Used to convert an 8-bit indexed 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 | ConvertFromRGBA (csRGBpixel *iImage) |
Used to convert an truecolor RGB image into requested format. | |
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. | |
csImageMemory (iImage *source, int newFormat) | |
Create an instance that copies the pixel data from another iImage object, and also change the data format. | |
csImageMemory (iImage *source) | |
Create an instance that copies the pixel data from another iImage object. | |
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 (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, int depth, int format) | |
Create a blank image of these dimensions and the specified format. | |
csImageMemory (int width, int height, int format=CS_IMGFMT_TRUECOLOR) | |
Create a blank image of these dimensions and the specified format. | |
virtual const uint8 * | GetAlpha () |
Get alpha map for 8-bit paletted image. | |
uint8 * | GetAlphaPtr () |
Get a pointer to the alpha data that can be changed. | |
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 int | GetHeight () const |
Query image height. | |
virtual const void * | GetImageData () |
Get image data: returns either (csRGBpixel *) or (unsigned char *) depending on format. | |
void * | GetImagePtr () |
Get a pointer to the image data that can be changed. | |
virtual csImageType | GetImageType () const |
Get the type of the contained image. | |
virtual void | GetKeyColor (int &r, int &g, int &b) const |
Get the keycolour stored with the image. | |
virtual csRef< iImage > | GetMipmap (uint num) |
Return a precomputed mipmap. | |
virtual const csRGBpixel * | GetPalette () |
Get image palette (or 0 if no palette). | |
csRGBpixel * | GetPalettePtr () |
Get a pointer to the palette data that can be changed. | |
virtual int | GetWidth () const |
Query image width. | |
virtual bool | HasKeyColor () const |
Check if image has a keycolour stored with it. | |
virtual uint | HasMipmaps () const |
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps), in addition to the original image. | |
void | SetFormat (int iFormat) |
Convert the image to another format. | |
void | SetImageType (csImageType type) |
virtual void | SetKeycolor (int r, int g, int b) |
virtual void | SetKeyColor (int r, int g, int b) |
Set the keycolor. | |
bool | SetMipmap (uint num, iImage *mip) |
Set a mipmap of this image. | |
Protected Member Functions | |
void | AllocImage () |
Allocate the pixel data buffers. | |
csImageMemory (int iFormat) | |
csImageMemory constructor, only set a format, no dimensions. | |
void | EnsureImage () |
Allocate the pixel data buffers if they aren't already. | |
void | FreeImage () |
Free all image data: pixels and palette. | |
void | SetDimensions (int newWidth, int newHeight) |
Set the width and height. | |
Protected Attributes | |
uint8 * | Alpha |
The alpha map. | |
int | Depth |
Depth of image. | |
bool | destroy_image |
If true when these interfaces are destroyed the image is also. | |
int | Format |
Image format (see CS_IMGFMT_XXX above). | |
bool | has_keycolour |
if it has a keycolour. | |
int | Height |
Height of image. | |
void * | Image |
The image data. | |
csImageType | imageType |
Type of the contained images. | |
csRGBpixel | keycolour |
keycolour value | |
csArray< csRef< iImage > > | mipmaps |
Mip map images. | |
csRGBpixel * | Palette |
The image palette or 0. | |
int | Width |
Width of image. |
Detailed Description
Memory image.
Definition at line 40 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 185 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 181 of file memimage.h. |
|
Qyery image format (see CS_IMGFMT_XXX above).
Implements iImage. Definition at line 183 of file memimage.h. |
|
Query image height.
Implements iImage. Definition at line 180 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 178 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 222 of file memimage.h. |
|
Get the keycolour stored with the image.
Reimplemented from csImageBase. Reimplemented in csCommonImageFile. Definition at line 189 of file memimage.h. |
|
Return a precomputed mipmap. num specifies which mipmap to return; 0 returns the original image, num <= the return value of HasMipmaps() returns that mipmap. Reimplemented from csImageBase. Definition at line 231 of file memimage.h. |
|
Get image palette (or 0 if no palette).
Reimplemented from csImageBase. Reimplemented in csCommonImageFile. Definition at line 184 of file memimage.h. |
|
Get a pointer to the palette data that can be changed.
|
|
Query image width.
Implements iImage. Definition at line 179 of file memimage.h. |
|
Check if image has a keycolour stored with it.
Reimplemented from csImageBase. Reimplemented in csCommonImageFile. Definition at line 187 of file memimage.h. |
|
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps), in addition to the original image. 0 means there are no precomputed mipmaps. Reimplemented from csImageBase. Definition at line 225 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.
|
|
Set a mipmap of this image.
Definition at line 245 of file memimage.h. |
Member Data Documentation
|
The alpha map.
Definition at line 70 of file memimage.h. |
|
Depth of image.
Definition at line 59 of file memimage.h. |
|
If true when these interfaces are destroyed the image is also.
Definition at line 78 of file memimage.h. |
|
Image format (see CS_IMGFMT_XXX above).
Definition at line 72 of file memimage.h. |
|
if it has a keycolour.
Definition at line 74 of file memimage.h. |
|
Height of image.
Definition at line 57 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 66 of file memimage.h. |
|
Type of the contained images.
Definition at line 80 of file memimage.h. |
|
keycolour value
Definition at line 76 of file memimage.h. |
|
Mip map images.
Definition at line 85 of file memimage.h. |
|
The image palette or 0.
Definition at line 68 of file memimage.h. |
|
Width of image.
Definition at line 55 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.4.6