Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: bitdev.h
Link against: bitgdi.lib

Class CFbsDevice

CFbsDevice

Support

Supported from 5.0

Description

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

Implements the pure virtual CBitmapDevice functions and additionally provides:

CFbsBitmapDevice and CFbsScreenDevice are derived fom this class.

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
CFbsDeviceAbstract base class for graphics devices to which bitmaps and fonts can be drawn
CGraphicsDeviceSpecifies the interface for concrete device classes
MGraphicsDeviceMapInterface class for mapping between twips and device-specific units (pixels)

Defined in CFbsDevice:
AddFile(), CreateContext(), DisplayMode(), FontHeightInPixels(), FontHeightInTwips(), GetFontById(), GetNearestFontInPixels(), GetNearestFontInTwips(), NumTypefaces(), RectCompare(), ReleaseFont(), RemoveFile(), SetCustomPalette(), SizeInPixels(), TypefaceSupport(), ~CFbsDevice()

Inherited from CBase:
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()

~CFbsDevice();

Description

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

[Top]


Graphics context creation


CreateContext()

TInt CreateContext(CFbsBitGc*& aGc);

Description

Creates a font and bitmap server (FBSERV) 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.

[Top]


Comparing rectangles


RectCompare()

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

Description

Compares two rectangles, including their contents.

Parameters

const TRect& aSourceRect

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

const CFbsDevice& aDevice

The FBSERV device in which the second rectangle is found.

const TRect& aDeviceRect

The second rectangle to be compared.

Return value

TBool

True if the rectangles are the same; false otherwise.

Notes:

[Top]


Getting and releasing fonts


GetNearestFontInTwips()

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

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.

Notes:


GetNearestFontInPixels()

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

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.

Notes:


GetFontById()

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

Description

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

Parameters

CFbsFont*& aFont

On return, set to point to the font.

TUid aFileId

The UID identifying the font.

const TAlgStyle& aStyle

Algorithmic style for the font.

Return value

TInt

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

Notes:


ReleaseFont()

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.

[Top]


Font files


AddFile()

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

Description

Adds a font file to the device's typeface store.

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

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.

[Top]


Device information


DisplayMode()

TDisplayMode DisplayMode() const;

Description

Gets the device's display mode.

Return value

TDisplayMode

The display mode of the device.


SizeInPixels()

TSize SizeInPixels() const;

Description

Gets the size of the device, in pixels.

Return value

TSize

The width and height of the device, in pixels

[Top]


Typeface and font information


NumTypefaces()

TInt NumTypefaces() const;

Description

Gets the number of typefaces supported by the device.

Return value

TInt

The number of typefaces supported.


TypefaceSupport()

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:


FontHeightInPixels()

TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;

Description

Gets the height in pixels of the indexed typeface at the indexed height.

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

See also:


FontHeightInTwips()

TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;

Description

Gets the height in twips of the indexed typeface at the indexed height.

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

See also:

[Top]


Setting the custom palette


SetCustomPalette()

TInt SetCustomPalette(const CPalette* aPalette);

Support

Supported from 6.1

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.