CBitmapDevice Class Reference

class CBitmapDevice : public CGraphicsDevice

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

The class specialises the graphics device interface CGraphicsDevice for bitmaps graphics. The Window Server Client-Side API provides one implementation of the interface, CWsScreenDevice, for screen drawing. Another implementation, CFbsBitmapDevice, is used for drawing to in-memory bitmaps. A third, CFbsScreenDevice, is used (rarely) to access the screen directly, without the mediation of the window server.

Inherits from

Member Functions Documentation

AddFile(const TDesC &, TInt &)

TInt AddFile(const TDesC &aName,
TInt &aId
)[pure virtual]

Adds a font file to the device's typeface store. The specified font file must be accessible to any process, i.e. not located inside an application's private directory.

This pure virtual function is implemented in derived classes.

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

Parameters

const TDesC & aNameThe name of the font file.
TInt & aIdOn return, contains an ID for the font file.

CreateBitmapContext(CBitmapContext *&)

TInt CreateBitmapContext(CBitmapContext *&aGC)[inline]

Creates a bitmap context for this bitmap device.

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

Parameters

CBitmapContext *& aGCOn return, holds a pointer to the created bitmap context.

FontHeightInPixels(TInt, TInt)

TInt FontHeightInPixels(TIntaTypefaceIndex,
TIntaHeightIndex
)const [pure virtual]

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.

The height of the font, in pixels.

TTypefaceSupport

CGraphicsDevice::NumTypefaces()

CGraphicsDevice::TypefaceSupport()

Parameters

TInt aTypefaceIndexA typeface index number, in the range: 0 to (NumTypefaces() - 1).
TInt aHeightIndexA 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().

GetNearestFontInPixels(CFont *&, const TFontSpec &)

TInt GetNearestFontInPixels(CFont *&aFont,
const TFontSpec &aFontSpec
)[pure virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

Note that this deprecated function is replaced by the new GetNearestFontToDesignHeightInPixels() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every character within any given text string will fit within the given amount of pixels, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

KErrNone if successful; a system-wide error code otherwise.

Use GetNearestFontToDesignHeightInPixels

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

GetNearestFontToDesignHeightInPixels(CFont *&, const TFontSpec &)

TInt GetNearestFontToDesignHeightInPixels(CFont *&,
const TFontSpec &
)[inline, virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

This new function replaces the deprecated GetNearestFontInPixels() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every character within any given text string will fit within the given amount of pixels, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

KErrNone if successful; a system-wide error code otherwise.

Parameters

CFont *&
const TFontSpec &

GetNearestFontToMaxHeightInPixels(CFont *&, const TFontSpec &, TInt)

TInt GetNearestFontToMaxHeightInPixels(CFont *&,
const TFontSpec &,
TInt
)[inline, virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

The font and bitmap server returns a pointer to the nearest matching font from those available. Matches to max height of font - this does its best to return a font that will fit within the maximum height specified (but note that variations due to hinting algorithms may rarely result in this height being exceeded by up to one pixel). Problems can also be encountered with bitmap fonts where the typeface exists but doesn't have a font small enough.

KErrNone if successful; a system-wide error code otherwise.

Parameters

CFont *&
const TFontSpec &
TInt

GetPixel(TRgb &, const TPoint &)

voidGetPixel(TRgb &aColor,
const TPoint &aPixel
)const [pure virtual]

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

This pure virtual function is implemented in derived classes.

Parameters

TRgb & aColorOn return, should contain the RGB colour of the pixel.
const TPoint & aPixelThe (x,y) co-ordinates of the pixel. The top left pixel is (0,0).

GetScanLine(TDes8 &, const TPoint &, TInt, TDisplayMode)

voidGetScanLine(TDes8 &aBuf,
const TPoint &aStartPixel,
TIntaLength,
TDisplayModeaDispMode
)const [pure virtual]

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 & aBufAn 8 bit modifiable descriptor buffer into which pixels are copied; it must be sufficiently large to store all the scanline pixels.
const TPoint & aStartPixelThe (x,y) co-ordinates of the first pixel of the bitmap scanline to be put into the buffer.
TInt aLengthThe number of pixels to put into the buffer.
TDisplayMode aDispModeThe display mode into which to convert the pixels.

RemoveFile(TInt)

voidRemoveFile(TIntaId = 0)[pure virtual]

Removes a font file from the font store.

This pure virtual function is implemented in derived classes.

Parameters

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