RenderWare V2.1

Previous Page Index Next Page

unsigned char *

RwGetRasterPixels(RwRaster *raster);

Description

Retrieves a pointer to the pixels of the raster.

Arguments

raster Pointer to the raster.

Return Value

A pointer to the pixels of raster if successful, and NULL otherwise.

Comments

The memory used to store the pixels of a raster may be stored in the memory of a peripheral device or may move in main memory. In order that an application can read and write to this memory it must be locked. RwGetRasterPixels() performs this locking. The pointer returned by this function must be released (and the associated memory unlocked) after use by a call to RwReleaseRasterPixels(). Following RwReleaseRasterPixels() the pointer is no longer valid and it must not be cached for later use. To prevent performance degradation it is essential that the pointer is released as soon as possible.

The pointer returned by this function points to an array of bytes organized into RwGetRasterHeight() scan lines. Each scan line is RwGetRasterStride() bytes in width.

The pixel format is dependent on the raster’s depth. For an 8 bit raster each pixel occupies a single byte. This byte is an index into the RenderWare color palette. For a 16 bit raster each pixel occupies two bytes which are interpreted as a short (16 bit) integer. This integer represents a direct, RGB color specification. The least significant five bits (bits 0 - 4) are the blue channel, the next six bits (bits 5 - 10) are the green channel and the most significant five bits (bits 11 - 15) are the red channel.

See Also

RwBitmapRaster()

RwCreateRaster()

RwGetRasterDepth()

RwGetRasterHeight()

RwGetRasterStride()

RwGetRasterWidth()

RwReadMaskRaster()

RwReadRaster()

RwReleaseRasterPixels()