Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: gdi.h

Class CGraphicsDevice

CGraphicsDevice

Support

Supported from 5.0

Description

Specifies the interface for concrete device classes.

It holds information on the capabilities and attributes of a graphics device. The CBitmapDevice and CPrinterDevice classes are derived from CGraphicsDevice.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CGraphicsDeviceSpecifies the interface for concrete device classes
MGraphicsDeviceMapInterface class for mapping between twips and device-specific units (pixels)

Defined in CGraphicsDevice:
CreateContext(), DisplayMode(), FontHeightInTwips(), GetPalette(), NumTypefaces(), PaletteAttributes(), SetPalette(), SizeInPixels(), SizeInTwips(), TypefaceSupport()

Inherited from CBase:
operator new()

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

See also:


Device information


DisplayMode()

virtual TDisplayMode DisplayMode() const = 0;

Description

Gets the display mode of the device.

Return value

TDisplayMode

The display mode of the device.


SizeInPixels()

virtual TSize SizeInPixels() const = 0;

Description

Gets the size of the device area in pixels.

Return value

TSize

The width and height of the device area, in pixels


SizeInTwips()

virtual TSize SizeInTwips() const = 0;

Description

Gets the size of the device area in twips.

Return value

TSize

The width and height of the device area, in twips

[Top]


Graphics context creation


CreateContext()

virtual TInt CreateContext(CGraphicsContext*& aGC) = 0;

Description

Creates a graphics context for the device.

Parameters

CGraphicsContext*& aGC

On return, contains a pointer to the created graphics context.

Return value

TInt

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

[Top]


Typeface and font information


NumTypefaces()

virtual TInt NumTypefaces() const = 0;

Description

Gets the number of typefaces supported by the graphics device.

Return value

TInt

The number of typefaces supported.


TypefaceSupport()

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

Description

Gets typeface information for a specified typeface.

This information is returned in aTypefaceSupport, and includes:

Parameters

TTypefaceSupport& aTypefaceSupport

On return, contains the typeface information.

TInt aTypefaceIndex

A typeface index number, in the range: zero to (NumTypefaces() - 1).

See also:


FontHeightInTwips()

virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const = 0;

Description

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.

Parameters

TInt aTypefaceIndex

An index identifying the typeface, in the range: 0 to (NumTypefaces() - 1).

TInt aHeightIndex

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

Return value

TInt

The height of the font, in twips.

[Top]


Palette information


PaletteAttributes()

virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const = 0;

Description

Gets the palette attributes of the device.

Parameters

TBool& aModifiable

On return, holds information on whether or not the device’s palette is modifiable (true) or fixed (false).

TInt& aNumEntries

On return, holds the number of entries in the device’s palette.


SetPalette()

virtual void SetPalette(CPalette* aPalette) = 0;

Description

Sets the device’s palette.

Parameters

CPalette* aPalette

The new palette for the device.


GetPalette()

virtual TInt GetPalette(CPalette*& aPalette) const = 0;

Description

Gets the device’s current palette.

Parameters

CPalette*& aPalette

On return, holds the device’s current palette.

Return value

TInt

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