csImageFile Class Reference
An abstract class representing an abstract image. More...
#include <csimage.h>
Inheritance diagram for csImageFile:

Public Methods | |
virtual | ~csImageFile () |
Destroy the image file object and free all associated storage. | |
virtual void * | GetImageData () |
Get image data: returns either (csRGBpixel *) or (unsigned char *) depending on format. | |
virtual int | GetWidth () |
Query image width. | |
virtual int | GetHeight () |
Query image height. | |
virtual int | GetSize () |
Query image size in bytes. | |
virtual void | Rescale (int newwidth, int newheight) |
Rescale the image to the given size. | |
virtual csPtr< iImage > | MipMap (int step, csRGBpixel *transp) |
Create a new csImageFile which is a mipmapped version of this one. | |
virtual void | SetName (const char *iName) |
Set image file name. | |
virtual const char * | GetName () |
Get image file name. | |
virtual int | GetFormat () |
Get image format. | |
virtual csRGBpixel * | GetPalette () |
Get image palette (or 0 if no palette). | |
virtual uint8 * | GetAlpha () |
Get alpha map for image. | |
virtual void | SetFormat (int iFormat) |
Convert the image to another format. | |
virtual csPtr< iImage > | Clone () |
Create yet another image and copy this one into the new image. | |
virtual csPtr< iImage > | Crop (int x, int y, int width, int height) |
Create another image and copy a subpart of this image into the new image. | |
virtual void | CheckAlpha () |
Check if all alpha values are "non-transparent" and if so, discard alpha. | |
virtual bool | HasKeycolor () |
check if image has a keycolour stored with it | |
virtual void | GetKeycolor (int &r, int &g, int &b) |
get the keycolour stored with the image. | |
virtual csPtr< iImage > | Sharpen (csRGBpixel *transp, int strength) |
Create a sharpened copy of the image. | |
virtual int | HasMipmaps () |
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps. | |
Protected Methods | |
csImageFile (int iFormat) | |
csImageFile constructor. | |
void | set_dimensions (int w, int h) |
Set the width and height. | |
void | convert_rgba (csRGBpixel *iImage) |
Used to convert an truecolor RGB image into requested format. | |
void | convert_pal8 (uint8 *iImage, csRGBpixel *iPalette, int nPalColors=256) |
Used to convert an 8-bit indexed image into requested format. | |
void | convert_pal8 (uint8 *iImage, const csRGBcolor *iPalette, int nPalColors=256) |
Same as above but accepts an array of csRGBcolor's as palette. | |
virtual void | FreeImage () |
Free all image data: pixels and palette. | |
int | closest_index (csRGBpixel *iColor) |
Return the closest color index to given. Fails if image has no palette. | |
Protected Attributes | |
int | Width |
Width of image. | |
int | Height |
Height of image. | |
void * | Image |
The image data. | |
csRGBpixel * | Palette |
The image palette or 0. | |
uint8 * | Alpha |
The alpha map. | |
char * | fName |
Image file name. | |
int | Format |
Image format (see CS_IMGFMT_XXX above). | |
uint8 | has_keycolour |
if it has a keycolour, and the keycolour values. | |
uint8 | keycolour_r |
if it has a keycolour, and the keycolour values. | |
uint8 | keycolour_g |
if it has a keycolour, and the keycolour values. | |
uint8 | keycolour_b |
if it has a keycolour, and the keycolour values. |
Detailed Description
An abstract class representing an abstract image.For every image type supported, a subclass should be created for loading that image type. The image file class contains a number of member functions for accessing and manipulating the image contents.
Definition at line 36 of file csimage.h.
Constructor & Destructor Documentation
|
csImageFile constructor. This object can only be created by an appropriate loader, which is why the constructor is protected. |
|
Destroy the image file object and free all associated storage.
|
Member Function Documentation
|
Check if all alpha values are "non-transparent" and if so, discard alpha.
Implements iImage. |
|
Create yet another image and copy this one into the new image.
Implements iImage. |
|
Return the closest color index to given. Fails if image has no palette.
|
|
Same as above but accepts an array of csRGBcolor's as palette. The csRGBcolor array is never freed, so its your responsability if you did it. |
|
Used to convert an 8-bit indexed image into requested format. Pass a pointer to color indices and a pointer to 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 appropiate (or wont if the buffer size/contents are appropiate for target format). Same about palette. |
|
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 appropiate (or wont if the buffer size/contents are appropiate for target format). |
|
Create another image and copy a subpart of this image into the new image.
Implements iImage. |
|
Free all image data: pixels and palette. Takes care of image data format. Reimplemented in csImageMemory. |
|
Get alpha map for image.
Implements iImage. |
|
Get image format.
Implements iImage. |
|
Query image height.
Implements iImage. |
|
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. |
|
get the keycolour stored with the image.
Implements iImage. |
|
Get image file name.
Implements iImage. |
|
Get image palette (or 0 if no palette).
Implements iImage. |
|
Query image size in bytes.
Implements iImage. |
|
Query image width.
Implements iImage. |
|
check if image has a keycolour stored with it
Implements iImage. |
|
Returns the number of mipmaps contained in the image (in case there exist any precalculated mipmaps.
Implements iImage. |
|
Create a new csImageFile which is a mipmapped version of this one. 'step' indicates how much the mipmap should be scaled down. Step 0 returns a blurred version of the image without image being scaled down. Step 1 scales the image down to 1/2. Steps > 1 repeat this 'step' times. The new image will have same format as the original one. If you pass a pointer to a transparent color, the texels of that color are handled differently. Implements iImage. |
|
Rescale the image to the given size.
Implements iImage. Reimplemented in csImageMemory. |
|
Set the width and height. This will also free the 'image' buffer to hold the bitmap, 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 convert_xxx functions below to define the image itself (or assign something to `image' manually). |
|
Convert the image to another format.
Implements iImage. |
|
Set image file name.
Implements iImage. |
|
Create a sharpened copy of the image.
Implements iImage. |
Member Data Documentation
|
The alpha map.
|
|
Image file name.
|
|
Image format (see CS_IMGFMT_XXX above).
|
|
if it has a keycolour, and the keycolour values.
|
|
Height of image.
|
|
The image data.
|
|
if it has a keycolour, and the keycolour values.
|
|
if it has a keycolour, and the keycolour values.
|
|
if it has a keycolour, and the keycolour values.
|
|
The image palette or 0.
|
|
Width of image.
|
The documentation for this class was generated from the following file:
- csgfx/csimage.h
Generated for Crystal Space by doxygen 1.2.18