Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: fbs.h
Link against: fbscli.lib

Class CFbsBitmap

CFbsBitmap

Support

Supported from 5.0

Description

A bitmap managed by the font and bitmap server.

The class also defines some palette API functions. This functionality is defined but not yet implemented, since none of the modes currently supported by screen or bitmaps require variable palettes.

Note that the CFbsBitmap format is internal to Symbian, but the Image Converter API can be used to convert them to standard formats.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CFbsBitmapA bitmap managed by the font and bitmap server

Defined in CFbsBitmap:
CFbsBitmap(), Create(), DataAddress(), DisplayMode(), Duplicate(), ExternalizeL(), ExternalizeRectangleL(), GetPalette(), GetPixel(), GetScanLine(), GetVerticalScanLine(), Handle(), Header(), HorizontalPixelsToTwips(), HorizontalTwipsToPixels(), InternalizeL(), IsFileInRom(), IsLargeBitmap(), IsMonochrome(), IsRomBitmap(), Load(), PaletteAttributes(), Reset(), Resize(), Save(), ScanLineLength(), SetPalette(), SetScanLine(), SetSizeInTwips(), SizeInPixels(), SizeInTwips(), StoreL(), VerticalPixelsToTwips(), VerticalTwipsToPixels(), ~CFbsBitmap()

Inherited from CBase:
operator new()


Construction and destruction


CFbsBitmap()

CFbsBitmap();

Description

Default constructor.


~CFbsBitmap()

~CFbsBitmap();

Description

Default destructor.

[Top]


Bitmap creation


Create()

TInt Create(const TSize& aSizeInPixels,TDisplayMode aDispMode);

Description

Creates a bitmap with a specified size and display-mode.

Parameters

const TSize& aSizeInPixels

The size of the bitmap to be created.

TDisplayMode aDispMode

The display-mode of the bitmap to be created.

Return value

TInt

KErrNone, if successful; KErrCouldNotConnect, if no connection to the font and bitmap server could be made; KErrArgument, if the specified size is illegal.


Duplicate()

TInt Duplicate(TInt aHandle);

Description

Duplicates a bitmap.

This function does not create a copy of the bitmap. It just assigns another handle to the bitmap in the font and bitmap server, and sets this object's handle to that. If the specified bitmap is in the ROM, it just assigns a pointer to it.

Parameters

TInt aHandle

The handle to an existing bitmap.

Return value

TInt

KErrNone if successful; KErrCouldNotConnect if no connection to the font and bitmap server could be made; KErrUnknown if no bitmap could be found with the specified handle number.


Header()

SEpocBitmapHeader Header() const;

Description

Creates a bitmap header.

This is used when streaming bitmaps to stores.

Return value

SEpocBitmapHeader

The bitmap header for the bitmap.


Reset()

void Reset();

Description

Releases the bitmap’s handle from the font and bitmap server and decrements its access count.

The server-side bitmap is only deleted when the access count for the bitmap decrements to zero.

[Top]


Bitmap information


DisplayMode()

TDisplayMode DisplayMode() const;

Description

Gets the display mode of the bitmap.

Return value

TDisplayMode

The display mode of the bitmap.


DataAddress()

TUint32* DataAddress() const;

Description

Gets the address of the first pixel of the bitmap.

The first pixel is at the top-left.

Return value

TUint32*

The address of the first pixel of the bitmap.


Handle()

TInt Handle() const;

Description

Gets the handle number of the bitmap.

Return value

TInt

The handle number of the bitmap.

[Top]


Scanlines


GetPixel()

void GetPixel(TRgb& aColor,const TPoint& aPixel) const;

Description

Gets the RGB value of the specified pixel.

Parameters

TRgb& aColor

The RGB value of the specified pixel.

const TPoint& aPixel

The pixel whose colour is to be determined.


GetScanLine()

void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode) const;

Description

Gets the bitmap’s scanline for the specified line starting from the specified point.

The dither offset of the bitmap is taken to be TPoint(0,0).

Parameters

TDes8& aBuf

The buffer in which the scanline is returned.

const TPoint& aPixel

The start pixel.

TInt aLength

The number of pixels to get.

TDisplayMode aDispMode

The bitmap’s display-mode.


GetScanLine()

void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;

Description

Gets the bitmap’s scanline for the specified line starting from the specified point and using the specified dither offset.

Parameters

TDes8& aBuf

The buffer in which the scanline is returned.

const TPoint& aPixel

The start pixel.

TInt aLength

The number of pixels to get.

const TPoint& aDitherOffset

The dither offset of the bitmap.

TDisplayMode aDispMode

The bitmap’s display-mode.


GetVerticalScanLine()

void GetVerticalScanLine(TDes8& aBuf,TInt aX,TDisplayMode aDispMode) const;

Description

Gets the bitmap’s vertical scanline starting at the specified x co-ordinate.

The dither offset of the bitmap is taken to be TPoint(0,0).

Parameters

TDes8& aBuf

The buffer in which the vertical scanline is returned.

TInt aX

The x co-ordinate of the vertical scanline.

TDisplayMode aDispMode

The bitmap’s display-mode.


GetVerticalScanLine()

void GetVerticalScanLine(TDes8& aBuf,TInt aX,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;

Description

Gets the bitmap’s vertical scanline starting at the specified x co-ordinate and using the specified dither offset.

Parameters

TDes8& aBuf

The buffer in which the vertical scanline will be returned.

TInt aX

The x co-ordinate of the vertical scanline to get.

const TPoint& aDitherOffset

The dither offset of the bitmap.

TDisplayMode aDispMode

The bitmap’s display-mode.


ScanLineLength()

static TInt ScanLineLength(TInt aLength,TDisplayMode aDispMode);

Description

Gets the length of a scanline, in bytes.

Parameters

TInt aLength

The length of a scanline in pixels.

TDisplayMode aDispMode

The display mode of the bitmap.

Return value

TInt

Number of bytes in the scanline.


SetScanLine()

void SetScanLine(TDes8& aBuf,TInt aY) const;

Description

Sets the bitmap’s horizontal scanline at the specified y co-ordinate to the scanline contained in the buffer.

Parameters

TDes8& aBuf

The new scanline to be written to the bitmap.

TInt aY

The y co-ordinate of the scanline.

[Top]


Twip/pixel mapping


HorizontalPixelsToTwips()

TInt HorizontalPixelsToTwips(TInt aPixels) const;

Description

Converts a horizontal dimension on the graphics device from pixels to twips.

Parameters

TInt aPixels

A horizontal dimension on the graphics device in pixels.

Return value

TInt

A horizontal dimension on the graphics device in twips.


HorizontalTwipsToPixels()

TInt HorizontalTwipsToPixels(TInt aTwips) const;

Description

Converts a horizontal dimension on the graphics device from twips to pixels.

Parameters

TInt aTwips

A horizontal dimension on the graphics device in twips.

Return value

TInt

A horizontal dimension on the graphics device in pixels.


VerticalPixelsToTwips()

TInt VerticalPixelsToTwips(TInt aPixels) const;

Description

Converts a vertical dimension on the graphics device from pixels to twips.

Parameters

TInt aPixels

A vertical dimension on the graphics device in pixels.

Return value

TInt

A vertical dimension on the graphics device in twips.


VerticalTwipsToPixels()

TInt VerticalTwipsToPixels(TInt aTwips) const;

Description

Converts a vertical dimension on the graphics device from twips to pixels.

Parameters

TInt aTwips

A vertical dimension on the graphics device in twips.

Return value

TInt

A vertical dimension on the graphics device in pixels.

[Top]


Sizing/resizing bitmaps


SizeInPixels()

TSize SizeInPixels() const;

Description

Gets the pixel-size of the bitmap.

Return value

TSize

The size of the bitmap, in pixels.


SizeInTwips()

TSize SizeInTwips() const;

Description

Gets the twip-size of the bitmap.

Return value

TSize

The size of the bitmap, in twips.


SetSizeInTwips()

void SetSizeInTwips(const MGraphicsDeviceMap* aMap);

Description

Sets the twip-size of the bitmap by converting the bitmap’s pixel-size from pixels to twips, using the conversion functions in the specified graphics device map.

Parameters

const MGraphicsDeviceMap* aMap

The graphics device map to be used for providing pixel to twip conversion.


SetSizeInTwips()

void SetSizeInTwips(const TSize& aSizeInTwips);

Description

Sets the twip-size of the bitmap directly to the specified size.

Parameters

const TSize& aSizeInTwips

The new size of the bitmap, in twips.


Resize()

TInt Resize(const TSize& aSizeInPixels);

Description

Resets the pixel-size of the bitmap.

If the new size is bigger than the old, the original bitmap is still situated at (0,0), but pixels outside the range of the old pixel-size are set to zero.

Parameters

const TSize& aSizeInPixels

The new size of the bitmap.

Return value

TInt

KErrNone , if successful; KErrArgument, if the new size is illegal; KErrGeneral; if the bitmap has not yet been created; KErrAccessDenied, if the bitmap is in the ROM; otherwise another of the system-wide error codes.

[Top]


Streaming and storing


ExternalizeL()

void ExternalizeL(RWriteStream& aStream) const;

Description

Externalises the bitmap to the specified stream.

Parameters

RWriteStream& aStream

The write stream.


ExternalizeRectangleL()

void ExternalizeRectangleL(RWriteStream& aStream,const TRect& aRect) const;

Description

Externalises that area of the bitmap contained within a specified rectangular area.

Parameters

RWriteStream& aStream

The write stream

const TRect& aRect

The rectangular area of the bitmap to externalise. The bitmap that is externalized will be of this size.


InternalizeL()

void InternalizeL(RReadStream& aStream);

Description

Internalises a CFbsBitmap from a stream.

Parameters

RReadStream& aStream

The read stream.


StoreL()

static void StoreL(const TDesC& aFilename,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);

Description

Constructs a multi-bitmap file.

Parameters

const TDesC& aFilename

The name of the multi-bitmap file to be created.

TInt aNumSources

The number of bitmaps to store in the file.

const TDesC* aSources[]

An array of pointers to bitmaps to be stored.

TInt32 aSourceIds[]

An array of identifiers for the bitmaps to be stored.


Load()

TInt Load(const TDesC& aFileName,TInt32 aId=0,TBool aShareIfLoaded=ETrue);

Description

Loads a specific bitmap from a multi-bitmap file.

The bitmap may be shared by other Font and Bitmap server clients.

Parameters

const TDesC& aFileName

The filename of the multi-bitmap (.mbm) file.

TInt32 aId=0

The bitmap identifier.

TBool aShareIfLoaded=ETrue

Specifies whether or not the loaded bitmap will be made available for sharing between FBSERV clients.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Save()

TInt Save(const TDesC& aFilename);

Description

Saves the bitmap as a direct file store.

The file store overwrites any existing file with the same name.

Parameters

const TDesC& aFilename

The name of the file.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.

[Top]


Bitmap advanced information


IsFileInRom()

static TBool IsFileInRom(const TDesC& aFilename,TUint32*& aWord);

Description

Tests whether or not the specified file is in ROM.

Parameters

const TDesC& aFilename

The name of the file.

TUint32*& aWord

On return, contains the address of the file in ROM.

Return value

TBool

True, if the file is in the ROM; false, otherwise.


IsLargeBitmap()

TBool IsLargeBitmap() const;

Description

Tests whether the bitmap is a large bitmap.

A bitmap is defined to be large if its size is greater than a particular threshold; this is currently set at 4Kb.

Return value

TBool

True, if the bitmap is large; false, otherwise.


IsMonochrome()

TBool IsMonochrome() const;

Description

Tests whether or not the bitmap is monochrome.

Monochrome bitmaps have a display-mode of 1 bit-per-pixel.

Return value

TBool

True, if the bitmap is monochrome; false, otherwise.


IsRomBitmap()

TBool IsRomBitmap() const;

Description

Tests whether or not the bitmap is in ROM.

Return value

TBool

True, if the bitmap is a ROM bitmap; false, otherwise.

[Top]


Palettes


GetPalette()

TInt GetPalette(CPalette*& aPalette) const;

Description

Gets the bitmap’s palette.

Parameters

CPalette*& aPalette

On return, this holds a pointer to the bitmap’s palette.

Return value

TInt

KErrNone, if successful; otherwise, another of the system-wide error codes.


SetPalette()

void SetPalette(CPalette* aPalette);

Description

Sets the bitmap’s palette.

Parameters

CPalette* aPalette

The pointer to the new palette for the bitmap.


PaletteAttributes()

void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;

Description

Sets two attributes for the bitmap’s palette.

Parameters

TBool& aModifiable

Attribute: whether or not the palette is modifiable.

TInt& aNumEntries

Attribute: the number of entries in the palette.