XFcImageLoader class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcImageLoader Class Reference

Image loading class factory base class. More...

Inheritance diagram for XFcImageLoader:

[legend]
List of all members.

## Public Member Functions

virtual XFCIMPORT | ~XFcImageLoader ()
| Virtual destructor; core makes sure the object is deleted.

## Static Public Member Functions

XFCIMPORT XFcGLSurface * | load (const CHAR *aFilename, INT32 aSurfaceFormat=XFCGF_DEFAULT)
| Loads an image into a new surface.
XFCIMPORT void | loadImageInfo (const CHAR *aFilename, INT32 *aWidth, INT32 *aHeight, INT *aAlphaLayer, INT *aPaletted)
| Loads information on image.
XFCIMPORT UINT32 * | loadImage8888 (const CHAR *aFilename)
| Loads an image into a linear XFCGF_A8R8G8B8 buffer (32 bits per pixel).
XFCIMPORT void | loadImagePaletted (const CHAR *aFilename, UINT8 **aPalettePtr, UINT8 **aBitmapPtr)
| Loads an image in paletted mode.
XFCIMPORT INT | loadImageToBuffer (const CHAR *aFilename, void *aBuffer, INT32 aPitch, INT32 aFormat=XFCGF_DEFAULT)
| Loads an image into a buffer.

## Public Attributes

XFcImageLoader * | mNext
| Pointer to the next plugin.

## Protected Member Functions

virtual INT | validateImage (const CHAR *aFilename, XFcFile *aFile)=0
| Determines if this plugin can load a specified file.
virtual void | getImageInfo (const CHAR *aFilename, XFcFile *aFile, INT32 *aWidth, INT32 *aHeight, INT *aAlphaLayer, INT *aPaletted)=0
| Returns the requested info on the image.
virtual UINT32 * | getImage8888 (const CHAR *aFilename, XFcFile *aFile)
| Loads an image to a 8:8:8:8 ARGB buffer.
virtual void | getImagePaletted (const CHAR *aFilename, XFcFile *aFile, UINT8 **aPalettePtr, UINT8 **aBitmapPtr)
| Loads image and its palette.

## Static Protected Member Functions

void | registerImageLoader (XFcImageLoader *aFilter)
| Called by a plugin to register itself in its constructor.
INT | doLoadImage (const CHAR *aFilename, XFcImageLoader *aLoadPlugin, XFcFile *aFile, INT32 aFormat, INT32 aWidth, INT32 aHeight, INT32 aAlpha, INT32 aPaletted, INT32 aPitch, void *aBuffer)
| Does the actual gruntwork of loading the image for load() and loadimagetobuffer().

## Static Private Member Functions

XFcImageLoader * | findPlugin (const CHAR *aFilename, XFcFile *aFile)
| Internal: goes through the plugin link list and finds a proper filter.

## Detailed Description

Image loading class factory base class.

All image loaders in the system are made as plugins that extend this class.

## Constructor & Destructor Documentation

virtual XFCIMPORT XFcImageLoader::~XFcImageLoader | ( |  | ) | `[virtual]`

| Virtual destructor; core makes sure the object is deleted.

## Member Function Documentation

INT XFcImageLoader::doLoadImage | ( | const CHAR * | aFilename,
|  | XFcImageLoader * | aLoadPlugin,
|  | XFcFile * | aFile,
|  | INT32 | aFormat,
|  | INT32 | aWidth,
|  | INT32 | aHeight,
|  | INT32 | aAlpha,
|  | INT32 | aPaletted,
|  | INT32 | aPitch,
|  | void * | aBuffer
| ) | `[static, protected]`

| Does the actual gruntwork of loading the image for load() and loadimagetobuffer().

XFcImageLoader* XFcImageLoader::findPlugin | ( | const CHAR * | aFilename,
|  | XFcFile * | aFile
| ) | `[static, private]`

| Internal: goes through the plugin link list and finds a proper filter.

virtual UINT32* XFcImageLoader::getImage8888 | ( | const CHAR * | aFilename,
|  | XFcFile * | aFile
| ) | `[protected, virtual]`

Loads an image to a 8:8:8:8 ARGB buffer.

Note:
  Default implementation calls getImagePaletted and converts the image.

Parameters:

  aFilename | filename of the file to load.
  aFile | file to load from.

Reimplemented in XFcImageLoadFilterTGA.

virtual void XFcImageLoader::getImageInfo | ( | const CHAR * | aFilename,
|  | XFcFile * | aFile,
|  | INT32 * | aWidth,
|  | INT32 * | aHeight,
|  | INT * | aAlphaLayer,
|  | INT * | aPaletted
| ) | `[protected, pure virtual]`

Returns the requested info on the image.

Note:
  Parameters can be set to NULL; in this case that parameter should be ignored.

Parameters:

  aFilename | filename of the image (may be unused).
  aFile | file to get the information from.
  aWidth | returned width, or NULL if width is not requested.
  aHeight | returned height, or NULL if height is not requested.
  aAlphaLayer | returned alpha layer availability, or NULL if it is not requested.
  aPaletted | returned palette availability, or NULL if it is not requested.

Implemented in XFcImageLoadFilterPCX, and XFcImageLoadFilterTGA.

virtual void XFcImageLoader::getImagePaletted | ( | const CHAR * | aFilename,
|  | XFcFile * | aFile,
|  | UINT8 ** | aPalettePtr,
|  | UINT8 ** | aBitmapPtr
| ) | `[protected, virtual]`

Loads image and its palette.

Note:
  Default implementation does nothing.

  Don't extend this function if file format has no paletted mode support. Palettes should be triplets of bytes for red, green and blue colors (R8G8B8).

Parameters:

  aFilename | filename to load.
  aFile | file to load from.
  aPalettePtr | returned pointer to the palette, set to NULL if unsuccessful.
  aBitmapPtr | returned pointer to the bitmap, set to NULL if unsuccessful.

Reimplemented in XFcImageLoadFilterPCX, and XFcImageLoadFilterTGA.

XFCIMPORT XFcGLSurface* XFcImageLoader::load | ( | const CHAR * | aFilename,
|  | INT32 | aSurfaceFormat = XFCGF_DEFAULT
| ) | `[static]`

Loads an image into a new surface.

By default XFCGF_R5G5X1B5 is used for non-alpha pictures and XFCGF_R5G5A1B5 for pictures with alpha.

Parameters:

  aFilename | image filename to load.
  aSurfaceFormat | surface format to use.

Returns:
  new surface containing the image, or NULL if unsuccessful.

XFCIMPORT UINT32* XFcImageLoader::loadImage8888 | ( | const CHAR * | aFilename | ) | `[static]`

Loads an image into a linear XFCGF_A8R8G8B8 buffer (32 bits per pixel).

Parameters:

  aFilename | filename to load.

Returns:
  new buffer containing the image, or NULL if unsuccessful.

XFCIMPORT void XFcImageLoader::loadImageInfo | ( | const CHAR * | aFilename,
|  | INT32 * | aWidth,
|  | INT32 * | aHeight,
|  | INT * | aAlphaLayer,
|  | INT * | aPaletted
| ) | `[static]`

Loads information on image.

Note:
  Parameters can be set to NULL if not needed.

Parameters:

  aFilename | filename of the image.
  aWidth | returned width, or NULL if width is not requested.
  aHeight | returned height, or NULL if height is not requested.
  aAlphaLayer | returned alpha layer availability, or NULL if it is not requested.
  aPaletted | returned palette availability, or NULL if it is not requested.

XFCIMPORT void XFcImageLoader::loadImagePaletted | ( | const CHAR * | aFilename,
|  | UINT8 ** | aPalettePtr,
|  | UINT8 ** | aBitmapPtr
| ) | `[static]`

Loads an image in paletted mode.

If file format does not support paletted mode, palette and bitmap return pointers are set to NULL.

Parameters:

  aFilename | filename to load.
  aPalettePtr | returned pointer to the palette, set to NULL if unsuccessful.
  aBitmapPtr | returned pointer to the bitmap, set to NULL if unsuccessful.

XFCIMPORT INT XFcImageLoader::loadImageToBuffer | ( | const CHAR * | aFilename,
|  | void * | aBuffer,
|  | INT32 | aPitch,
|  | INT32 | aFormat = XFCGF_DEFAULT
| ) | `[static]`

Loads an image into a buffer.

Pitch is in bytes. By default XFCGF_R5G6B5 is used for non-alpha pictures and XFCGF_A1R5G5B5 for pictures with alpha.

Parameters:

  aFilename | filename to load.
  aBuffer | destination buffer for the image data.
  aPitch | pitch of the destination buffer in bytes.
  aFormat | format of the destination buffer, see XFCGFXFORMAT.

See also:
  XFCGFXFORMAT

void XFcImageLoader::registerImageLoader | ( | XFcImageLoader * | aFilter | ) | `[static, protected]`

| Called by a plugin to register itself in its constructor.

virtual INT XFcImageLoader::validateImage | ( | const CHAR * | aFilename,
|  | XFcFile * | aFile
| ) | `[protected, pure virtual]`

Determines if this plugin can load a specified file.

With as little work as possible, this function should return 1 if this plugin can load this file, or 0 if cannot.

Parameters:

  aFilename | filename of the file for validation.
  aFile | file to validate.

Returns:
  1 if this plugin can load this file, or 0 if cannot.

Implemented in XFcImageLoadFilterPCX, and XFcImageLoadFilterTGA.

## Member Data Documentation

XFcImageLoader* XFcImageLoader::mNext

| Pointer to the next plugin.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch