epoc32/include/bitdev.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    19 #include <fbs.h>
    19 #include <fbs.h>
    20 #include <bitbase.h>
    20 #include <bitbase.h>
    21 #include <bitstd.h>
    21 #include <bitstd.h>
    22 #include <graphicsaccelerator.h>
    22 #include <graphicsaccelerator.h>
    23 
    23 
    24 /**
       
    25 Used by RectCompare()
       
    26 @internalComponent
       
    27 */
       
    28 enum {EScanBufSize=0x80}; 
       
    29 
       
    30 class CFbsDrawDevice;
    24 class CFbsDrawDevice;
    31 class TSurfaceId;
    25 class TSurfaceId;
    32 
    26 
    33 /**
    27 /** Screen device orientations.
    34 Screen device orientations.
    28 
    35 @internalTechnology
    29 WARNING: Enumeration for internal use ONLY.  Compatibility is not guaranteed in future releases.
    36 @prototype
    30 
    37 */
    31 @publishedAll
       
    32 @released
       
    33  */
    38 enum TDeviceOrientation
    34 enum TDeviceOrientation
    39 	{
    35 	{
    40 	EDeviceOrientationNormal = 1,
    36 	EDeviceOrientationNormal = 1,
    41 	EDeviceOrientation90CW = 2,
    37 	EDeviceOrientation90CW = 2,
    42 	EDeviceOrientation180 = 4,
    38 	EDeviceOrientation180 = 4,
   100 	IMPORT_C TInt SetScalingFactor(const TPoint& aOrigin,
    96 	IMPORT_C TInt SetScalingFactor(const TPoint& aOrigin,
   101 								   TInt aFactorX, TInt aFactorY,
    97 								   TInt aFactorX, TInt aFactorY,
   102 								   TInt aDivisorX, TInt aDivisorY);
    98 								   TInt aDivisorX, TInt aDivisorY);
   103 	IMPORT_C void GetDrawRect(TRect& aRect) const;
    99 	IMPORT_C void GetDrawRect(TRect& aRect) const;
   104 	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId);
   100 	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId);
       
   101 	IMPORT_C TInt SetDrawDeviceOffset(const TPoint& aOrigin);
       
   102 
   105 protected:
   103 protected:
   106 	CFbsDevice();
   104 	CFbsDevice();
   107 	virtual void DrawingBegin(TBool /*aAlways*/ = EFalse) {}
   105 	virtual void DrawingBegin(TBool /*aAlways*/ = EFalse) {}
   108 	virtual void DrawingEnd(TBool /*aAlways*/ = EFalse) {}
   106 	virtual void DrawingEnd(TBool /*aAlways*/ = EFalse) {}
   109 	
   107 	
   111 	Sets the bit level.
   109 	Sets the bit level.
   112 	*/
   110 	*/
   113 	virtual void SetBits() {}
   111 	virtual void SetBits() {}
   114 	
   112 	
   115 	/**
   113 	/**
   116 	Cancels drawing the sprite. 
   114 	This method has been deprecated.  Sprites are no longer supported in BitGDI.
       
   115 	Calling this method has no effect.
       
   116 	@deprecated
   117 	*/
   117 	*/
   118 	virtual void CancelSprite() const {}
   118 	virtual void CancelSprite() const {}
   119 	
   119 	
   120 	/**
   120 	/**
   121 	Hides the sprite over the whole screen.
   121 	This method has been deprecated.  Sprites are no longer supported in BitGDI.
   122 	@return TSpriteBase* A pointer to the hidden sprite. NULL in default implementation.
   122 	Calling this method has no effect.
       
   123 	@return TSpriteBase* NULL.
       
   124 	@deprecated
   123 	*/
   125 	*/
   124 	virtual TSpriteBase* HideSprite() const {return(NULL);}
   126 	virtual TSpriteBase* HideSprite() const {return(NULL);}
   125 	
   127 	
   126 	/**
   128 	/**
   127 	Hides the sprite within a particular region.
   129 	This method has been deprecated.  Sprites are no longer supported in BitGDI.
   128 	@param aRect A rectangle within the clipping region.
   130 	Calling this method has no effect.
   129 	@param aClippingRegion The clipping region. 
   131 	@param aRect Ignored.
   130   	@return TSpriteBase* A pointer to the hidden sprite. NULL in default implementation.
   132 	@param aClippingRegion Ignored. 
       
   133   	@return TSpriteBase* NULL.
       
   134   	@deprecated
   131 	*/
   135 	*/
   132 	virtual TSpriteBase* HideSprite(const TRect&,const TRegion*) const {return(NULL);}
   136 	virtual TSpriteBase* HideSprite(const TRect&,const TRegion*) const {return(NULL);}
   133 	
   137 	
   134 	/**
   138 	/**
   135 	Shows the specified sprite over the whole screen.
   139 	This method has been deprecated.  Sprites are no longer supported in BitGDI.
   136 	@param aSprite The sprite which is to be shown. 
   140 	Calling this method has no effect.
       
   141 	@param aSprite Ignored.
       
   142 	@deprecated
   137 	*/
   143 	*/
   138 	virtual void ShowSprite(TSpriteBase*) const {}
   144 	virtual void ShowSprite(TSpriteBase*) const {}
   139 	
   145 	
   140 	/**
   146 	/**
   141 	Shows the specified sprite within a particular region.
   147 	This method has been deprecated.  Sprites are no longer supported in BitGDI.
   142 	@param aSprite The sprite which is to be shown. 
   148 	Calling this method has no effect.
   143  	@param aRect A rectangle within the clipping region. 
   149 	@param aSprite Ignored. 
   144  	@param aClippingRegion The clipping region 
   150  	@param aRect Ignored. 
       
   151  	@param aClippingRegion Ignored.
       
   152  	@deprecated
   145  	*/
   153  	*/
   146 	virtual void ShowSprite(TSpriteBase*,const TRect&,const TRegion*) const {}
   154 	virtual void ShowSprite(TSpriteBase*,const TRect&,const TRegion*) const {}
   147 	TInt GetNearestFbsFont(CFbsFont*& aFont,const TFontSpec& aFontSpec);
   155 	TInt GetNearestFbsFont(CFbsFont*& aFont,const TFontSpec& aFontSpec);
   148 	void DoGetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode);
   156 	void DoGetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode);
   149 	void ReadLineDiffMode(TInt,TInt,TInt,TAny*,TDisplayMode) const;
   157 	void ReadLineDiffMode(TInt,TInt,TInt,TAny*,TDisplayMode) const;
   163 	};
   171 	};
   164 
   172 
   165 /** A graphics device interface that provides direct access to the screen, without 
   173 /** A graphics device interface that provides direct access to the screen, without 
   166 the mediation of the window server.
   174 the mediation of the window server.
   167 
   175 
   168 The interface adds sprite support to the CFbsDevice base class. 
       
   169 @publishedAll
   176 @publishedAll
   170 @released
   177 @released
   171 */
   178 */
   172 class CFbsScreenDevice : public CFbsDevice
   179 class CFbsScreenDevice : public CFbsDevice
   173 	{
   180 	{
   181 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
   188 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
   182 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
   189 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
   183 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
   190 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
   184 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
   191 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
   185 	IMPORT_C void SetAutoUpdate(TBool aValue);
   192 	IMPORT_C void SetAutoUpdate(TBool aValue);
   186 	IMPORT_C void DrawSpriteBegin();
   193 	IMPORT_C void DrawSpriteBegin();		//< @deprecated
   187 	IMPORT_C void DrawSpriteEnd();
   194 	IMPORT_C void DrawSpriteEnd();		//< @deprecated
   188 	IMPORT_C void CancelSprite() const;
   195 	IMPORT_C void CancelSprite() const;		//< @deprecated
   189 	IMPORT_C TSpriteBase* HideSprite() const;
   196 	IMPORT_C TSpriteBase* HideSprite() const;		//< @deprecated
   190 	IMPORT_C TSpriteBase* HideSprite(const TRect& aRect,const TRegion* aClippingRegion) const;
   197 	IMPORT_C TSpriteBase* HideSprite(const TRect& aRect,const TRegion* aClippingRegion) const;		//< @deprecated
   191 	IMPORT_C void ShowSprite(TSpriteBase* aSprite) const;
   198 	IMPORT_C void ShowSprite(TSpriteBase* aSprite) const;		//< @deprecated
   192 	IMPORT_C void ShowSprite(TSpriteBase* aSprite,const TRect& aRect,const TRegion* aClippingRegion) const;
   199 	IMPORT_C void ShowSprite(TSpriteBase* aSprite,const TRect& aRect,const TRegion* aClippingRegion) const;		//< @deprecated
   193 	IMPORT_C void ChangeScreenDevice(CFbsScreenDevice* aOldDevice);
   200 	IMPORT_C void ChangeScreenDevice(CFbsScreenDevice* aOldDevice);
   194 	IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
   201 	IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
   195 	IMPORT_C void SetPalette(CPalette* aPalette);
   202 	IMPORT_C void SetPalette(CPalette* aPalette);
   196 	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
   203 	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
   197 	IMPORT_C void Update();
   204 	IMPORT_C void Update();
   199 	IMPORT_C TSize SizeInTwips() const;
   206 	IMPORT_C TSize SizeInTwips() const;
   200 	IMPORT_C RHardwareBitmap HardwareBitmap();
   207 	IMPORT_C RHardwareBitmap HardwareBitmap();
   201 	IMPORT_C const TUint32* Bits() const;
   208 	IMPORT_C const TUint32* Bits() const;
   202 	IMPORT_C TInt Stride() const;
   209 	IMPORT_C TInt Stride() const;
   203 	IMPORT_C TInt ScreenNo() const;
   210 	IMPORT_C TInt ScreenNo() const;
   204 	IMPORT_C TUint DeviceOrientationsAvailable() const;		//< @internalTechnology
   211 	IMPORT_C TUint DeviceOrientationsAvailable() const;	/**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
   205 	IMPORT_C TBool SetDeviceOrientation(TDeviceOrientation aOrientation) const;	//< @internalTechnology
   212 	IMPORT_C TBool SetDeviceOrientation(TDeviceOrientation aOrientation) const;	/**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
   206 	IMPORT_C void GetSurface(TSurfaceId& aSurface) const;		//< @internalTechnology
   213 	IMPORT_C void GetSurface(TSurfaceId& aSurface) const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
   207 	IMPORT_C TDeviceOrientation DeviceOrientation() const;		//< @internalTechnology
   214 	IMPORT_C TDeviceOrientation DeviceOrientation() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */
   208 private:
   215 private:
   209 	CFbsScreenDevice(TInt aScreenNo);
   216 	CFbsScreenDevice(TInt aScreenNo);
   210 	void ConstructL(TInt aScreenNo, TDisplayMode aDispMode);
   217 	void ConstructL(TInt aScreenNo, TDisplayMode aDispMode);
   211 private:
   218 private:
   212 	TSpriteBase* iSprite;
   219 	TInt iSpare1_CFbsScreenDevice;
   213 	TBool iSpriteDraw;
   220 	TInt iSpare2_CFbsScreenDevice;
   214     TInt iScreenNo;
   221     TInt iScreenNo;
   215 	};
   222 	};
   216 
   223 
   217 /** A graphics device to which a bitmap managed by the font and bitmap server can 
   224 /** A graphics device to which a bitmap managed by the font and bitmap server can 
   218 be drawn.
   225 be drawn.
   240 	IMPORT_C virtual void SetPalette(CPalette* aPalette);
   247 	IMPORT_C virtual void SetPalette(CPalette* aPalette);
   241 	IMPORT_C virtual TInt GetPalette(CPalette*& aPalette) const;
   248 	IMPORT_C virtual TInt GetPalette(CPalette*& aPalette) const;
   242 	IMPORT_C virtual void DrawingBegin(TBool aAlways = EFalse);
   249 	IMPORT_C virtual void DrawingBegin(TBool aAlways = EFalse);
   243 	IMPORT_C virtual void DrawingEnd(TBool aAlways = EFalse);
   250 	IMPORT_C virtual void DrawingEnd(TBool aAlways = EFalse);
   244 	IMPORT_C TInt SwapWidthAndHeight();
   251 	IMPORT_C TInt SwapWidthAndHeight();
       
   252 
   245 private:
   253 private:
   246 	CFbsBitmapDevice();
   254 	CFbsBitmapDevice();
   247 	virtual void SetBits();
   255 	virtual void SetBits();
   248 	void ConstructL(CFbsBitmap* aFbsBitmap);
   256 	void ConstructL(CFbsBitmap* aFbsBitmap);
   249 	void ConstructL(CFbsBitmap* aFbsBitmap,const TDesC& aLibname);
   257 	void ConstructL(CFbsBitmap* aFbsBitmap,const TDesC& aLibname);