Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvBitmapData Class Referenceabstract

Bitmap data base class. More...

#include <ilviews/bitmaps/data.h>

Inheritance diagram for IlvBitmapData:
IlvBWBitmapData IlvIndexedBitmapData IlvRGBBitmapData

Public Member Functions

 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...
 
virtual void getRGBPixel (IlUInt x, IlUInt y, IlUChar &r, IlUChar &g, IlUChar &b) const =0
 Returns a true color representation of a pixel located in the image at 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...
 
IlUChargetRowStartData (IlUInt idx) const
 Returns a pointer to the storage memory of a given row of the image in the instance. More...
 
virtual IlUInt getUsedColorNum ()=0
 Returns the number of referenced colors in the bitmap data. 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...
 
virtual void setRGBPixel (IlUInt x, IlUInt y, IlUChar r, IlUChar g, IlUChar b)=0
 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 unLock ()
 Unlocks the current instance.
 

Detailed Description

Bitmap data base class.

Library: xviews or winviews or mviews (mutually exclusive)

The bitmap data lets you manipulate abstract representations of images in memory. This class hides internal memory storage of data and provides a uniform way of dealing with the data. Subclasses of IlvBitmapData handle specific types of data such as indexed data with colormaps, true color data, and black and white data.

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

Constructor & Destructor Documentation

◆ IlvBitmapData()

IlvBitmapData::IlvBitmapData ( IlUInt  width,
IlUInt  height,
IlUShort  depth,
IlUInt  padding = 32 
)

Constructor.

Initializes a new IlvBitmapData object representing an image of width width and height height; each pixel of the image is represented using depth bits. The image is stored internally top-bottom; images are stored in rows of scanline, with each line padded to padding bits. IlvBitmapData can have an associated mask. A mask is a black and white BitmapData that indicates which of the pixels in the image will be displayed.

Parameters
widthThe width of the image.
heightThe height of the image.
depthThe number of bits needed to describe a pixel.
paddingThe padding of a scanline in the internal representation.

◆ ~IlvBitmapData()

virtual IlvBitmapData::~IlvBitmapData ( )
virtual

Destructor.

The destructor releases all the memory used by the instance.

Member Function Documentation

◆ blend()

virtual void IlvBitmapData::blend ( const IlvBitmapData src,
const IlvRect srcrect,
const IlvPoint to,
IlUChar  blend 
)
virtual

Blends a rectangle from another bitmap data to the given position.

Parameters
srcThe source bitmap data.
srcrectThe rectangle in the source data.
toThe position to copy the image to.
blendThe blend factor (ranges from 0 to 255).

Reimplemented in IlvRGBBitmapData.

◆ blendPixel()

virtual void IlvBitmapData::blendPixel ( IlUInt  xdst,
IlUInt  ydst,
const IlvBitmapData src,
IlUInt  xsrc,
IlUInt  ysrc,
IlUChar  blend 
)
virtual

Blends a pixel from another bitmap data to the given position.

Parameters
xdstThe destination x coordinate.
ydstThe destination y coordinate.
srcThe source bitmap data.
xsrcThe source x coordinate.
ysrcThe source y coordinate.
blendThe blend factor (ranges from 0 to 255).

◆ copy()

virtual void IlvBitmapData::copy ( const IlvBitmapData src,
const IlvRect srcrect,
const IlvPoint to 
)
virtual

Copies a rectangle from another bitmap data to the given position.

Parameters
srcThe source bitmap data.
srcrectThe rectangle in the source data.
toThe position to copy the image to.

Reimplemented in IlvRGBBitmapData.

◆ copyPixel()

virtual void IlvBitmapData::copyPixel ( IlUInt  xdst,
IlUInt  ydst,
const IlvBitmapData src,
IlUInt  xsrc,
IlUInt  ysrc 
)
virtual

Copies a pixel from another bitmap data.

Parameters
xdstThe destination x coordinate.
ydstThe destination y coordinate.
srcThe source bitmap data.
xsrcThe source x coordinate.
ysrcThe source y coordinate.

◆ fill()

virtual void IlvBitmapData::fill ( const IlvRect rect,
IlUChar  r,
IlUChar  g,
IlUChar  b,
IlUChar  a = 255 
)
virtual

Fills a rectangular area of the bitmap data with the specified color.

Parameters
rectThe rectangular area.
rThe red component of the color.
gThe green component of the color.
bThe blue component of the color.
aThe alpha component of the color.

Reimplemented in IlvRGBBitmapData.

◆ getByteWidth()

IlUInt IlvBitmapData::getByteWidth ( ) const

Returns the size in bytes of a row of the image stored in the instance.

Returns
The width in bytes of a scanline.

◆ getData()

IlUChar* IlvBitmapData::getData ( ) const

Returns a pointer to the internal storage memory of the instance.

Returns
A pointer to the data.

◆ getDepth()

IlUShort IlvBitmapData::getDepth ( ) const

Returns the number of bits needed to describe a pixel of the image stored in the instance.

Returns
The depth.

◆ getHeight()

IlUInt IlvBitmapData::getHeight ( ) const

Returns the height in pixels of the image stored in the instance.

Returns
The height.

◆ getInformation()

IlvBitmapInformation* IlvBitmapData::getInformation ( ) const

Returns the bitmap information.

Returns
The bitmap information.

◆ getMask()

virtual IlvBWBitmapData* IlvBitmapData::getMask ( ) const
virtual

Returns the mask bitmap data of the instance.

Returns 0 if the instance has no mask.

Returns
The pointer to the IlvBWBitmapData instance describing the mask.

◆ getPadding()

IlUInt IlvBitmapData::getPadding ( ) const

Returns the padding used by the instance.

Returns
The padding.

◆ getRGBPixel()

virtual void IlvBitmapData::getRGBPixel ( IlUInt  x,
IlUInt  y,
IlUChar r,
IlUChar g,
IlUChar b 
) const
pure virtual

Returns a true color representation of a pixel located in the image at 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.

Implemented in IlvBWBitmapData, IlvRGBBitmapData, and IlvIndexedBitmapData.

◆ getRGBPixels()

virtual IlUChar* IlvBitmapData::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 in IlvBWBitmapData, IlvRGBBitmapData, and IlvIndexedBitmapData.

◆ getRowStartData()

IlUChar* IlvBitmapData::getRowStartData ( IlUInt  idx) const

Returns a pointer to the storage memory of a given row of the image in the instance.

Parameters
idxThe row.
Returns
The pointer to the row data.

◆ getUsedColorNum()

virtual IlUInt IlvBitmapData::getUsedColorNum ( )
pure virtual

Returns the number of referenced colors in the bitmap data.

Returns
The number of colors used in the bitmap data.

Implemented in IlvBWBitmapData, IlvRGBBitmapData, and IlvIndexedBitmapData.

◆ getWidth()

IlUInt IlvBitmapData::getWidth ( ) const

Returns the width in pixels of the image stored in the instance.

Returns
The width.

◆ hasMask()

IlBoolean IlvBitmapData::hasMask ( ) const

Returns whether the instance has a mask.

Returns
IlTrue if the instance has a mask.

◆ setInformation()

void IlvBitmapData::setInformation ( IlvBitmapInformation info)

Sets the bitmap information.

Parameters
infoThe new bitmap information.

◆ setMask()

virtual void IlvBitmapData::setMask ( IlvBWBitmapData mask)
virtual

Sets the mask of the current instance.

The old mask is deleted if present.

Parameters
maskThe mask to use for the instance.

◆ setRGBPixel()

virtual void IlvBitmapData::setRGBPixel ( IlUInt  x,
IlUInt  y,
IlUChar  r,
IlUChar  g,
IlUChar  b 
)
pure virtual

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

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.

Implemented in IlvBWBitmapData, IlvRGBBitmapData, and IlvIndexedBitmapData.

◆ setRGBPixels()

virtual void IlvBitmapData::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.

Parameters
dataThe true color representation of the source pixels.
byteWidthThe width in bytes of the source data.
rectThe region of the source data.
toThe position in the destination image.

Reimplemented in IlvRGBBitmapData, and IlvIndexedBitmapData.