rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvIndexedBitmapData Class Reference

Bitmap data class. More...

#include <ilviews/bitmaps/data.h>

Inheritance diagram for IlvIndexedBitmapData:
IlvBitmapData

List of all members.

Public Member Functions

 IlvIndexedBitmapData (IlUInt width, IlUInt height, IlvColorMap *cmap=0)
 Constructor.
virtual void computeMask ()
 Computes the mask for the instance.
IlvColorMapgetColorMap () const
 Returns the colormap for this instance.
virtual void getRGBPixel (IlUInt x, IlUInt y, IlUChar &r, IlUChar &g, IlUChar &b) const
 Returns a true color representation of a pixel located in the image at the x and y coordinates.
virtual IlUChargetRGBPixels (const IlvRect &rect, IlUInt &size, IlUChar *data=0) const
 Returns a true color representation of a region of the image stored in the instance.
IlInt getTransparentIndex () const
 Returns the index of the transparent color in the colormap.
virtual IlUInt getUsedColorNum ()
 Returns the number of referenced colors in the bitmap data.
void setColorMap (IlvColorMap *colormap)
 Sets the colormap for this instance.
virtual void setPixel (IlUInt x, IlUInt y, IlUChar pixel)
 Sets the internal representation of a pixel to the given value.
virtual void setPixels (IlUChar *data, IlUInt byteWidth, const IlvRect &rect, const IlvPoint &to)
 Sets the internal representation data to the given data.
virtual void setRGBPixel (IlUInt x, IlUInt y, IlUChar r, IlUChar g, IlUChar b)
 Sets a pixel of the image stored in the instance to the given true color representation.
virtual void setRGBPixels (IlUChar *data, IlUInt byteWidth, const IlvRect &rect, const IlvPoint &to)
 Sets a region of the image stored in the instance to the given true color representation.
void setTransparentIndex (IlInt index)
 Sets the transparent color index.
void stretch (const IlvIndexedBitmapData *srcdata, const IlvRect &srcrect, const IlvRect &dstrect)
 Stretches an image.

Detailed Description

Bitmap data class.

Library: display

The IlvIndexedBitmapData class lets you manipulate indexed images. Each pixel in an indexed image is stored using an index to a colormap. A colormap is an array of colors. An IlvIndexedBitmapData can store at most 256 colors.

See also:
IlvRGBBitmapData, IlvBWBitmapData, IlvBitmap, IlvQuantizer, IlvQuickQuantizer, IlvWUQuantizer.

Constructor & Destructor Documentation

IlvIndexedBitmapData::IlvIndexedBitmapData ( IlUInt  width,
IlUInt  height,
IlvColorMap cmap = 0 
)

Constructor.

Parameters:
width The width of the image.
height The height of the image.
cmap The colormap.

Member Function Documentation

virtual void IlvIndexedBitmapData::computeMask (  )  [virtual]

Computes the mask for the instance.

This method computes the mask from the transparent color index.

IlvColorMap* IlvIndexedBitmapData::getColorMap (  )  const

Returns the colormap for this instance.

Returns:
The colormap.
virtual void IlvIndexedBitmapData::getRGBPixel ( IlUInt  x,
IlUInt  y,
IlUChar r,
IlUChar g,
IlUChar b 
) const [virtual]

Returns a true color representation of a pixel located in the image at the x and y coordinates.

Parameters:
x The x coordinate of the pixel.
y The y coordinate of the pixel.
r The red component of the pixel.
g The green component of the pixel.
b The blue component of the pixel.

Implements IlvBitmapData.

virtual IlUChar* IlvIndexedBitmapData::getRGBPixels ( const IlvRect rect,
IlUInt size,
IlUChar data = 0 
) const [virtual]

Returns a true color representation of a region of the image stored in the instance.

Each pixel uses 4 bytes of storage; the first byte is not used, the second byte represents the red component of the pixel color, the third byte represents the green component of the pixel color, and the fourth byte represents the blue component of the pixel color. The array of memory returned has size bytes. If the data parameter is given, this method does not allocate memory and writes the data to data. The array must be deleted by the application.

Parameters:
rect The region of the image.
size The size of the returned data.
data The preallocated data.
Returns:
The pointer to the data.

Reimplemented from IlvBitmapData.

IlInt IlvIndexedBitmapData::getTransparentIndex (  )  const

Returns the index of the transparent color in the colormap.

Returns -1 if there is no transparent color.

Returns:
The index of the transparent color.
virtual IlUInt IlvIndexedBitmapData::getUsedColorNum (  )  [virtual]

Returns the number of referenced colors in the bitmap data.

Returns:
The number of colors used in the bitmap data.

Implements IlvBitmapData.

void IlvIndexedBitmapData::setColorMap ( IlvColorMap colormap  ) 

Sets the colormap for this instance.

The old colormap will be unlocked, new the one will be locked.

Parameters:
colormap The new colormap.
void IlvIndexedBitmapData::setPixel ( IlUInt  x,
IlUInt  y,
IlUChar  pixel 
) [virtual]

Sets the internal representation of a pixel to the given value.

Advanced use only. This method sets directly the internal data.

Parameters:
x The x position of the pixel.
y The y position of the pixel.
pixel The index of the pixel.
virtual void IlvIndexedBitmapData::setPixels ( IlUChar data,
IlUInt  byteWidth,
const IlvRect rect,
const IlvPoint to 
) [virtual]

Sets the internal representation data to the given data.

Advanced use only. This method sets directly the internal data.

Parameters:
data The array of indices.
byteWidth The width in bytes of the source data.
rect The region of the source data to use.
to The position in the destination image.
virtual void IlvIndexedBitmapData::setRGBPixel ( IlUInt  x,
IlUInt  y,
IlUChar  r,
IlUChar  g,
IlUChar  b 
) [virtual]

Sets a pixel of the image stored in the instance to the given true color representation.

This method maps the input pixel to the nearest color in the colormap.

Parameters:
x The x position of the pixel.
y The y position of the pixel.
r The red component of the pixel.
g The green component of the pixel.
b The blue component of the pixel.

Implements IlvBitmapData.

virtual void IlvIndexedBitmapData::setRGBPixels ( IlUChar data,
IlUInt  byteWidth,
const IlvRect rect,
const IlvPoint to 
) [virtual]

Sets a region of the image stored in the instance to the given true color representation.

The format of the data is the same as the one returned by getRGBPixels. This method maps the input pixels to the nearest colors in the colormap. The colors in the colormap must have been allocated.

Parameters:
data The true color representation of the source pixels.
byteWidth The width in bytes of the source.
rect The region of the source data.
to The position in the destination image.

Reimplemented from IlvBitmapData.

void IlvIndexedBitmapData::setTransparentIndex ( IlInt  index  ) 

Sets the transparent color index.

Parameters:
index The index of the transparent color in the colormap.
void IlvIndexedBitmapData::stretch ( const IlvIndexedBitmapData srcdata,
const IlvRect srcrect,
const IlvRect dstrect 
)

Stretches an image.

Parameters:
srcdata The bitmap data to stretch.
srcrect The source rectangle in the source bitmap data.
dstrect The destination rectangle in the destination bitmap data.

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.