Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <BITDEV.H>

Class CFbsDevice

class CFbsDevice : public CBitmapDevice;

Description

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.

Derivation

Members

Defined in CFbsDevice:

Inherited from CBase:

Inherited from CBitmapDevice:

Inherited from CGraphicsDevice:

Inherited from MGraphicsDeviceMap:

See also:


Construction and destruction


~CFbsDevice()

IMPORT_C ~CFbsDevice();

Description

Frees all resources owned by the object prior to its destruction.

[Top]


Member functions


CreateContext(CFbsBitGc *&)

IMPORT_C TInt CreateContext(CFbsBitGc *&aGc);

Description

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.

Parameters

CFbsBitGc *&aGc

On return, contains a pointer to the graphics context.

Return value

TInt

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


CreateContext(CGraphicsContext *&)

virtual inline TInt CreateContext(CGraphicsContext *&aGc);

Description

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.

Parameters

CGraphicsContext *&aGc

On return, contains a pointer to the graphics context.

Return value

TInt

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


DisplayMode()const

IMPORT_C virtual TDisplayMode DisplayMode() const;

Description

Gets the device's display mode.

Return value

TDisplayMode

The display mode of the device.


SizeInPixels()const

IMPORT_C virtual TSize SizeInPixels() const;

Description

Gets the size of the device, in pixels.

Return value

TSize

The width and height of the device, in pixels


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

IMPORT_C TBool RectCompare(const TRect &aSourceRect, const CFbsDevice &aDevice, const TRect &aDeviceRect) const;

Description

Compares two rectangles, including their contents.

This function is intended for use by test code only.

Parameters

const TRect &aSourceRect

The first rectangle to be compared (in this device).

const CFbsDevice &aDevice

The font and bitmap server device in which the second rectangle is found.

const TRect &aDeviceRect

The second rectangle to be compared.

Return value

TBool

ETrue if the rectangles are the same; EFalse otherwise.


AddFile(const TDesC &,TInt &)

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

Description

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.

Parameters

const TDesC16 &aName

The name of the font file.

TInt &aId

On return, the UID value of the font file.

Return value

TInt

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


RemoveFile(TInt)

IMPORT_C virtual void RemoveFile(TInt aId=0);

Description

Removes the specified font file from the device's typeface store. If the default value of zero is used, this deletes all font files.

Parameters

TInt aId

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


GetNearestFontInTwips(CFont *&,const TFontSpec &)

Interface status: deprecated

IMPORT_C virtual TInt GetNearestFontInTwips(CFont *&aFont, const TFontSpec &aFontSpec);

Description

Provides access to a client-side font object in the device's typeface store that most closely matches a font specification.

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

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

Parameters

CFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in twips.

Return value

TInt

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


GetNearestFontInPixels(CFont *&,const TFontSpec &)

Interface status: deprecated

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

Description

Creates a client-side 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() .

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.

Parameters

CFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in pixels.

Return value

TInt

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


GetNearestFontToDesignHeightInTwips(CFont *&,const TFontSpec &)

IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec);

Description

Creates a client-side 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 new function replaces the deprecated GetNearestFontInTwips() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every character within any given text string will fit within the given amount of twips, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Parameters

CFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in twips.

Return value

TInt

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


GetNearestFontToDesignHeightInPixels(CFont *&,const TFontSpec &)

IMPORT_C virtual TInt GetNearestFontToDesignHeightInPixels(CFont *&aFont, const TFontSpec &aFontSpec);

Description

Creates a client-side 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 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.

Parameters

CFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in pixels.

Return value

TInt

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


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

IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);

Description

Creates a client-side 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.

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.

TInt aMaxHeight

The maximum height in twips within which the font must fit - this overrides the height specified in aFontSpec. If maximum height is greater than 1024 pixels, the function returns KErrTooBig. And returns KErrArgument if equals to 1 pixel.

Return value

TInt

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


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

IMPORT_C virtual TInt GetNearestFontToMaxHeightInPixels(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);

Description

Creates a client-side 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.

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.

TInt aMaxHeight

The maximum height in pixels within which the font must fit - this overrides the height specified in aFontSpec. If maximum height is greater than 1024 pixels, the function returns KErrTooBig. And returns KErrArgument if equals to 1 pixel.

Return value

TInt

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


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

IMPORT_C TInt GetFontById(CFont *&aFont, TUid aFileId, const TAlgStyle &aStyle);

Description

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

When the font is no longer needed, call CFbsDevice::ReleaseFont(CFont *).

Parameters

CFont *&aFont

On return, set to point to the font.

TUid aFileId

The UID identifying the bitmap font.

const TAlgStyle &aStyle

Algorithmic style for the font.

Return value

TInt

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


GetNearestFontInTwips(CFbsFont *&,const TFontSpec &)

Interface status: deprecated

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

Description

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 CFbsDevice::ReleaseFont(CFont *).

This function is replaced by CFbsDevice::GetNearestFontToDesignHeightInTwips(CFont *&,const TFontSpec &).

Parameters

CFbsFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in twips.

Return value

TInt

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


GetNearestFontInPixels(CFbsFont *&,const TFontSpec &)

Interface status: deprecated

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

Description

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 CFbsDevice::ReleaseFont(CFont *).

This function is replaced by CFbsDevice::GetNearestFontToDesignHeightInPixels(CFont *&,const TFontSpec &).

Parameters

CFbsFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in pixels.

Return value

TInt

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


GetNearestFontToDesignHeightInTwips(CFbsFont *&,const TFontSpec &)

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

Description

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 CFbsDevice::ReleaseFont(CFont *).

This function replaces CFbsDevice::GetNearestFontInTwips(CFont *&,const TFontSpec &).

Parameters

CFbsFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in twips.

Return value

TInt

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


GetNearestFontToDesignHeightInPixels(CFbsFont *&,const TFontSpec &)

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

Description

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 CFbsDevice::ReleaseFont(CFont *).

This function replaces CFbsDevice::GetNearestFontInPixels(CFont *&,const TFontSpec &).

Parameters

CFbsFont *&aFont

On return, points to the font which most closely matches the specified font.

const TFontSpec &aFontSpec

An absolute font specification. Its iHeight member is interpreted as being in pixels.

Return value

TInt

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


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

inline TInt GetNearestFontToMaxHeightInTwips(CFbsFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);

Description

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 CFbsDevice::ReleaseFont(CFont *).

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.

Parameters

CFbsFont *&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.

TInt aMaxHeight

The maximum height in twips within which the font must fit - this overrides the height specified in aFontSpec.

Return value

TInt

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


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

inline TInt GetNearestFontToMaxHeightInPixels(CFbsFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);

Description

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 CFbsDevice::ReleaseFont(CFont *).

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.

Parameters

CFbsFont *&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.

TInt aMaxHeight

The maximum height in pixels within which the font must fit - this overrides the height specified in aFontSpec.

Return value

TInt

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


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

inline TInt GetFontById(CFbsFont *&aFont, TUid aFileId, const TAlgStyle &aStyle);

Description

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

When the font is no longer needed, call CFbsDevice::ReleaseFont(CFont *).

Parameters

CFbsFont *&aFont

On return, set to point to the font.

TUid aFileId

The UID identifying the bitmap font.

const TAlgStyle &aStyle

Algorithmic style for the font.

Return value

TInt

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


ReleaseFont(CFont *)

IMPORT_C virtual void ReleaseFont(CFont *aFont);

Description

Marks the specified font as no longer needed by the user of the device.

As fonts can be shared between applications, this function does not delete the copy of the font from RAM unless the font is only being used by this device.

Parameters

CFont *aFont

A pointer to the font to be released.


FontHeightInTwips(TInt,TInt)const

IMPORT_C virtual TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;

Description

Gets the height of a font in twips.

This is an implementation of CGraphicsDevice::FontHeightInTwips(TInt,TInt)const.

Parameters

TInt aTypefaceIndex

TInt aHeightIndex

Return value

TInt


FontHeightInPixels(TInt,TInt)const

IMPORT_C virtual TInt FontHeightInPixels(TInt aTypefaceIndex, TInt aHeightIndex) const;

Description

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

This is an implementation of CBitMapDevice::FontHeightInPixels().

Parameters

TInt aTypefaceIndex

TInt aHeightIndex

Return value

TInt


NumTypefaces()const

IMPORT_C virtual TInt NumTypefaces() const;

Description

Gets the number of typefaces supported by the device.

Return value

TInt

The number of typefaces supported.


TypefaceSupport(TTypefaceSupport &,TInt)const

IMPORT_C virtual void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;

Description

Gets information about an indexed typeface.

Parameters

TTypefaceSupport &aTypefaceSupport

Provides information about the typeface, including its name and attributes.

TInt aTypefaceIndex

The index of the requested typeface in the device's typeface store; between zero and CFbsDevice::NumTypefaces()const 1 inclusive.

See also:


SetCustomPalette(const CPalette *)

IMPORT_C TInt SetCustomPalette(const CPalette *aPalette);

Description

Sets the variable 8 bits per pixel colour palette, replacing the system default one. Only the entries in the system default palette which have corresponding entries in aPalette are overwritten, i.e. if aPalette contains fewer than 256 colours, some will remain unchanged. If aPalette has more than 256 entries, the additional entries are ignored.

Parameters

const CPalette *aPalette

The custom palette.

Return value

TInt

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


GraphicsAccelerator()const

inline CGraphicsAccelerator* GraphicsAccelerator() const;

Description

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.

Return value

CGraphicsAccelerator *

Pointer to the graphics accelerator or NULL if not supported.

See also:


Orientation()const

inline CFbsBitGc::TGraphicsOrientation Orientation() const;

Description

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

Return value

CFbsBitGc::TGraphicsOrientation

The device's orientation.


DisplayMode16M()

IMPORT_C static TDisplayMode DisplayMode16M();

Description

Depending on the current graphics hardware this will return one of the 16M video modes defined in TDisplayMode, or ENone if a 16M video mode is not supported.

Return value

TDisplayMode

a 16M display mode or ENone.

See also:


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

IMPORT_C TInt SetScalingFactor(const TPoint &aOrigin, TInt aFactorX, TInt aFactorY, TInt aDivisorX, TInt aDivisorY);

Description

Sets scaling factor by which the drawing device should scale the drawing images. If you want to un-scale the device, call CFbsDevice::SetScalingFactor(const TPoint &,TInt,TInt,TInt,TInt) with Origin (0,0), factorX = 1, factorY = 1, divisorX = 1, divisorY = 1.

Note: The existing graphics acceleration interface does not have support for scaling.

Note: All graphics contexts, already created by the scaled device, should be re-activated calling CFbsBitGc::Activate(CFbsDevice *).

Parameters

const TPoint &aOrigin

Specifies physical coordinates of the new scaling origin of the drawing device. The drawing device maps the logical point [0, 0] to the "aOrigin" physical point .

TInt aFactorX

Scaling factor for the X-axis of the screen device.

TInt aFactorY

Scaling factor for the y-axis of the screen device.

TInt aDivisorX

Not used. Should be set to 1.

TInt aDivisorY

Not used. Should be set to 1.

Return value

TInt

KErrNone If the method succeeds. KErrNotSupported The drawing device does not have scaling capabilities.


GetDrawRect(TRect &)const

IMPORT_C void GetDrawRect(TRect &aRect) const;

Description

Gets logical coordinates of the drawing rectangle. If the device is not scaled, logocal coordinates of the drawing rectangle are the same as its physical coordinates.

Parameters

TRect &aRect

Upon return aRect contains drawing rectangle logical coordinates.


DrawingBegin(TBool)

protected: inline virtual void DrawingBegin(TBool=EFalse);

Description

Parameters

TBool


DrawingEnd(TBool)

protected: inline virtual void DrawingEnd(TBool=EFalse);

Description

Parameters

TBool


SetBits()

protected: inline virtual void SetBits();

Description

Sets the bit level.


CancelSprite()const

protected: inline virtual void CancelSprite() const;

Description

Cancels drawing the sprite.


HideSprite()const

protected: inline virtual TSpriteBase* HideSprite() const;

Description

Hides the sprite over the whole screen.

Return value

TSpriteBase *

TSpriteBase* A pointer to the hidden sprite. NULL in default implementation.


HideSprite(const TRect &,const TRegion *)const

protected: inline virtual TSpriteBase* HideSprite(const TRect &, const TRegion *) const;

Description

Hides the sprite within a particular region.

Parameters

const TRect &

const TRegion *

Return value

TSpriteBase *

TSpriteBase* A pointer to the hidden sprite. NULL in default implementation.


ShowSprite(TSpriteBase *)const

protected: inline virtual void ShowSprite(TSpriteBase *) const;

Description

Shows the specified sprite over the whole screen.

Parameters

TSpriteBase *


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

protected: inline virtual void ShowSprite(TSpriteBase *, const TRect &, const TRegion *) const;

Description

Shows the specified sprite within a particular region.

Parameters

TSpriteBase *

const TRect &

const TRegion *

[Top]


Member data


iDrawDevice

protected: CFbsDrawDevice * iDrawDevice;

Description


iFbs

protected: RFbsSession * iFbs;

Description


iTypefaceStore

protected: CFbsTypefaceStore * iTypefaceStore;

Description


iSpare

protected: TInt iSpare;

Description


iScreenDevice

protected: TBool iScreenDevice;

Description


iBitBltMaskedBuffer

protected: TUint8 * iBitBltMaskedBuffer;

Description


iGraphicsAccelerator

protected: CGraphicsAccelerator * iGraphicsAccelerator;

Description


iOrientation

protected: CFbsBitGc::TGraphicsOrientation iOrientation;

Description