TBitmapUtil Class Reference

#include <fbs.h>

Link against: fbscli.lib

class TBitmapUtil
Public Member Functions
TBitmapUtil(CFbsBitmap *)
IMPORT_C voidBegin(const TPoint &)
IMPORT_C voidBegin(const TPoint &, const TBitmapUtil &)
IMPORT_C voidDecXPos()
IMPORT_C voidDecYPos()
IMPORT_C voidEnd()
IMPORT_C TUint32GetPixel()
IMPORT_C voidIncXPos()
IMPORT_C voidIncYPos()
IMPORT_C voidSetPixel(TUint32)
IMPORT_C voidSetPixel(const TBitmapUtil &)
IMPORT_C voidSetPos(const TPoint &)

Detailed Description

Provides fast read/write access to the pixel data of a bitmap.

Functionality includes getting and setting the individual pixels of a bitmap. Common to this is the concept of the current pixel position. This is held as member data and is changed by using various efficient functions. For example, incrementing the position's x- or y co-ordinate is much quicker than setting a completely new position. This efficiency issue is important as these functions are used as part of the frequently used blitting DDA used for creating stretched or compressed versions of bitmaps.

Calls to Begin() and End() must surround any calls to the other member functions. Note that you should always ensure each Begin() is matched by an End() call when using this class.

Note also that all display modes including EColor16M are supported, but the TDisplayMode values ERgb and ENone are not considered to be display modes.

Constructor & Destructor Documentation

TBitmapUtil ( CFbsBitmap * )

IMPORT_CTBitmapUtil(CFbsBitmap *aBitmap)

Constructs a TBitmapUtil object for the specified bitmap.

Note:

The use of extended or compressed bitmaps is not supported by TBitmapUtil.

Parameters
aBitmapThe bitmap on which this TBitmapUtil will operate.

Member Function Documentation

Begin ( const TPoint & )

IMPORT_C voidBegin(const TPoint &aPosition)

Sets the current pixel position to the specified position and prepares the bitmap for access to its pixel data.

This function must be called before using any of the other functions provided by this class, otherwise damage to data may occur. It must also be matched by a subsequent call to End().

Pre-condition
The bitmap which was passed on class construction has been created and holds a valid handle.
Parameters
aPositionThe position to which the current pixel position should be set.

Begin ( const TPoint &, const TBitmapUtil & )

IMPORT_C voidBegin(const TPoint &aPosition,
const TBitmapUtil &aUtil
)

Sets the current pixel position to the specified position and prepares the bitmap for access to its pixel data.

This function is deprecated. Use the other overload, DeprecatedBegin(const TPoint&).

Parameters
aPositionThe position to which the current pixel position should be set.
aUtilNot used.
Panic Codes
FBCLI10 The bitmap's display mode is ERgb or ENone.

DecXPos ( )

IMPORT_C voidDecXPos()

Decrements the x co-ordinate of the current pixel position.

DecYPos ( )

IMPORT_C voidDecYPos()

Decrements the y co-ordinate of the current pixel position.

End ( )

IMPORT_C voidEnd()

Marks the end of the access to the bitmap data. This function must be called when finished using all the other functions provided by this class.

There must be exactly one call to End() for each previous call to Begin() for a given TBitmapUtil object.

GetPixel ( )

IMPORT_C TUint32GetPixel()const

Gets the value of the pixel at the current pixel position.

In normal usage, the value returned will immediately be used as the parameter to a call to SetPixel(). To remove the overhead of constructing a TRgb, the function uses a TUint32 rather than a TRgb to hold an RGB value.

Return Value
The value of the pixel at the current pixel position.

IncXPos ( )

IMPORT_C voidIncXPos()

Increments the x co-ordinate of the current pixel position.

IncYPos ( )

IMPORT_C voidIncYPos()

Increments the y co-ordinate of the current pixel position.

SetPixel ( TUint32 )

IMPORT_C voidSetPixel(TUint32aValue)

Sets the value of the pixel at the current pixel position.

To remove the overhead of constructing a TRgb, the function uses a TUint32 rather than a TRgb to hold an RGB value.

Parameters
aValueThe value to which the pixel at the current pixel position is to be set.

SetPixel ( const TBitmapUtil & )

IMPORT_C voidSetPixel(const TBitmapUtil &aSource)

Sets the value of the pixel at the current pixel position to that returned by aSource.GetPixel().

Parameters
aSourceThe TBitmapUtil of the source bitmap, whose pixel value is used to set the pixel at the current pixel position.

SetPos ( const TPoint & )

IMPORT_C voidSetPos(const TPoint &aPosition)

Sets a new current pixel position.

Parameters
aPositionThe new current pixel position.