Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvIndexedBitmapData Class Reference

Bitmap data class. More...

#include <ilviews/bitmaps/data.h>

Inheritance diagram for IlvIndexedBitmapData:
IlvBitmapData

Public Member Functions

 IlvIndexedBitmapData (IlUInt width, IlUInt height, IlvColorMap *cmap=0)
 Constructor. More...
 
virtual void computeMask ()
 Computes the mask for the instance. More...
 
IlvColorMapgetColorMap () const
 Returns the colormap for this instance. More...
 
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. More...
 
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. More...
 
IlInt getTransparentIndex () const
 Returns the index of the transparent color in the colormap. More...
 
virtual IlUInt getUsedColorNum ()
 Returns the number of referenced colors in the bitmap data. More...
 
void setColorMap (IlvColorMap *colormap)
 Sets the colormap for this instance. More...
 
virtual void setPixel (IlUInt x, IlUInt y, IlUChar pixel)
 Sets the internal representation of a pixel to the given value. More...
 
virtual void setPixels (IlUChar *data, IlUInt byteWidth, const IlvRect &rect, const IlvPoint &to)
 Sets the internal representation data to the given data. More...
 
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. More...
 
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. More...
 
void setTransparentIndex (IlInt index)
 Sets the transparent color index. More...
 
void stretch (const IlvIndexedBitmapData *srcdata, const IlvRect &srcrect, const IlvRect &dstrect)
 Stretches an image. More...
 
- Public Member Functions inherited from IlvBitmapData
 IlvBitmapData (IlUInt width, IlUInt height, IlUShort depth, IlUInt padding=32)
 Constructor. More...
 
virtual ~IlvBitmapData ()
 Destructor. More...
 
virtual void blend (const IlvBitmapData *src, const IlvRect &srcrect, const IlvPoint &to, IlUChar blend)
 Blends a rectangle from another bitmap data to the given position. More...
 
virtual void blendPixel (IlUInt xdst, IlUInt ydst, const IlvBitmapData *src, IlUInt xsrc, IlUInt ysrc, IlUChar blend)
 Blends a pixel from another bitmap data to the given position. More...
 
virtual void copy (const IlvBitmapData *src, const IlvRect &srcrect, const IlvPoint &to)
 Copies a rectangle from another bitmap data to the given position. More...
 
virtual void copyPixel (IlUInt xdst, IlUInt ydst, const IlvBitmapData *src, IlUInt xsrc, IlUInt ysrc)
 Copies a pixel from another bitmap data. More...
 
virtual void fill (const IlvRect &rect, IlUChar r, IlUChar g, IlUChar b, IlUChar a=255)
 Fills a rectangular area of the bitmap data with the specified color. More...
 
IlUInt getByteWidth () const
 Returns the size in bytes of a row of the image stored in the instance. More...
 
IlUInt getCount () const
 Returns the reference count for this instance.
 
IlUChargetData () const
 Returns a pointer to the internal storage memory of the instance. More...
 
IlUShort getDepth () const
 Returns the number of bits needed to describe a pixel of the image stored in the instance. More...
 
IlUInt getHeight () const
 Returns the height in pixels of the image stored in the instance. More...
 
IlvBitmapInformationgetInformation () const
 Returns the bitmap information. More...
 
virtual IlvBWBitmapDatagetMask () const
 Returns the mask bitmap data of the instance. More...
 
IlUInt getPadding () const
 Returns the padding used by the instance. More...
 
IlUChargetRowStartData (IlUInt idx) const
 Returns a pointer to the storage memory of a given row of the image in the instance. More...
 
IlUInt getWidth () const
 Returns the width in pixels of the image stored in the instance. More...
 
IlBoolean hasMask () const
 Returns whether the instance has a mask. More...
 
void lock ()
 Locks the current instance.
 
void setInformation (IlvBitmapInformation *info)
 Sets the bitmap information. More...
 
virtual void setMask (IlvBWBitmapData *mask)
 Sets the mask of the current instance. More...
 
void unLock ()
 Unlocks the current instance.
 

Detailed Description

Bitmap data class.

Library: xviews or winviews or mviews (mutually exclusive)

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::IlvIndexedBitmapData ( IlUInt  width,
IlUInt  height,
IlvColorMap cmap = 0 
)

Constructor.

Parameters
widthThe width of the image.
heightThe height of the image.
cmapThe colormap.

Member Function Documentation

§ computeMask()

virtual void IlvIndexedBitmapData::computeMask ( )
virtual

Computes the mask for the instance.

This method computes the mask from the transparent color index.

§ getColorMap()

IlvColorMap* IlvIndexedBitmapData::getColorMap ( ) const

Returns the colormap for this instance.

Returns
The colormap.

§ getRGBPixel()

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
xThe x coordinate of the pixel.
yThe y coordinate of the pixel.
rThe red component of the pixel.
gThe green component of the pixel.
bThe blue component of the pixel.

Implements IlvBitmapData.

§ getRGBPixels()

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
rectThe region of the image.
sizeThe size of the returned data.
dataThe preallocated data.
Returns
The pointer to the data.

Reimplemented from IlvBitmapData.

§ getTransparentIndex()

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.

§ getUsedColorNum()

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.

§ setColorMap()

void IlvIndexedBitmapData::setColorMap ( IlvColorMap colormap)

Sets the colormap for this instance.

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

Parameters
colormapThe new colormap.

§ setPixel()

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
xThe x position of the pixel.
yThe y position of the pixel.
pixelThe index of the pixel.

§ setPixels()

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
dataThe array of indices.
byteWidthThe width in bytes of the source data.
rectThe region of the source data to use.
toThe position in the destination image.

§ setRGBPixel()

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
xThe x position of the pixel.
yThe y position of the pixel.
rThe red component of the pixel.
gThe green component of the pixel.
bThe blue component of the pixel.

Implements IlvBitmapData.

§ setRGBPixels()

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
dataThe true color representation of the source pixels.
byteWidthThe width in bytes of the source.
rectThe region of the source data.
toThe position in the destination image.

Reimplemented from IlvBitmapData.

§ setTransparentIndex()

void IlvIndexedBitmapData::setTransparentIndex ( IlInt  index)

Sets the transparent color index.

Parameters
indexThe index of the transparent color in the colormap.

§ stretch()

void IlvIndexedBitmapData::stretch ( const IlvIndexedBitmapData srcdata,
const IlvRect srcrect,
const IlvRect dstrect 
)

Stretches an image.

Parameters
srcdataThe bitmap data to stretch.
srcrectThe source rectangle in the source bitmap data.
dstrectThe destination rectangle in the destination bitmap data.

© Copyright 2017, 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.