Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: gdi.h
Link against: N/A

Class CBitmapDevice

CBitmapDevice

Support

Supported from 5.0

Description

Defines an interface for the capabilities and attributes of a bitmapped graphics device.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CBitmapDeviceDefines an interface for the capabilities and attributes of a bitmapped graphics device
CGraphicsDeviceSpecifies the interface for concrete device classes
MGraphicsDeviceMapInterface class for mapping between twips and device-specific units (pixels)

Defined in CBitmapDevice:
AddFile(), CreateBitmapContext(), FontHeightInPixels(), GetNearestFontInPixels(), GetPixel(), GetScanLine(), RemoveFile()

Inherited from CBase:
operator new()

Inherited from CGraphicsDevice:
CreateContext(), DisplayMode(), FontHeightInTwips(), GetPalette(), NumTypefaces(), PaletteAttributes(), SetPalette(), SizeInPixels(), SizeInTwips(), TypefaceSupport()

Inherited from MGraphicsDeviceMap:
GetNearestFontInTwips(), HorizontalPixelsToTwips(), HorizontalTwipsToPixels(), PixelsToTwips(), ReleaseFont(), TwipsToPixels(), VerticalPixelsToTwips(), VerticalTwipsToPixels()


Creating a bitmap context


CreateBitmapContext()

TInt CreateBitmapContext(CBitmapContext*& aGC);

Description

Creates a bitmap context for this bitmap device.

Parameters

CBitmapContext*& aGC

On return, holds a pointer to the created bitmap context.

Return value

TInt

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

[Top]


Getting pixels and scan lines


GetPixel()

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

Description

Gets the RGB colour of an individual pixel on a bitmapped graphics device.

This pure virtual function is implemented in derived classes.

Parameters

TRgb& aColor

On return, should contain the RGB colour of the pixel.

const TPoint& aPixel

The (x,y) co-ordinates of the pixel. The top left pixel is (0,0).


GetScanLine()

virtual void GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,TInt aLength,TDisplayMode aDispMode) const=0;

Description

Copies a scanline into a buffer.

The pixels are converted from the display mode format on the bitmapped graphics device to the format of the specified device display mode.

By specifying the start pixel and the number of pixels, either the whole or a portion of a bitmapped graphics device pixel row may be copied.

This pure virtual function is implemented in derived classes.

Parameters

TDes8& aBuf

An 8 bit modifiable descriptor buffer into which pixels are copied; it must be sufficiently large to store all the scanline pixels.

const TPoint& aStartPixel

The (x,y) co-ordinates of the first pixel of the bitmap scanline to be put into the buffer.

TInt aLength

The number of pixels to put into the buffer.

TDisplayMode aDispMode

The display mode into which to convert the pixels.

[Top]


Font handling


AddFile()

virtual TInt AddFile(const TDesC& aName,TInt& aId)=0;

Description

Adds a font file to the device’s font store.

This pure virtual function is implemented in derived classes.

Parameters

const TDesC& aName

The name of the font file.

TInt& aId

On return, contains an ID for the font file.

Return value

TInt

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


RemoveFile()

virtual void RemoveFile(TInt aId=0)=0;

Description

Removes a font file from the font store.

This pure virtual function is implemented in derived classes.

Parameters

TInt aId=0

The ID of the font file to be removed. The default is 0.


FontHeightInPixels()

virtual TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const=0;

Description

Gets the height, in pixels, of the specified typeface at one of its defined heights.

The typeface is identified by by an index. For a given typeface, there are a discrete number of heights; the specific height is also identified by an index.

The value returned is rounded up or down to the nearest font height in pixels.

This pure virtual function is implemented in derived classes.

Parameters

TInt aTypefaceIndex

A typeface index number, in the range: 0 to (NumTypefaces() - 1).

TInt aHeightIndex

A font height index number, in the range: 0 to (iNumHeights - 1) where iNumHeights is a public data member of the TTypefaceSupport object returned by TypefaceSupport().

Return value

TInt

The height of the font, in pixels.

See also:


GetNearestFontInPixels()

virtual TInt GetNearestFontInPixels(CFont*& aFont,const TFontSpec& aFontSpec)=0;

Description

Gets the nearest font to that specified for use by a bitmapped graphics device.

The font and bitmap server returns a pointer to the nearest matching font from those available.

This pure virtual function is implemented in derived classes.

Parameters

CFont*& aFont

On return, the pointer is set to point to the device font which most closely approximates to the required font specification.

const TFontSpec& aFontSpec

An absolute font specification.

Return value

TInt

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