The IlvRGBBitmapData Class

The IlvRGBBitmapData class is dedicated to true color images, where raster data is a direct representation of the colors of the pixels.

Creating a True Color Bitmap Data of Dimensions 256 * 256 Pixels and Filling it With a Gradient

IlvRGBBitmapData* bdata = new IlvRGBBitmapData(256, 256);

for (IlUInt h = 0; h < 256; ++h)

for (IlUInt w = 0; w < 256; ++w)

bdata->fastSetRGBPixel(w, h, w, h, w);

As with IlvIndexedBitmapData, you can then create an IlvBitmap and display it using Views standard methods.

When on an 8-bit color display, the Views library automatically converts this true color image to an indexed image using an algorithm yielding a very high quality image.

The internal representation for true color bitmap data is an array of width * height entries. Each entry is a 4-byte quadruplet describing a pixel as follows:

  • First byte is the alpha component.

  • Second byte is the red component.

  • Third byte is the green component.

  • Fourth byte is the blue component.

The array can be described top-bottom or bottom-top, so you have a line access method using getRowStartData.

You can use various methods to access raster data:

  • getData returns a pointer to the raw raster data.

  • getRGBPixels allows you to retrieve the RGB representation of a given rectangle.

  • fill allows you to fill a rectangle with a given color.

  • copy allows you to copy a rectangle of a bitmap data to a given position in another bitmap data.

  • blend allows you to smoothly blend a bitmap data into another using a blend factor.

  • alphaCompose uses the alpha channel to compose two bitmap data.

  • tile allows you to tile a bitmap data into another.

  • stretch allows you to stretch a portion of a bitmap data into another.

  • stretchSmooth allows you to stretch a portion of a bitmap data into another using high quality resampling methods.

You can also independently access the color and alpha values for a given pixel.