First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Class for mapping between twips and device-specific units (pixels).
19 #ifndef __DEVICEMAP_H__
20 #define __DEVICEMAP_H__
25 class MWsScreenDevice;
27 class CGraphicsDeviceMap : public CBase
30 static CGraphicsDeviceMap* NewL(const MWsScreenDevice& aScreenDevice);
32 TPoint TwipsToPixels(const TPoint& aTwipPoint) const;
33 TRect TwipsToPixels(const TRect& aTwipRect) const;
34 TPoint PixelsToTwips(const TPoint& aPixelPoint) const;
35 TRect PixelsToTwips(const TRect& aPixelRect) const;
36 /** Converts a horizontal dimension from twips to pixels.
38 @param aTwips A horizontal dimension of a device in twips.
39 @return A horizontal dimension of a device in pixels. */
40 TInt HorizontalTwipsToPixels(TInt aTwips) const;
42 /** Converts a vertical dimension from twips to pixels.
44 @param aTwips A vertical dimension of a device in twips.
45 @return A vertical dimension of a device in pixels. */
46 TInt VerticalTwipsToPixels(TInt aTwips) const;
48 /** Converts a horizontal dimension from pixels to twips.
50 @param aPixels A horizontal dimension of a device in pixels.
51 @return A horizontal dimension of a device in twips. */
52 TInt HorizontalPixelsToTwips(TInt aPixels) const;
54 /** Converts a vertical dimension from pixels to twips.
56 @param aPixels A vertical dimension of a device in pixels.
57 @return A vertical dimension of a device in twips. */
58 TInt VerticalPixelsToTwips(TInt aPixels) const;
60 CGraphicsDeviceMap(const MWsScreenDevice& aScreenDevice);
62 const MWsScreenDevice* iScreenDevice;