1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/bitgdi/inc/BITDEV.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,263 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __BITDEV_H__
1.20 +#define __BITDEV_H__
1.21 +
1.22 +#include <fbs.h>
1.23 +#include <bitbase.h>
1.24 +#include <bitstd.h>
1.25 +#include <graphicsaccelerator.h>
1.26 +
1.27 +class CFbsDrawDevice;
1.28 +class TSurfaceId;
1.29 +
1.30 +/** Screen device orientations.
1.31 +
1.32 +WARNING: Enumeration for internal use ONLY. Compatibility is not guaranteed in future releases.
1.33 +
1.34 +@publishedAll
1.35 +@released
1.36 + */
1.37 +enum TDeviceOrientation
1.38 + {
1.39 + EDeviceOrientationNormal = 1,
1.40 + EDeviceOrientation90CW = 2,
1.41 + EDeviceOrientation180 = 4,
1.42 + EDeviceOrientation270CW = 8
1.43 + };
1.44 +
1.45 +/** Abstract base class for graphics devices to which bitmaps and fonts can be
1.46 +drawn.
1.47 +
1.48 +The class implements the pure virtual CBitmapDevice functions and additionally
1.49 +provides:
1.50 +
1.51 +support for creating and enquiring about fonts
1.52 +
1.53 +comparing two device rectangles
1.54 +
1.55 +creating a graphics context for the device.
1.56 +
1.57 +CFbsBitmapDevice and CFbsScreenDevice are derived fom this class.
1.58 +
1.59 +@see CFbsBitmapDevice
1.60 +@see CFbsScreenDevice
1.61 +@publishedAll
1.62 +@released
1.63 +*/
1.64 +class CFbsDevice : public CBitmapDevice
1.65 + {
1.66 + friend class CFbsBitGc;
1.67 +public:
1.68 + IMPORT_C ~CFbsDevice();
1.69 + IMPORT_C TInt CreateContext(CFbsBitGc*& aGc);
1.70 + inline TInt CreateContext(CGraphicsContext*& aGc);
1.71 + IMPORT_C TDisplayMode DisplayMode() const;
1.72 + IMPORT_C TSize SizeInPixels() const;
1.73 + IMPORT_C TBool RectCompare(const TRect& aSourceRect,const CFbsDevice& aDevice,const TRect& aDeviceRect) const;
1.74 + IMPORT_C TInt AddFile(const TDesC& aName,TInt& aId);
1.75 + IMPORT_C void RemoveFile(TInt aId=0);
1.76 + IMPORT_C virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.77 + IMPORT_C virtual TInt GetNearestFontInPixels(CFont*& aFont, const TFontSpec& aFontSpec);
1.78 + IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.79 + IMPORT_C virtual TInt GetNearestFontToDesignHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec);
1.80 + IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
1.81 + IMPORT_C virtual TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
1.82 + IMPORT_C TInt GetFontById(CFont*& aFont,TUid aFileId,const TAlgStyle& aStyle);
1.83 + inline TInt GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec);
1.84 + inline TInt GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec);
1.85 + inline TInt GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec);
1.86 + inline TInt GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec);
1.87 + inline TInt GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
1.88 + inline TInt GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
1.89 + inline TInt GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle);
1.90 + IMPORT_C void ReleaseFont(CFont* aFont);
1.91 + IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;
1.92 + IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;
1.93 + IMPORT_C TInt NumTypefaces() const;
1.94 + IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const;
1.95 + IMPORT_C TInt SetCustomPalette(const CPalette* aPalette);
1.96 + inline CGraphicsAccelerator* GraphicsAccelerator() const;
1.97 + inline CFbsBitGc::TGraphicsOrientation Orientation() const;
1.98 + IMPORT_C static TDisplayMode DisplayMode16M();
1.99 + IMPORT_C TInt SetScalingFactor(const TPoint& aOrigin,
1.100 + TInt aFactorX, TInt aFactorY,
1.101 + TInt aDivisorX, TInt aDivisorY);
1.102 + IMPORT_C void GetDrawRect(TRect& aRect) const;
1.103 + IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId);
1.104 + IMPORT_C TInt SetDrawDeviceOffset(const TPoint& aOrigin);
1.105 +
1.106 +protected:
1.107 + CFbsDevice();
1.108 + virtual void DrawingBegin(TBool /*aAlways*/ = EFalse) {}
1.109 + virtual void DrawingEnd(TBool /*aAlways*/ = EFalse) {}
1.110 +
1.111 + /**
1.112 + Sets the bit level.
1.113 + */
1.114 + virtual void SetBits() {}
1.115 +
1.116 + /**
1.117 + This method has been deprecated. Sprites are no longer supported in BitGDI.
1.118 + Calling this method has no effect.
1.119 + @deprecated
1.120 + */
1.121 + virtual void CancelSprite() const {}
1.122 +
1.123 + /**
1.124 + This method has been deprecated. Sprites are no longer supported in BitGDI.
1.125 + Calling this method has no effect.
1.126 + @return TSpriteBase* NULL.
1.127 + @deprecated
1.128 + */
1.129 + virtual TSpriteBase* HideSprite() const {return(NULL);}
1.130 +
1.131 + /**
1.132 + This method has been deprecated. Sprites are no longer supported in BitGDI.
1.133 + Calling this method has no effect.
1.134 + @param aRect Ignored.
1.135 + @param aClippingRegion Ignored.
1.136 + @return TSpriteBase* NULL.
1.137 + @deprecated
1.138 + */
1.139 + virtual TSpriteBase* HideSprite(const TRect&,const TRegion*) const {return(NULL);}
1.140 +
1.141 + /**
1.142 + This method has been deprecated. Sprites are no longer supported in BitGDI.
1.143 + Calling this method has no effect.
1.144 + @param aSprite Ignored.
1.145 + @deprecated
1.146 + */
1.147 + virtual void ShowSprite(TSpriteBase*) const {}
1.148 +
1.149 + /**
1.150 + This method has been deprecated. Sprites are no longer supported in BitGDI.
1.151 + Calling this method has no effect.
1.152 + @param aSprite Ignored.
1.153 + @param aRect Ignored.
1.154 + @param aClippingRegion Ignored.
1.155 + @deprecated
1.156 + */
1.157 + virtual void ShowSprite(TSpriteBase*,const TRect&,const TRegion*) const {}
1.158 + TInt GetNearestFbsFont(CFbsFont*& aFont,const TFontSpec& aFontSpec);
1.159 + void DoGetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode);
1.160 + void ReadLineDiffMode(TInt,TInt,TInt,TAny*,TDisplayMode) const;
1.161 + void TruncateRect(TRect& aRect);
1.162 + TBool SetOrientation(CFbsBitGc::TGraphicsOrientation aOrientation);
1.163 + void DrawingBegin(const CFbsBitmap* aBitmap, TBool aAlways = EFalse);
1.164 + void DrawingEnd(const CFbsBitmap* aBitmap, TBool aAlways = EFalse);
1.165 +protected:
1.166 + CFbsDrawDevice* iDrawDevice;
1.167 + RFbsSession* iFbs;
1.168 + CFbsTypefaceStore* iTypefaceStore;
1.169 + TInt iSpare;
1.170 + TBool iScreenDevice;
1.171 + TUint8* iBitBltMaskedBuffer;
1.172 + CGraphicsAccelerator* iGraphicsAccelerator;
1.173 + CFbsBitGc::TGraphicsOrientation iOrientation;
1.174 + };
1.175 +
1.176 +/** A graphics device interface that provides direct access to the screen, without
1.177 +the mediation of the window server.
1.178 +
1.179 +@publishedAll
1.180 +@released
1.181 +*/
1.182 +class CFbsScreenDevice : public CFbsDevice
1.183 + {
1.184 +public:
1.185 + IMPORT_C static CFbsScreenDevice* NewL(const TDesC& aLibname,TDisplayMode aDispMode);
1.186 + IMPORT_C static CFbsScreenDevice* NewL(const TDesC& aLibname,TDisplayMode aDispMode, TRgb aWhite);
1.187 + IMPORT_C static CFbsScreenDevice* NewL(TInt aScreenNo, TDisplayMode aDispMode);
1.188 + IMPORT_C virtual ~CFbsScreenDevice();
1.189 + IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,TInt aLength,TDisplayMode aDispMode) const;
1.190 + IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPixel) const;
1.191 + IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
1.192 + IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
1.193 + IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
1.194 + IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
1.195 + IMPORT_C void SetAutoUpdate(TBool aValue);
1.196 + IMPORT_C void DrawSpriteBegin(); //< @deprecated
1.197 + IMPORT_C void DrawSpriteEnd(); //< @deprecated
1.198 + IMPORT_C void CancelSprite() const; //< @deprecated
1.199 + IMPORT_C TSpriteBase* HideSprite() const; //< @deprecated
1.200 + IMPORT_C TSpriteBase* HideSprite(const TRect& aRect,const TRegion* aClippingRegion) const; //< @deprecated
1.201 + IMPORT_C void ShowSprite(TSpriteBase* aSprite) const; //< @deprecated
1.202 + IMPORT_C void ShowSprite(TSpriteBase* aSprite,const TRect& aRect,const TRegion* aClippingRegion) const; //< @deprecated
1.203 + IMPORT_C void ChangeScreenDevice(CFbsScreenDevice* aOldDevice);
1.204 + IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
1.205 + IMPORT_C void SetPalette(CPalette* aPalette);
1.206 + IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
1.207 + IMPORT_C void Update();
1.208 + IMPORT_C void Update(const TRegion& aRegion);
1.209 + IMPORT_C TSize SizeInTwips() const;
1.210 + IMPORT_C RHardwareBitmap HardwareBitmap();
1.211 + IMPORT_C const TUint32* Bits() const;
1.212 + IMPORT_C TInt Stride() const;
1.213 + IMPORT_C TInt ScreenNo() const;
1.214 + IMPORT_C TUint DeviceOrientationsAvailable() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
1.215 + IMPORT_C TBool SetDeviceOrientation(TDeviceOrientation aOrientation) const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
1.216 + IMPORT_C void GetSurface(TSurfaceId& aSurface) const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
1.217 + IMPORT_C TDeviceOrientation DeviceOrientation() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
1.218 +private:
1.219 + CFbsScreenDevice(TInt aScreenNo);
1.220 + void ConstructL(TInt aScreenNo, TDisplayMode aDispMode);
1.221 +private:
1.222 + TInt iSpare1_CFbsScreenDevice;
1.223 + TInt iSpare2_CFbsScreenDevice;
1.224 + TInt iScreenNo;
1.225 + };
1.226 +
1.227 +/** A graphics device to which a bitmap managed by the font and bitmap server can
1.228 +be drawn.
1.229 +
1.230 +The class specialises the bitmap graphics device interface CBitmapDevice for
1.231 +drawing to in-memory bitmaps.
1.232 +@publishedAll
1.233 +@released
1.234 +*/
1.235 +class CFbsBitmapDevice : public CFbsDevice
1.236 + {
1.237 +public:
1.238 + IMPORT_C static CFbsBitmapDevice* NewL(CFbsBitmap* aFbsBitmap);
1.239 + IMPORT_C static CFbsBitmapDevice* NewL(CFbsBitmap* aFbsBitmap,const TDesC& aLibname);
1.240 + IMPORT_C virtual ~CFbsBitmapDevice();
1.241 + IMPORT_C TInt Resize(const TSize& aSize);
1.242 + IMPORT_C virtual void GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,TInt aLength,TDisplayMode iDispMode) const;
1.243 + IMPORT_C virtual void GetPixel(TRgb& aColor,const TPoint& aPixel) const;
1.244 + IMPORT_C virtual TInt HorizontalPixelsToTwips(TInt aPixels) const;
1.245 + IMPORT_C virtual TInt VerticalPixelsToTwips(TInt aPixels) const;
1.246 + IMPORT_C virtual TInt HorizontalTwipsToPixels(TInt aTwips) const;
1.247 + IMPORT_C virtual TInt VerticalTwipsToPixels(TInt aTwips) const;
1.248 + IMPORT_C virtual TSize SizeInTwips() const;
1.249 + IMPORT_C virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
1.250 + IMPORT_C virtual void SetPalette(CPalette* aPalette);
1.251 + IMPORT_C virtual TInt GetPalette(CPalette*& aPalette) const;
1.252 + IMPORT_C virtual void DrawingBegin(TBool aAlways = EFalse);
1.253 + IMPORT_C virtual void DrawingEnd(TBool aAlways = EFalse);
1.254 + IMPORT_C TInt SwapWidthAndHeight();
1.255 +
1.256 +private:
1.257 + CFbsBitmapDevice();
1.258 + virtual void SetBits();
1.259 + void ConstructL(CFbsBitmap* aFbsBitmap);
1.260 + void ConstructL(CFbsBitmap* aFbsBitmap,const TDesC& aLibname);
1.261 +private:
1.262 + CFbsBitGcBitmap* iFbsBmp;
1.263 + };
1.264 +
1.265 +#include <bitdev.inl>
1.266 +#endif