XFcRLESprite class Reference

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

# XFcRLESprite Class Reference

Class for drawing and constructing RLE compressed sprites. More...

List of all members.

## Public Member Functions

XFCIMPORT | ~XFcRLESprite ()
| Destructor.
XFCEXPORT void | blit (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos, INT32 aBlendMode=XFCBLEND_NONE, INT32 aBlendValue=255)
| Blits the RLE sprite to a surface.
XFCIMPORT void | blitAdditive (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos, INT32 aAlpha=32)
| Blits the RLE sprite to a surface using additive blending. aAlpha should be in the range of 0-32.
XFCIMPORT void | blitMultiplicative (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos, INT32 aAlpha=32)
| Blits the RLE sprite to a surface using multiplicative blending.
XFCIMPORT void | blitInverseMultiplicative (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos, INT32 aAlpha=32)
| Blits the RLE sprite to a surface using inverse multiplicative blending.
XFCIMPORT INT32 | getWidth ()
| Returns the width of actual image in this sprite.
XFCIMPORT INT32 | getHeight ()
| Returns the height of actual image in this sprite.
XFCIMPORT INT32 | getXOffset ()
| Returns the offset to the first colmn from the top left corner.
XFCIMPORT INT32 | getYOffset ()
| Returns the offset to the first row from the top left corner.
XFCIMPORT void | setXOffset (INT32 aXOffset)
| Sets the offset to the first colmn from the top left corner.
XFCIMPORT void | setYOffset (INT32 aYOffset)
| Sets the offset to the first row from the top left corner.
XFCIMPORT INT32 * | getLineTable ()
| Returns a pointer to the line table.
XFCIMPORT UINT16 * | getData ()
| Returns a pointer to the compressed data.
XFCIMPORT INT32 | getDataLength ()
| Returns the length of the compressed data.

## Static Public Member Functions

XFCIMPORT XFcRLESprite * | create (XFcGLSurface *aSurface, UINT32 aBaseMask, UINT32 aBaseColor)
| Creates a RLE-compressed sprite from a surface.
XFCIMPORT XFcRLESprite * | create (INT32 aWidth, INT32 aHeight, INT32 aXOffset, INT32 aYOffset, INT32 *aLineTable, UINT16 *aData, INT32 aDataLength)
| Creates a RLE-compressed sprite from stored data.

## Protected Member Functions

| XFcRLESprite ()
| Protected constructor.
XFCIMPORT void | blitFast55X5 (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos)
| Blits the RLE sprite to a surface, fast blitting for 55X5 format, no blending.
XFCIMPORT void | blitGeneric (XFcGLSurface *aSurface, XFcRectangle *aClipRect, INT32 aXPos, INT32 aYPos, INT32 aBlend, UINT32 aBlendValue)
| Blits the RLE sprite to a surface, supports all formats.
XFCIMPORT INT | initBlit (XFcRectangle *aClipRect, INT32 aYPos, INT32 aXPos, INT32 &aXs, INT32 &aXe, INT32 &aXt, INT32 &aYs, INT32 &aYe, INT32 &aYt)
| Inits the blitting of a RLESprite and calculates clipping extents.

## Static Protected Member Functions

XFCIMPORT void | getExtents (XFcGLSurface *aSurface, XFcRectangle *aRectangle, UINT32 aBaseMask, UINT32 aBaseColor)
| Find the extents for RLE compression.
XFCIMPORT UINT32 | compressLine (UINT8 *aSource, UINT16 *aDestination, UINT32 aBaseMask, UINT32 aBaseColor, UINT32 aLineLength, INT32 aFormat, INT32 aBpp)
| Compresses a line from source to destination.
XFCIMPORT UINT32 | getSourceColor (UINT8 *aSource, INT32 aFormat, INT32 aBpp)
| Reads an UINT32 color value from UINT8 * buffer.

## Protected Attributes

INT32 | mWidth
| Width of the sprite.
INT32 | mHeight
| Height of the sprite.
INT32 | mXOffset
| Offset to the first column from the top left corner.
INT32 | mYOffset
| Offset to the first row from the top left corner.
INT32 * | mLineTable
| Table of line start indices in the data.
UINT16 * | mData
| Compressed data.
INT32 | mDataLength
| Length of the compressed data (size in UINT16's).

## Detailed Description

Class for drawing and constructing RLE compressed sprites.

## Constructor & Destructor Documentation

XFCIMPORT XFcRLESprite::~XFcRLESprite | ( |  | ) |

| Destructor.

XFcRLESprite::XFcRLESprite | ( |  | ) | `[protected]`

| Protected constructor.

## Member Function Documentation

XFCEXPORT void XFcRLESprite::blit | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos,
|  | INT32 | aBlendMode = XFCBLEND_NONE,
|  | INT32 | aBlendValue = 255
| ) |

Blits the RLE sprite to a surface.

Parameters:

  aSurface | destination surface to blit this RLE sprite.
  aClipRect | clipping rectangle to use.
  aXPos | top-left X-coordinate.
  aYPos | top-left Y-coordinate.
  aBlendMode | the blending mode to use.
  aBlendValue | the blending value for the blending mode.

Note:
  Coordinates are in screen coordinates.

XFCIMPORT void XFcRLESprite::blitAdditive | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos,
|  | INT32 | aAlpha = 32
| ) |

Blits the RLE sprite to a surface using additive blending. aAlpha should be in the range of 0-32.

Parameters:

  aSurface | destination surface to blit this RLE sprite.
  aClipRect | clipping rectangle to use.
  aXPos | top-left X-coordinate.
  aYPos | top-left Y-coordinate.
  aAlpha | alpha in range 0-32.

Note:
  Coordinates are in screen coordinates.

XFCIMPORT void XFcRLESprite::blitFast55X5 | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos
| ) | `[protected]`

| Blits the RLE sprite to a surface, fast blitting for 55X5 format, no blending.

XFCIMPORT void XFcRLESprite::blitGeneric | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos,
|  | INT32 | aBlend,
|  | UINT32 | aBlendValue
| ) | `[protected]`

| Blits the RLE sprite to a surface, supports all formats.

XFCIMPORT void XFcRLESprite::blitInverseMultiplicative | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos,
|  | INT32 | aAlpha = 32
| ) |

Blits the RLE sprite to a surface using inverse multiplicative blending.

Parameters:

  aSurface | destination surface to blit this RLE sprite.
  aClipRect | clipping rectangle to use.
  aXPos | top-left X-coordinate.
  aYPos | top-left Y-coordinate.
  aAlpha | alpha in range 0-32.

Note:
  Coordinates are in screen coordinates.

XFCIMPORT void XFcRLESprite::blitMultiplicative | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aClipRect,
|  | INT32 | aXPos,
|  | INT32 | aYPos,
|  | INT32 | aAlpha = 32
| ) |

Blits the RLE sprite to a surface using multiplicative blending.

Parameters:

  aSurface | destination surface to blit this RLE sprite.
  aClipRect | clipping rectangle to use.
  aXPos | top-left X-coordinate.
  aYPos | top-left Y-coordinate.
  aAlpha | alpha in range 0-32.

Note:
  Coordinates are in screen coordinates.

XFCIMPORT UINT32 XFcRLESprite::compressLine | ( | UINT8 * | aSource,
|  | UINT16 * | aDestination,
|  | UINT32 | aBaseMask,
|  | UINT32 | aBaseColor,
|  | UINT32 | aLineLength,
|  | INT32 | aFormat,
|  | INT32 | aBpp
| ) | `[static, protected]`

| Compresses a line from source to destination. Returns the amount of bytes in the compressed data.

XFCIMPORT XFcRLESprite* XFcRLESprite::create | ( | INT32 | aWidth,
|  | INT32 | aHeight,
|  | INT32 | aXOffset,
|  | INT32 | aYOffset,
|  | INT32 * | aLineTable,
|  | UINT16 * | aData,
|  | INT32 | aDataLength
| ) | `[static]`

Creates a RLE-compressed sprite from stored data.

This can be used for loading the XFcRLESprite from existing data.

Parameters:

  aWidth | width of the sprite.
  aHeight | height of the sprite.
  aXOffset | offset to the first column from the top left corner.
  aYOffset | offset to the first row from the top left corner.
  aLineTable | table of line start indices in the data.
  aData | pointer to the compressed data.
  aDataLength | length of the compressed data (size in UINT16's).

XFCIMPORT XFcRLESprite* XFcRLESprite::create | ( | XFcGLSurface * | aSurface,
|  | UINT32 | aBaseMask,
|  | UINT32 | aBaseColor
| ) | `[static]`

Creates a RLE-compressed sprite from a surface.

aBaseColor is the color that is compressed as transparent. aBaseMask defines which componets of the color are used in the comparison process, for instance aBaseMask 0xff000000 and aBaseColor 0 will compress (in ARGB color space) all those pixels whose alpha value is zero. To compress based on color (in RGB space), use aBaseMask 0xffffff and aBaseColor of any color you want to compress away. Also subsequent runs of the same color are compressed away, so simple images compress really well.

Parameters:

  aSurface | image to create the RLE-compressed form from.
  aBaseMask | mask applied to image pixels before comparing to the base color.
  aBaseColor | color to compress as transparent.

Returns:
  new RLE sprite object, or NULL if unsuccessful.

XFCIMPORT UINT16* XFcRLESprite::getData | ( |  | ) |

| Returns a pointer to the compressed data.

XFCIMPORT INT32 XFcRLESprite::getDataLength | ( |  | ) |

| Returns the length of the compressed data.

XFCIMPORT void XFcRLESprite::getExtents | ( | XFcGLSurface * | aSurface,
|  | XFcRectangle * | aRectangle,
|  | UINT32 | aBaseMask,
|  | UINT32 | aBaseColor
| ) | `[static, protected]`

| Find the extents for RLE compression. Areas outside these extents would be compressed away, so there's no point in storing them.

XFCIMPORT INT32 XFcRLESprite::getHeight | ( |  | ) |

| Returns the height of actual image in this sprite.

XFCIMPORT INT32* XFcRLESprite::getLineTable | ( |  | ) |

| Returns a pointer to the line table.

XFCIMPORT UINT32 XFcRLESprite::getSourceColor | ( | UINT8 * | aSource,
|  | INT32 | aFormat,
|  | INT32 | aBpp
| ) | `[static, protected]`

| Reads an UINT32 color value from UINT8 * buffer.

XFCIMPORT INT32 XFcRLESprite::getWidth | ( |  | ) |

| Returns the width of actual image in this sprite.

XFCIMPORT INT32 XFcRLESprite::getXOffset | ( |  | ) |

| Returns the offset to the first colmn from the top left corner.

XFCIMPORT INT32 XFcRLESprite::getYOffset | ( |  | ) |

| Returns the offset to the first row from the top left corner.

XFCIMPORT INT XFcRLESprite::initBlit | ( | XFcRectangle * | aClipRect,
|  | INT32 | aYPos,
|  | INT32 | aXPos,
|  | INT32 & | aXs,
|  | INT32 & | aXe,
|  | INT32 & | aXt,
|  | INT32 & | aYs,
|  | INT32 & | aYe,
|  | INT32 & | aYt
| ) | `[protected]`

| Inits the blitting of a RLESprite and calculates clipping extents.

XFCIMPORT void XFcRLESprite::setXOffset | ( | INT32 | aXOffset | ) |

| Sets the offset to the first colmn from the top left corner.

XFCIMPORT void XFcRLESprite::setYOffset | ( | INT32 | aYOffset | ) |

| Sets the offset to the first row from the top left corner.

## Member Data Documentation

UINT16* XFcRLESprite::mData`[protected]`

| Compressed data.

INT32 XFcRLESprite::mDataLength`[protected]`

| Length of the compressed data (size in UINT16's).

INT32 XFcRLESprite::mHeight`[protected]`

| Height of the sprite.

INT32* XFcRLESprite::mLineTable`[protected]`

| Table of line start indices in the data.

INT32 XFcRLESprite::mWidth`[protected]`

| Width of the sprite.

INT32 XFcRLESprite::mXOffset`[protected]`

| Offset to the first column from the top left corner.

INT32 XFcRLESprite::mYOffset`[protected]`

| Offset to the first row from the top left corner.

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