Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: BITDEV.H
Link against: bitgdi.lib

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:
AddFile(), CancelSprite(), CreateContext(), CreateContext(), DisplayMode(), DisplayMode16M(), DrawingBegin(), DrawingEnd(), FontHeightInPixels(), FontHeightInTwips(), GetDrawRect(), GetFontById(), GetFontById(), GetNearestFontInPixels(), GetNearestFontInPixels(), GetNearestFontInTwips(), GetNearestFontInTwips(), GetNearestFontToDesignHeightInPixels(), GetNearestFontToDesignHeightInPixels(), GetNearestFontToDesignHeightInTwips(), GetNearestFontToDesignHeightInTwips(), GetNearestFontToMaxHeightInPixels(), GetNearestFontToMaxHeightInPixels(), GetNearestFontToMaxHeightInTwips(), GetNearestFontToMaxHeightInTwips(), GraphicsAccelerator(), HideSprite(), HideSprite(), NumTypefaces(), Orientation(), RectCompare(), ReleaseFont(), RemoveFile(), SetBits(), SetCustomPalette(), SetScalingFactor(), ShowSprite(), ShowSprite(), SizeInPixels(), TypefaceSupport(), iBitBltMaskedBuffer, iDrawDevice, iFbs, iGraphicsAccelerator, iOrientation, iScreenDevice, iSpare, iTypefaceStore, ~CFbsDevice()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CBitmapDevice:
CreateBitmapContext(), GetPixel(), GetScanLine()

Inherited from CGraphicsDevice:
GetPalette(), PaletteAttributes(), SetPalette(), SizeInTwips()

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

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()

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()

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()

virtual IMPORT_C TDisplayMode DisplayMode() const;

Description

Gets the device's display mode.

Return value

TDisplayMode

The display mode of the device.


SizeInPixels()

virtual IMPORT_C 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()

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()

virtual IMPORT_C 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 TDesC &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()

virtual IMPORT_C 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()

virtual IMPORT_C TInt GetNearestFontInTwips(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 function is replaced by GetNearestFontToDesignHeightInTwips()

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()

virtual IMPORT_C 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().

This function is replaced by GetNearestFontToDesignHeightInPixels()

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()

virtual IMPORT_C 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 function replaces GetNearestFontInTwips()

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()

virtual IMPORT_C 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 function replaces GetNearestFontInPixels()

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()

virtual IMPORT_C 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.

Return value

TInt

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


GetNearestFontToMaxHeightInPixels()

virtual IMPORT_C 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.

Return value

TInt

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


GetFontById()

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 ReleaseFont().

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()

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 ReleaseFont().

This function is replaced by GetNearestFontToDesignHeightInTwips().

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()

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 ReleaseFont().

This function is replaced by GetNearestFontToDesignHeightInPixels().

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()

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 ReleaseFont().

This function replaces GetNearestFontInTwips().

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()

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 ReleaseFont().

This function replaces GetNearestFontInPixels().

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()

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 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

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()

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 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

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()

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 ReleaseFont().

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()

virtual IMPORT_C 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()

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

Description

Gets the height of a font in twips.

This is an implementation of CGraphicsDevice::FontHeightInTwips().

Parameters

TInt aTypefaceIndex

TInt aHeightIndex

Return value

TInt


FontHeightInPixels()

virtual IMPORT_C 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()

virtual IMPORT_C TInt NumTypefaces() const;

Description

Gets the number of typefaces supported by the device.

Return value

TInt

The number of typefaces supported.


TypefaceSupport()

virtual IMPORT_C 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 NumTypefaces() 1 inclusive.

See also:


SetCustomPalette()

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()

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()

inline CFbsBitGc::TGraphicsOrientation Orientation() const;

Description

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

Return value

CFbsBitGc::TGraphicsOrientation

The device's orientation.


DisplayMode16M()

static IMPORT_C 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()

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 SetScalingFactor() 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().

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()

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()

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

Description

Parameters

TBool


DrawingEnd()

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

Description

Parameters

TBool


SetBits()

protected: inline virtual void SetBits();

Description

Sets the bit level.


CancelSprite()

protected: inline virtual void CancelSprite() const;

Description

Cancels drawing the sprite.


HideSprite()

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()

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()

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

Description

Shows the specified sprite over the whole screen.

Parameters

TSpriteBase *


ShowSprite()

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