CFbsDevice Class Reference

class CFbsDevice : public CBitmapDevice

Abstract base class for graphics devices to which bitmaps and fonts can be drawn.

The class implements the pure virtual CBitmapDevice functions and additionally provides:

support for creating and enquiring about fonts

comparing two device rectangles

creating a graphics context for the device.

CFbsBitmapDevice and CFbsScreenDevice are derived fom this class.

CFbsBitmapDevice

CFbsScreenDevice

Inherits from

Public Member Functions
~CFbsDevice()
IMPORT_C TIntAddFile(const TDesC &, TInt &)
IMPORT_C TIntCreateContext(CFbsBitGc *&)
TInt CreateContext(CGraphicsContext *&)
IMPORT_C TDisplayModeDisplayMode()
IMPORT_C TDisplayModeDisplayMode16M()
IMPORT_C TIntFontHeightInPixels(TInt, TInt)
IMPORT_C TIntFontHeightInTwips(TInt, TInt)
IMPORT_C voidGetDrawRect(TRect &)
IMPORT_C TIntGetFontById(CFont *&, TUid, const TAlgStyle &)
TInt GetFontById(CFbsFont *&, TUid, const TAlgStyle &)
IMPORT_C TIntGetNearestFontInPixels(CFont *&, const TFontSpec &)
TInt GetNearestFontInPixels(CFbsFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontInTwips(CFont *&, const TFontSpec &)
TInt GetNearestFontInTwips(CFbsFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToDesignHeightInPixels(CFont *&, const TFontSpec &)
TInt GetNearestFontToDesignHeightInPixels(CFbsFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToDesignHeightInTwips(CFont *&, const TFontSpec &)
TInt GetNearestFontToDesignHeightInTwips(CFbsFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToMaxHeightInPixels(CFont *&, const TFontSpec &, TInt)
TInt GetNearestFontToMaxHeightInPixels(CFbsFont *&, const TFontSpec &, TInt)
IMPORT_C TIntGetNearestFontToMaxHeightInTwips(CFont *&, const TFontSpec &, TInt)
TInt GetNearestFontToMaxHeightInTwips(CFbsFont *&, const TFontSpec &, TInt)
CGraphicsAccelerator *GraphicsAccelerator()
IMPORT_C TIntNumTypefaces()
CFbsBitGc::TGraphicsOrientation Orientation()
IMPORT_C TBoolRectCompare(const TRect &, const CFbsDevice &, const TRect &)
IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &, TInt &)
IMPORT_C voidReleaseFont(CFont *)
IMPORT_C voidRemoveFile(TInt)
IMPORT_C TIntSetCustomPalette(const CPalette *)
IMPORT_C TIntSetDrawDeviceOffset(const TPoint &)
IMPORT_C TIntSetScalingFactor(const TPoint &, TInt, TInt, TInt, TInt)
IMPORT_C TSizeSizeInPixels()
IMPORT_C voidTypefaceSupport(TTypefaceSupport &, TInt)
Protected Member Functions
CFbsDevice()
voidCancelSprite()
voidDoGetScanLine(TDes8 &, const TPoint &, TInt, TDisplayMode)
voidDrawingBegin(TBool)
voidDrawingBegin(const CFbsBitmap *, TBool)
voidDrawingEnd(TBool)
voidDrawingEnd(const CFbsBitmap *, TBool)
TInt GetNearestFbsFont(CFbsFont *&, const TFontSpec &)
TSpriteBase *HideSprite()
TSpriteBase *HideSprite(const TRect &, const TRegion *)
voidReadLineDiffMode(TInt, TInt, TInt, TAny *, TDisplayMode)
voidSetBits()
TBool SetOrientation(CFbsBitGc::TGraphicsOrientation)
voidShowSprite(TSpriteBase *)
voidShowSprite(TSpriteBase *, const TRect &, const TRegion *)
voidTruncateRect(TRect &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CBitmapDevice::CreateBitmapContext(CBitmapContext *&)
CBitmapDevice::GetPixel(TRgb &,const TPoint &)const
CBitmapDevice::GetScanLine(TDes8 &,const TPoint &,TInt,TDisplayMode)const
CGraphicsDevice::GetPalette(CPalette *&)const
CGraphicsDevice::PaletteAttributes(TBool &,TInt &)const
CGraphicsDevice::SetPalette(CPalette *)
CGraphicsDevice::SizeInTwips()const
Protected Attributes
TUint8 *iBitBltMaskedBuffer
CFbsDrawDevice *iDrawDevice
RFbsSession *iFbs
CGraphicsAccelerator *iGraphicsAccelerator
CFbsBitGc::TGraphicsOrientation iOrientation
TBool iScreenDevice
TInt iSpare
CFbsTypefaceStore *iTypefaceStore

Constructor & Destructor Documentation

CFbsDevice()

CFbsDevice()[protected]

~CFbsDevice()

IMPORT_C~CFbsDevice()

Member Functions Documentation

AddFile(const TDesC &, TInt &)

IMPORT_C TIntAddFile(const TDesC &aName,
TInt &aId
)[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.

CancelSprite()

voidCancelSprite()const [protected, inline, virtual]

This method has been deprecated. Sprites are no longer supported in BitGDI. Calling this method has no effect.

CreateContext(CFbsBitGc *&)

IMPORT_C TIntCreateContext(CFbsBitGc *&aGc)

Parameters

CFbsBitGc *& aGc

CreateContext(CGraphicsContext *&)

TInt CreateContext(CGraphicsContext *&aGc)[inline, virtual]

Creates a font and bitmap server graphics context for the device and activates it.

It is the responsibility of the caller to delete the graphics context when it is no longer needed.

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

Parameters

CGraphicsContext *& aGcOn return, contains a pointer to the graphics context.

DisplayMode()

IMPORT_C TDisplayModeDisplayMode()const [virtual]

Gets the display mode of the device.

The display mode of the device.

DisplayMode16M()

IMPORT_C TDisplayModeDisplayMode16M()[static]

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

voidDoGetScanLine(TDes8 &aBuf,
const TPoint &aPixel,
TIntaLength,
TDisplayModeaDispMode
)[protected]

Parameters

TDes8 & aBuf
const TPoint & aPixel
TInt aLength
TDisplayMode aDispMode

DrawingBegin(TBool)

voidDrawingBegin(TBool = EFalse)[protected, inline, virtual]

Parameters

TBool  = EFalse

DrawingBegin(const CFbsBitmap *, TBool)

voidDrawingBegin(const CFbsBitmap *aBitmap,
TBoolaAlways = EFalse
)[protected]

Parameters

const CFbsBitmap * aBitmap
TBool aAlways = EFalse

DrawingEnd(TBool)

voidDrawingEnd(TBool = EFalse)[protected, inline, virtual]

Parameters

TBool  = EFalse

DrawingEnd(const CFbsBitmap *, TBool)

voidDrawingEnd(const CFbsBitmap *aBitmap,
TBoolaAlways = EFalse
)[protected]

Parameters

const CFbsBitmap * aBitmap
TBool aAlways = EFalse

FontHeightInPixels(TInt, TInt)

IMPORT_C TIntFontHeightInPixels(TIntaTypefaceIndex,
TIntaHeightIndex
)const [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().

FontHeightInTwips(TInt, TInt)

IMPORT_C TIntFontHeightInTwips(TIntaTypefaceIndex,
TIntaHeightIndex
)const [virtual]

Get the height of a font in twips.

The font is identified by typeface and height.

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

The height of the font, in twips.

Parameters

TInt aTypefaceIndexAn index identifying the typeface, in the range: 0 to (NumTypefaces() - 1).
TInt aHeightIndexAn index identifying the font height, in the range: 0 to (iNumHeights - 1). Note that iNumHeights is in the TTypefaceSupport object returned by TypefaceSupport().

GetDrawRect(TRect &)

IMPORT_C voidGetDrawRect(TRect &aRect)const

Parameters

TRect & aRect

GetFontById(CFont *&, TUid, const TAlgStyle &)

IMPORT_C TIntGetFontById(CFont *&aFont,
TUidaFileId,
const TAlgStyle &aStyle
)

Parameters

CFont *& aFont
TUid aFileId
const TAlgStyle & aStyle

GetFontById(CFbsFont *&, TUid, const TAlgStyle &)

TInt GetFontById(CFbsFont *&aFont,
TUidaFileId,
const TAlgStyle &aStyle
)[inline]

Gets a specific bitmap font, identified by its UID, from the device's typeface store.

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

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

Parameters

CFbsFont *& aFontOn return, set to point to the font.
TUid aFileIdThe UID identifying the bitmap font.
const TAlgStyle & aStyleAlgorithmic style for the font.

GetNearestFbsFont(CFbsFont *&, const TFontSpec &)

TInt GetNearestFbsFont(CFbsFont *&aFont,
const TFontSpec &aFontSpec
)[protected]

Parameters

CFbsFont *& aFont
const TFontSpec & aFontSpec

GetNearestFontInPixels(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontInPixels(CFont *&aFont,
const TFontSpec &aFontSpec
)[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.

GetNearestFontInPixels(CFbsFont *&, const TFontSpec &)

TInt GetNearestFontInPixels(CFbsFont *&aFont,
const TFontSpec &aFontSpec
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a font specification.

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

This function is replaced by GetNearestFontToDesignHeightInPixels().

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

Parameters

CFbsFont *& aFontOn return, points to the font which most closely matches the specified font.
const TFontSpec & aFontSpecAn absolute font specification. Its iHeight member is interpreted as being in pixels.

GetNearestFontInTwips(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontInTwips(CFont *&aFont,
const TFontSpec &aFontSpec
)[virtual]

Parameters

CFont *& aFont
const TFontSpec & aFontSpec

GetNearestFontInTwips(CFbsFont *&, const TFontSpec &)

TInt GetNearestFontInTwips(CFbsFont *&aFont,
const TFontSpec &aFontSpec
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a font specification.

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

This function is replaced by GetNearestFontToDesignHeightInTwips().

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

Parameters

CFbsFont *& aFontOn return, points to the font which most closely matches the specified font.
const TFontSpec & aFontSpecAn absolute font specification. Its iHeight member is interpreted as being in twips.

GetNearestFontToDesignHeightInPixels(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontToDesignHeightInPixels(CFont *&,
const TFontSpec &
)[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 &

GetNearestFontToDesignHeightInPixels(CFbsFont *&, const TFontSpec &)

TInt GetNearestFontToDesignHeightInPixels(CFbsFont *&aFont,
const TFontSpec &aFontSpec
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a font specification.

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

This function replaces GetNearestFontInPixels().

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

Parameters

CFbsFont *& aFontOn return, points to the font which most closely matches the specified font.
const TFontSpec & aFontSpecAn absolute font specification. Its iHeight member is interpreted as being in pixels.

GetNearestFontToDesignHeightInTwips(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontToDesignHeightInTwips(CFont *&aFont,
const TFontSpec &aFontSpec
)[virtual]

Parameters

CFont *& aFont
const TFontSpec & aFontSpec

GetNearestFontToDesignHeightInTwips(CFbsFont *&, const TFontSpec &)

TInt GetNearestFontToDesignHeightInTwips(CFbsFont *&aFont,
const TFontSpec &aFontSpec
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a font specification.

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

This function replaces GetNearestFontInTwips().

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

Parameters

CFbsFont *& aFontOn return, points to the font which most closely matches the specified font.
const TFontSpec & aFontSpecAn absolute font specification. Its iHeight member is interpreted as being in twips.

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

IMPORT_C TIntGetNearestFontToMaxHeightInPixels(CFont *&,
const TFontSpec &,
TInt
)[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

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

TInt GetNearestFontToMaxHeightInPixels(CFbsFont *&aFont,
const TFontSpec &aFontSpec,
TIntaMaxHeight
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a 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; otherwise, another of the system-wide error codes.

Parameters

CFbsFont *& aFontOn return, the pointer is set to point to the device font which most closely approximates to the required font specification.
const TFontSpec & aFontSpecAn absolute font specification.
TInt aMaxHeightThe maximum height in pixels within which the font must fit - this overrides the height specified in aFontSpec.

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

IMPORT_C TIntGetNearestFontToMaxHeightInTwips(CFont *&aFont,
const TFontSpec &aFontSpec,
TIntaMaxHeight
)[virtual]

Parameters

CFont *& aFont
const TFontSpec & aFontSpec
TInt aMaxHeight

GetNearestFontToMaxHeightInTwips(CFbsFont *&, const TFontSpec &, TInt)

TInt GetNearestFontToMaxHeightInTwips(CFbsFont *&aFont,
const TFontSpec &aFontSpec,
TIntaMaxHeight
)[inline]

Creates a client-side FBSERV font from those available in the device's typeface store that most closely matches a 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; otherwise, another of the system-wide error codes.

Parameters

CFbsFont *& aFontOn return, the pointer is set to point to the device font which most closely approximates to the required font specification.
const TFontSpec & aFontSpecAn absolute font specification.
TInt aMaxHeightThe maximum height in twips within which the font must fit - this overrides the height specified in aFontSpec.

GraphicsAccelerator()

CGraphicsAccelerator *GraphicsAccelerator()const [inline]

Gets a pointer to the 2D graphics accelerator owned by the device. If one is available, it is used to accelerate various CFbsBitGc graphics operations.

Pointer to the graphics accelerator or NULL if not supported.

CFbsBitmapDevice::NewL()

HideSprite()

TSpriteBase *HideSprite()const [protected, inline, virtual]

This method has been deprecated. Sprites are no longer supported in BitGDI. Calling this method has no effect. TSpriteBase* NULL.

HideSprite(const TRect &, const TRegion *)

TSpriteBase *HideSprite(const TRect &,
const TRegion *
)const [protected, inline, virtual]

This method has been deprecated. Sprites are no longer supported in BitGDI. Calling this method has no effect. TSpriteBase* NULL.

Parameters

const TRect &
const TRegion *

NumTypefaces()

IMPORT_C TIntNumTypefaces()const [virtual]

Gets the number of typefaces supported by the graphics device.

The number of typefaces supported.

Orientation()

CFbsBitGc::TGraphicsOrientation Orientation()const [inline]

Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation().

The device's orientation.

ReadLineDiffMode(TInt, TInt, TInt, TAny *, TDisplayMode)

voidReadLineDiffMode(TInt,
TInt,
TInt,
TAny *,
TDisplayMode
)const [protected]

RectCompare(const TRect &, const CFbsDevice &, const TRect &)

IMPORT_C TBoolRectCompare(const TRect &aSourceRect,
const CFbsDevice &aDevice,
const TRect &aDeviceRect
)const

Parameters

const TRect & aSourceRect
const CFbsDevice & aDevice
const TRect & aDeviceRect

RegisterLinkedTypeface(const CLinkedTypefaceSpecification &, TInt &)

IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &aLinkedTypefaceSpec,
TInt &aId
)

Parameters

const CLinkedTypefaceSpecification & aLinkedTypefaceSpec
TInt & aId

ReleaseFont(CFont *)

IMPORT_C voidReleaseFont(CFont *aFont)

Parameters

CFont * aFont

RemoveFile(TInt)

IMPORT_C voidRemoveFile(TIntaId = 0)[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.

SetBits()

voidSetBits()[protected, inline, virtual]

Sets the bit level.

SetCustomPalette(const CPalette *)

IMPORT_C TIntSetCustomPalette(const CPalette *aPalette)

Parameters

const CPalette * aPalette

SetDrawDeviceOffset(const TPoint &)

IMPORT_C TIntSetDrawDeviceOffset(const TPoint &aOrigin)

Parameters

const TPoint & aOrigin

SetOrientation(CFbsBitGc::TGraphicsOrientation)

TBool SetOrientation(CFbsBitGc::TGraphicsOrientationaOrientation)[protected]

Parameters

CFbsBitGc::TGraphicsOrientation aOrientation

SetScalingFactor(const TPoint &, TInt, TInt, TInt, TInt)

IMPORT_C TIntSetScalingFactor(const TPoint &aOrigin,
TIntaFactorX,
TIntaFactorY,
TIntaDivisorX,
TIntaDivisorY
)

Parameters

const TPoint & aOrigin
TInt aFactorX
TInt aFactorY
TInt aDivisorX
TInt aDivisorY

ShowSprite(TSpriteBase *)

voidShowSprite(TSpriteBase *)const [protected, inline, virtual]

This method has been deprecated. Sprites are no longer supported in BitGDI. Calling this method has no effect.

Parameters

TSpriteBase *

ShowSprite(TSpriteBase *, const TRect &, const TRegion *)

voidShowSprite(TSpriteBase *,
const TRect &,
const TRegion *
)const [protected, inline, virtual]

This method has been deprecated. Sprites are no longer supported in BitGDI. Calling this method has no effect.

Parameters

TSpriteBase *
const TRect &
const TRegion *

SizeInPixels()

IMPORT_C TSizeSizeInPixels()const [virtual]

Gets the size of the device area in pixels.

The width and height of the device area, in pixels

TruncateRect(TRect &)

voidTruncateRect(TRect &aRect)[protected]

Parameters

TRect & aRect

TypefaceSupport(TTypefaceSupport &, TInt)

IMPORT_C voidTypefaceSupport(TTypefaceSupport &aTypefaceSupport,
TIntaTypefaceIndex
)const [virtual]

Gets typeface information for a specified typeface.

This information is returned in aTypefaceSupport, and includes:

the typeface name and typeface attributes

the number of font heights

the maximum and minimum font heights

whether it is a scalable typeface

NumTypefaces()

Parameters

TTypefaceSupport & aTypefaceSupportOn return, contains the typeface information.
TInt aTypefaceIndexA typeface index number, in the range: zero to (NumTypefaces() - 1).

Member Data Documentation

TUint8 * iBitBltMaskedBuffer

TUint8 *iBitBltMaskedBuffer[protected]

CFbsDrawDevice * iDrawDevice

CFbsDrawDevice *iDrawDevice[protected]

RFbsSession * iFbs

RFbsSession *iFbs[protected]

CGraphicsAccelerator * iGraphicsAccelerator

CGraphicsAccelerator *iGraphicsAccelerator[protected]

CFbsBitGc::TGraphicsOrientation iOrientation

CFbsBitGc::TGraphicsOrientation iOrientation[protected]

TBool iScreenDevice

TBool iScreenDevice[protected]

TInt iSpare

TInt iSpare[protected]

CFbsTypefaceStore * iTypefaceStore

CFbsTypefaceStore *iTypefaceStore[protected]