Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: gdi.h
Link against: gdi.lib

Class MGraphicsDeviceMap

MGraphicsDeviceMap

Support

Supported from 5.0

Description

Interface class for mapping between twips and device-specific units (pixels).

CGraphicsContext and TZoomFactor are derived from MGraphicsDeviceMap.

Defined in MGraphicsDeviceMap:
GetNearestFontInTwips(), HorizontalPixelsToTwips(), HorizontalTwipsToPixels(), MGraphicsDeviceMap(), PixelsToTwips(), ReleaseFont(), TwipsToPixels(), VerticalPixelsToTwips(), VerticalTwipsToPixels(), ~MGraphicsDeviceMap()

See also:


Construction and destruction


MGraphicsDeviceMap()

MGraphicsDeviceMap();

Description

Default constructor.


~MGraphicsDeviceMap()

virtual ~MGraphicsDeviceMap();

Description

Destructor.

[Top]


Device twip/pixel conversions


HorizontalTwipsToPixels()

virtual TInt HorizontalTwipsToPixels(TInt aTwips) const = 0;

Description

Converts a horizontal dimension from twips to pixels.

An implementation is supplied by a derived class.

Parameters

TInt aTwips

A horizontal dimension of a device in twips.

Return value

TInt

A horizontal dimension of a device in pixels.


VerticalTwipsToPixels()

virtual TInt VerticalTwipsToPixels(TInt aTwips) const = 0;

Description

Converts a vertical dimension from twips to pixels.

An implementation is supplied by a derived class.

Parameters

TInt aTwips

A vertical dimension of a device in twips.

Return value

TInt

A vertical dimension of a device in pixels.


HorizontalPixelsToTwips()

virtual TInt HorizontalPixelsToTwips(TInt aPixels) const = 0;

Description

Converts a horizontal dimension from pixels to twips.

An implementation is supplied by a derived class.

Parameters

TInt aPixels

A horizontal dimension of a device in pixels.

Return value

TInt

A horizontal dimension of a device in twips.


VerticalPixelsToTwips()

virtual TInt VerticalPixelsToTwips(TInt aPixels) const = 0;

Description

Converts a vertical dimension from pixels to twips.

An implementation is supplied by a derived class.

Parameters

TInt aPixels

A vertical dimension of a device in pixels.

Return value

TInt

A vertical dimension of a device in twips.

[Top]


Converting points and rectangles


TwipsToPixels()

TPoint TwipsToPixels(const TPoint& aTwipPoint) const;

Description

Converts a point in twips to a point in pixels.

Parameters

const TPoint& aTwipPoint

A point on the graphics device in twips.

Return value

TPoint

A point on the graphics device in pixels.


TwipsToPixels()

TRect TwipsToPixels(const TRect& aTwipRect) const;

Description

Converts a rectangle in twips to a rectangle in pixels.

Parameters

const TRect& aTwipRect

A rectangle on the graphics device in twips

Return value

TRect

A rectangle on the graphics device in pixels.


PixelsToTwips()

TPoint PixelsToTwips(const TPoint& aPixelPoint) const;

Description

Converts a point in pixels to a point in twips.

Parameters

const TPoint& aPixelPoint

A point on the graphics device in pixels.

Return value

TPoint

A point on the graphics device in twips.


PixelsToTwips()

TRect PixelsToTwips(const TRect& aPixelRect) const;

Description

Converts a rectangle in pixels to a rectangle in twips.

Parameters

const TRect& aPixelRect

A rectangle on the graphics device in pixels.

Return value

TRect

A rectangle on the graphics device in twips.

[Top]


Getting and releasing device fonts


GetNearestFontInTwips()

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

Description

Gets the nearest font to that in the given font specification.

The font and bitmap server returns a pointer to the nearest matching font from those available.

An implementation is supplied by a derived class.

Parameters

CFont*& aFont

On return, this pointer is set to point to the device font which most closely approximates to the font specification.

const TFontSpec& aFontSpec

An absolute font specification.

Return value

TInt

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


ReleaseFont()

virtual void ReleaseFont(CFont* aFont) = 0;

Description

Releases the specified font.

It is used to indicate that the specified font is no longer needed for use by the device map. As fonts can be shared between applications, this function does not delete the copy of the font from RAM unless the font was only being used by this particular device map.

An implementation is supplied by a derived class.

Parameters

CFont* aFont

A pointer to the font to be released.