epoc32/include/bitstd.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 bitstd.h
     1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __BITSTD_H__
       
    17 #define __BITSTD_H__
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <gdi.h>
       
    21 #include <fbs.h>
       
    22 #include <bitbase.h>
       
    23 
       
    24 // For use when testing the code, allows the fast blending to be disabled so back to back comparisons
       
    25 // can done be to check either timing or exact output.
       
    26 //#define __ALLOW_FAST_BLEND_DISABLE__
       
    27 
       
    28 /**
       
    29  @publishedAll
       
    30  @released 
       
    31 */
       
    32 class CFbsBitGcFont : public CFbsFont
       
    33 	{
       
    34 public:
       
    35 	IMPORT_C CFbsBitGcFont();
       
    36 	IMPORT_C virtual ~CFbsBitGcFont();
       
    37 	IMPORT_C CBitmapFont* Address() const;
       
    38 	IMPORT_C TInt Duplicate(TInt aHandle);
       
    39 	IMPORT_C void Reset();
       
    40 	IMPORT_C void operator=(const CFbsBitGcFont& aFont);
       
    41 protected:
       
    42 	TBool iCopy;
       
    43 	};
       
    44 
       
    45 
       
    46 /**
       
    47 A bitmap managed by the font and bitmap server.
       
    48 @publishedAll
       
    49 @released 
       
    50 */
       
    51 class CFbsBitGcBitmap : public CFbsBitmap
       
    52 
       
    53 	{
       
    54 public:
       
    55 	IMPORT_C CBitwiseBitmap* Address() const;
       
    56 	IMPORT_C void LockHeap() const;
       
    57 	IMPORT_C void UnlockHeap() const;
       
    58 	};
       
    59 
       
    60 /**
       
    61  @publishedAll
       
    62  @released 
       
    63 */
       
    64 class TEllipse
       
    65 	{
       
    66 public:
       
    67 	/**	
       
    68 	Enumeration for the ellipse production life cycle
       
    69 	*/
       
    70 	enum TEllipseStatus
       
    71 		{
       
    72 		/**
       
    73 		Ellipse has been initialised but has no area
       
    74 		*/
       
    75 		EInitialised,
       
    76 		/**
       
    77 		The ellipse is drawn as two parabolas. These are in two sectors, the top and bottom
       
    78 		half of the rectangle. The first sector means the top parabola has been produced.
       
    79 		*/
       
    80 		EFirstSector,
       
    81 		/**
       
    82 		The parabola that occupies the bottom half of the rectangle has been produced. 
       
    83 		*/
       
    84 		ESecondSector,
       
    85 		/**
       
    86 		The ellipse is complete
       
    87 		*/
       
    88 		EComplete,
       
    89 		/**
       
    90 		The ellipse has either a height or width of two units or less
       
    91 		and so takes the appearance of a line
       
    92 		*/
       
    93 		ELine
       
    94 		};
       
    95 public:
       
    96 	IMPORT_C void Construct(const TRect& aRect);
       
    97 	IMPORT_C TBool SingleStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
       
    98 	IMPORT_C TBool NextStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
       
    99 	IMPORT_C TPoint Intersection(const TRect& aRect,const TPoint& aPoint);
       
   100 protected:
       
   101 	IMPORT_C TBool Output(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
       
   102 protected:
       
   103 	TEllipseStatus iStatus;
       
   104 	TInt iA;
       
   105 	TInt iB;
       
   106 	TInt64 iASquared;
       
   107 	TInt64 iBSquared;
       
   108 	TInt64 iASquBSqu;
       
   109 	TInt iX;
       
   110 	TInt iY;
       
   111 	TInt iXAdj;
       
   112 	TInt iYAdj;
       
   113 	TPoint iOffset;
       
   114 	TInt64 iD1;
       
   115 	TInt64 iD2;
       
   116 	};
       
   117 
       
   118 /**
       
   119  @publishedAll
       
   120  @released 
       
   121 */
       
   122 class CPolygonFiller : public CBase
       
   123 
       
   124 	{
       
   125 public:
       
   126 
       
   127 	/**
       
   128 	Describes how pixels are to be displayed in the polygon. aUsage should be select to
       
   129 	one of these values before CPolygonFiller::Construct is used.
       
   130 	*/
       
   131 	enum TUsage
       
   132 		{
       
   133 		/**
       
   134 		A request for all pixel runs in sequential order
       
   135 		*/
       
   136 		EGetAllPixelRunsSequentially,
       
   137 		/**
       
   138 		A request for all pixel runs in sequential order but only for specified lines.
       
   139 		*/
       
   140 		EGetPixelRunsSequentiallyForSpecifiedScanLines
       
   141 		};
       
   142 public:
       
   143 	IMPORT_C CPolygonFiller();
       
   144 	IMPORT_C ~CPolygonFiller();
       
   145 	IMPORT_C void Construct(const CArrayFix<TPoint>* aPointArray,CGraphicsContext::TFillRule aFillRule,TUsage aUsage=EGetAllPixelRunsSequentially); // N.B. this cannot fail
       
   146 	IMPORT_C void Construct(const TPoint* aPointList,TInt aNumPoints, CGraphicsContext::TFillRule aFillRule, TUsage aUsage=EGetAllPixelRunsSequentially); // N.B. this cannot fail
       
   147 	IMPORT_C void Reset();
       
   148 	IMPORT_C void GetNextPixelRun(TBool& aExists, TInt& aScanLine, TInt& aStart, TInt& aEnd);
       
   149 	IMPORT_C void GetNextPixelRunOnSpecifiedScanLine(TBool& aExists, TInt aScanLine, TInt& aStart, TInt& aEnd);
       
   150 private: // data-types for the fast algorithm
       
   151 	struct SFastEdge
       
   152 		{
       
   153 		TInt upperVertex;
       
   154 		TInt lowerVertex;
       
   155 		TInt firstVertex;
       
   156 		};
       
   157 	struct SFastScanLineIntersection;
       
   158 	struct SFastActiveEdge
       
   159 		{
       
   160 		SFastEdge* edgePtr;
       
   161 		TLinearDDA lineGenerator;
       
   162 		SFastScanLineIntersection* scanLineIntersectionPtr;
       
   163 		};
       
   164 	struct SFastScanLineIntersection
       
   165 		{
       
   166 		TInt firstPixel;
       
   167 		TInt lastPixel;
       
   168 		SFastActiveEdge* activeEdgePtr;
       
   169 		};
       
   170 private: // data-types for the slow algorithm
       
   171 	struct SSlowScanLineIntersection
       
   172 		{
       
   173 		TInt firstPixel;
       
   174 		TInt lastPixel;
       
   175 		TInt firstVertexOfEdge;
       
   176 		};
       
   177 private: // data-types for both algorithms
       
   178 	struct SFastData
       
   179 		{
       
   180 		TPoint* vertexList;
       
   181 		SFastEdge* edgeList;
       
   182 		SFastActiveEdge* activeEdgeList;
       
   183 		SFastScanLineIntersection* scanLineIntersectionList;
       
   184 		TInt numActiveEdges;
       
   185 		TInt numScanLineIntersections;
       
   186 		TInt nextEdgeToActivate;
       
   187 		};
       
   188 	struct SSlowData
       
   189 		{
       
   190 		enum {EStoreSize=8};
       
   191 		TLinearDDA lineGenerator;
       
   192 		SSlowScanLineIntersection scanLineIntersectionList[EStoreSize];
       
   193 		TInt numIntersectionsWithSameFirstPixelPreviouslyMet;
       
   194 		TInt numIntersectionsWithSameFirstPixelMetThisTime;
       
   195 		TInt numScanLineIntersections;
       
   196 		TBool scanLineComplete;
       
   197 		TInt firstPixelOfLastIntersectionInPrevBuffer;
       
   198 		};
       
   199 private:
       
   200 	void Construct(CGraphicsContext::TFillRule aFillRule,TUsage aUsage);
       
   201 	void FastHandleVertexIntersection(TInt& aCurrentActiveEdge, TBool aIsLowerVertex);
       
   202 	void SetFastIntersection(SFastActiveEdge& aActiveEdge, SFastScanLineIntersection& aScanLineIntersection);
       
   203 	void SlowHandleVertexIntersection(SSlowScanLineIntersection& aScanLineIntersection, TInt& aVertexStartingCurrentEdge,TBool aIsLowerVertex);
       
   204 	void JumpToCurrentScanLine(TLinearDDA& aLineGenerator, const TPoint& aUpper, const TPoint& aLower,TPoint& aStartPos, TPoint& aEndPos) const;
       
   205 	const TPoint& Point(TInt aIndex);
       
   206 private:
       
   207 	const CArrayFix<TPoint>* iPointArray; // not owned by the class
       
   208 	const TPoint* iPointList; // not owned by the class
       
   209 	CGraphicsContext::TFillRule iFillRule;
       
   210 	TBool iUseFastAlgorithm;
       
   211 	TInt iNumVertexes;
       
   212 	TBool iToggler; // used by EAlternate fill-rule
       
   213 	TInt iNestingLevel; // used by EWinding fill-rule
       
   214 	TInt iScanLineIntersection;
       
   215 	TInt iRightMostPixelOnScanLine;
       
   216 	TInt iFirstVertex;
       
   217 	TBool iPolygonIsAllHorizontal;
       
   218 	TInt iFirstScanLine;
       
   219 	TInt iLastScanLine;
       
   220 	TInt iCurrentScanLine;
       
   221 	SFastData iFastData;
       
   222 	SSlowData iSlowData;
       
   223 private:
       
   224 	friend class TCompareEdgesUpperY;
       
   225 	friend class TCompareActiveEdgesFirstVertex;
       
   226 	friend class TCompareScanLineIntersectionsFirstPixel;
       
   227 	friend class TSwapEdges;
       
   228 	friend class TSwapActiveEdges;
       
   229 	friend class TSwapScanLineIntersections;
       
   230 	};
       
   231 
       
   232 class CFbsDevice;
       
   233 class TOpenFontCharMetrics;
       
   234 class CGraphicsAccelerator;
       
   235 class CWsBitmap;
       
   236 class MFastBlend;
       
   237 
       
   238 /**
       
   239 Class used to extend the CFbsBitGc class to avoid BC break. Any data member which needs 
       
   240 to be added in CFbsBitGc should be added to this class.
       
   241 @internalAll
       
   242 @released
       
   243 */
       
   244 class CFbsBitGcExtraData:public CBase
       
   245 	{
       
   246 public:
       
   247 	CFbsBitGcExtraData();
       
   248 	~CFbsBitGcExtraData();
       
   249 	void Reset();
       
   250 	inline TInt* PenArray(){return iPenArray;};
       
   251 	inline TRgb ShadowColor(){return iShadowColor;}
       
   252 	inline void SetPenArray(TInt* aPenArray);
       
   253 	inline void SetShadowColor(const TRgb& aShadowColor);
       
   254 	inline void ResetPenArray();
       
   255 private:
       
   256 	TInt* iPenArray;
       
   257 	TRgb iShadowColor;
       
   258 	};
       
   259 
       
   260 inline void CFbsBitGcExtraData::SetPenArray(TInt* aPenArray)
       
   261 	{
       
   262 	delete[] iPenArray;
       
   263 	iPenArray = aPenArray;
       
   264 	}
       
   265 
       
   266 inline void CFbsBitGcExtraData::SetShadowColor(const TRgb& aShadowColor)
       
   267 	{
       
   268 	iShadowColor = aShadowColor;
       
   269 	}
       
   270 
       
   271 inline void CFbsBitGcExtraData::ResetPenArray()
       
   272 	{
       
   273 	delete[] iPenArray;
       
   274 	iPenArray = NULL;
       
   275 	}
       
   276 
       
   277 /** 
       
   278 Concrete implementation of a bitmapped graphics context.
       
   279 
       
   280 The class provides new functionality, and implementations of the pure virtual 
       
   281 functions defined in CGraphicsContext and CBitmapContext. 
       
   282 @publishedAll
       
   283 @released
       
   284 */
       
   285 class CFbsBitGc : public CBitmapContext
       
   286 	{
       
   287 public:
       
   288 
       
   289 
       
   290 /** Defines possible rotation values. */
       
   291 	enum TGraphicsOrientation
       
   292 		{
       
   293 	/** Normal orientation is supported. */
       
   294 		EGraphicsOrientationNormal,
       
   295 	/** A 90 degree rotation is supported. */
       
   296 		EGraphicsOrientationRotated90,
       
   297 	/** A 180 degree rotation is supported. */
       
   298 		EGraphicsOrientationRotated180,
       
   299 	/** A 270 degree rotation is supported. */
       
   300 		EGraphicsOrientationRotated270
       
   301 		};
       
   302 public:
       
   303 	IMPORT_C static CFbsBitGc* NewL();
       
   304 	IMPORT_C virtual ~CFbsBitGc();
       
   305 	IMPORT_C void Activate(CFbsDevice* aDevice);
       
   306 	IMPORT_C void ActivateNoJustAutoUpdate(CFbsDevice* aDevice);
       
   307 	IMPORT_C void BitBlt(const TPoint& aPoint,const CFbsBitGc& aGc);
       
   308 	IMPORT_C void BitBlt(const TPoint& aPoint,const CFbsBitGc& aGc,const TRect& aSourceRect);
       
   309 	IMPORT_C void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap);
       
   310 	IMPORT_C void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect);
       
   311 	IMPORT_C void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
       
   312 	IMPORT_C void CancelClipping();
       
   313 	IMPORT_C void CancelClippingRect();
       
   314 	IMPORT_C void CancelClippingRegion();
       
   315 	IMPORT_C void Clear();
       
   316 	IMPORT_C void Clear(const TRect& aRect);
       
   317 	IMPORT_C void CopyRect(const TPoint& aOffset,const TRect& aRect);
       
   318 	IMPORT_C void CopySettings(const CFbsBitGc& aGc);
       
   319 	IMPORT_C CGraphicsDevice* Device() const;
       
   320 	IMPORT_C void DiscardBrushPattern();
       
   321 	IMPORT_C void DiscardFont();
       
   322 	IMPORT_C void DrawArc(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd);
       
   323 	IMPORT_C void DrawPie(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd);
       
   324 	IMPORT_C void DrawBitmap(const TPoint& aTopLeft,const CFbsBitmap* aSource);
       
   325 	IMPORT_C void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource);
       
   326 	IMPORT_C void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource,const TRect& aSourceRect);
       
   327 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
       
   328 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
       
   329 	IMPORT_C void DrawRoundRect(const TRect& aRect,const TSize& aEllipse);
       
   330 	IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
       
   331 	IMPORT_C void DrawPolyLineNoEndPoint(const CArrayFix<TPoint>* aPointList);
       
   332 	IMPORT_C void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints);
       
   333 	IMPORT_C void DrawPolyLineNoEndPoint(const TPoint* aPointList,TInt aNumPoints);
       
   334 	IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList,CGraphicsContext::TFillRule aFillRule=CGraphicsContext::EAlternate);
       
   335 	IMPORT_C TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,CGraphicsContext::TFillRule aFillRule=CGraphicsContext::EAlternate);
       
   336 	IMPORT_C void DrawEllipse(const TRect& aRect);
       
   337 	IMPORT_C void DrawLine(const TPoint& aStart,const TPoint& aEnd);
       
   338 	IMPORT_C void DrawLineTo(const TPoint& aPoint);
       
   339 	IMPORT_C void DrawLineBy(const TPoint& aVector);
       
   340 	IMPORT_C void DrawRect(const TRect& aRect);
       
   341 	IMPORT_C void DrawText(const TDesC& aText);
       
   342 	IMPORT_C void DrawText(const TDesC& aText,const TPoint& aPosition);
       
   343 	IMPORT_C void DrawText(const TDesC& aText,const TRect& aBox);
       
   344 	IMPORT_C void DrawText(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
       
   345 	IMPORT_C void DrawText(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TInt aTextWidth,TTextAlign aHrz=ELeft,TInt aMargin=0);
       
   346 	IMPORT_C void DrawTextVertical(const TDesC& aText,TBool aUp);
       
   347 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPosition,TBool aUp);
       
   348 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TBool aUp);
       
   349 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
       
   350 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
       
   351 	IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs=2,TBool aMapForwards=ETrue);
       
   352 	IMPORT_C void MoveTo(const TPoint& aPoint);
       
   353 	IMPORT_C void MoveBy(const TPoint& aVector);
       
   354 	IMPORT_C void OrientationsAvailable(TBool aOrientation[4]);
       
   355 	IMPORT_C void Plot(const TPoint& aPoint);
       
   356 	IMPORT_C void RectDrawnTo(TRect& aRect);
       
   357 	IMPORT_C void Reset();
       
   358 	IMPORT_C void Resized();
       
   359 	IMPORT_C void SetBrushColor(const TRgb& aColor);
       
   360 	IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
       
   361 	IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
       
   362 	IMPORT_C void SetClippingRegion(const TRegion* aRegion);
       
   363 	IMPORT_C void SetClippingRect(const TRect& aRect);
       
   364 	IMPORT_C void SetDitherOrigin(const TPoint& aPoint);
       
   365 	IMPORT_C void SetDrawMode(TDrawMode);
       
   366 	IMPORT_C void SetOrigin(const TPoint& aPoint=TPoint(0,0));
       
   367 	IMPORT_C void SetPenColor(const TRgb& aColor);
       
   368 	IMPORT_C void SetPenStyle(TPenStyle);
       
   369 	IMPORT_C void SetPenSize(const TSize& aSize);
       
   370 	IMPORT_C void SetCharJustification(TInt aExcessWidth,TInt aNumGaps);
       
   371 	IMPORT_C void SetWordJustification(TInt aExcessWidth,TInt aNumChars);
       
   372 	IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
       
   373 	IMPORT_C void SetUserDisplayMode(TDisplayMode aDisplayMode);
       
   374 	IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
       
   375 	IMPORT_C void SetShadowMode(TBool aShadowMode = EFalse);
       
   376 	inline void SetFadeMode(TBool aFadeMode = EFalse);			//Deprecated
       
   377 	inline void SetFadingParameters(TUint8 aBlackMap = 0);		//Deprecated
       
   378 	IMPORT_C void SetFaded(TBool aFaded);		//Virtual from CBitmapContext
       
   379 	IMPORT_C void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);	//Virtual from CBitmapContext
       
   380 	IMPORT_C TBool SetOrientation(TGraphicsOrientation aOrientation);
       
   381 	IMPORT_C void ShadowArea(const TRegion* aRegion);
       
   382 	IMPORT_C void FadeArea(const TRegion* aRegion);
       
   383 	IMPORT_C void UpdateJustification(const TDesC& aText);
       
   384 	IMPORT_C void UpdateJustificationVertical(const TDesC& aText,TBool aUp);
       
   385 	IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
       
   386 	IMPORT_C TInt UseBrushPattern(TInt aFbsBitmapHandle);
       
   387 	IMPORT_C void UseFont(const CFont* aFont);
       
   388 	IMPORT_C TInt UseFont(TInt aFontHandle);
       
   389 	IMPORT_C void UseFontNoDuplicate(const CFbsBitGcFont* aFont);
       
   390 	IMPORT_C TBool IsBrushPatternUsed() const;
       
   391 	IMPORT_C TBool IsFontUsed() const;
       
   392 	inline static TInt16 Load16(const TUint8* aPtr) { return TInt16(aPtr[0]+(aPtr[1]<<8)); }
       
   393 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt,
       
   394 									const CFbsBitmap* aSrcBmp1,
       
   395 									const CFbsBitmap* aSrcBmp2,
       
   396 									const TRect& aSrcRect1,
       
   397 									const TPoint& aSrcPt2,
       
   398 									const CFbsBitmap* aAlphaBmp,
       
   399 									const TPoint& aAlphaPt);
       
   400 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt,
       
   401 									const CFbsBitmap* aSrcBmp,
       
   402 									const TRect& aSrcRect,
       
   403 									const CFbsBitmap* aAlphaBmp,
       
   404 									const TPoint& aAlphaPt);
       
   405 	IMPORT_C void ExternalizeL(RWriteStream& aWriteStream);
       
   406 	IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
   407 	IMPORT_C TInt SetClippingRegion(const TRegion& aRegion);
       
   408 
       
   409 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt,
       
   410 											const CWsBitmap* aSrcBmp,
       
   411 											const TRect& aSrcRect,
       
   412 											const CWsBitmap* aAlphaBmp,
       
   413 											const TPoint& aAlphaPt);
       
   414 	IMPORT_C TRgb BrushColor();
       
   415 	IMPORT_C TRgb PenColor();	
       
   416 	IMPORT_C void ChangeDevice(CFbsDevice* aDevice);
       
   417 private:
       
   418 	CFbsBitGc();
       
   419 	void AddRect(const TRect& aRect);
       
   420 	TBool AnalyseEllipse(const TRect& rc, TPoint& srad, TPoint& erad, TInt& startq, TInt& endq, TBool* quads);
       
   421 	void BitMultiply(TUint32* aBinaryDataPtr,TInt aBitLength,TInt aMultiplier);
       
   422 	void CheckDevice() const;
       
   423 	TBool CheckDevice(const TRect& aRect) const;
       
   424 	TUint32* ClipBinaryArray(TUint32* aArray,TUint32* aArrayLimit,TInt aArrayWordWd,TInt& aDataWd,TInt& aDataHt,TPoint& aPos);
       
   425 	void ClipFillLine(TPoint,TPoint);
       
   426 	void CopyCharWord(TUint32* aBinaryDataPtr,const TUint8* aData,TInt aBitShift);
       
   427 	void CopyCharLine(TUint32* aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth);
       
   428 	void DrawText(const TDesC& aText,const TPoint& aPosition,TTextAlign aAlignment,
       
   429 				  CFont::TTextDirection aDirection,const TRect* aBox = NULL);
       
   430 	void DoBitBlt(const TPoint& aDest,CFbsDevice* aDevice,const TRect& aSourceRect);
       
   431 	void DoBitBlt(const TPoint& aDest,CBitwiseBitmap* aBitmap,TUint32* aBase,TInt aStride,const TRect& aSourceRect);
       
   432 	void DoBitBltMasked(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
       
   433 	void DoBitBltMaskedFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
       
   434 	void DoBitBltMaskedNonFlicker(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
       
   435 	void DoBitBltMaskedNonFlickerSolid(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
       
   436 	void DoBitBltMaskedNonFlickerPatterned(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin,TInt aShadowMode);
       
   437 	void DoBitBltAlpha(const TPoint& aDest,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,const TPoint& aDitherOrigin,TInt aShadowMode, TBool aInvertMask);
       
   438 	void DoBitBltAlpha(const TPoint& aDestPt,
       
   439 					   const CBitwiseBitmap* aSrcBmp1,
       
   440 					   TUint32* aSrcBmpDataAddr1,
       
   441 					   const CBitwiseBitmap* aSrcBmp2,
       
   442 					   TUint32* aSrcBmpDataAddr2,
       
   443 					   const CBitwiseBitmap* aAlphaBmp,
       
   444 					   TUint32* aAlphaBmpDataAddr,
       
   445 					   const TRect& aSrcRect1,
       
   446 					   const TPoint& aSrcPt2,
       
   447 					   const TPoint& aAlphaPt,
       
   448 					   TInt aShadowMode);
       
   449 	void DoCopyRect(const TPoint&,const TRect&);
       
   450 	void DoDrawBitmap(const TRect&,CBitwiseBitmap*,TUint32* aBase,TInt aStride,const TRect&,const TPoint& aDitherOrigin);
       
   451 	void DoDrawBitmapMasked(const TRect& aDestRect,CBitwiseBitmap* aSourceBitmap,TUint32* aSourceBase,const TRect& aSourceRect,CBitwiseBitmap* aMaskBitmap,TUint32* aMaskBase,TBool aInvertMask,const TPoint& aDitherOrigin);
       
   452 	void DoDrawLine(TPoint aStart,TPoint aEnd,TBool aDrawStartPoint);
       
   453 	void DoDrawDottedWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
       
   454 	void DoDrawSolidWideLine(const TPoint& pt1,const TPoint& pt2,TBool drawstart,const TRect& screenrect);
       
   455 	void DoDrawText(CFont::TPositionParam& aParam);
       
   456 	void DoDrawCharacter(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData);
       
   457 	void DoDrawTextEx(CFont::TPositionParam& aParam,const CBitmapFont* font);
       
   458 	void DoDrawCharacterEx(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
       
   459 		TBool aBold,TBool aItalic,TInt aSemiAscent);
       
   460 	void DoDrawCharacterAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData);
       
   461 	void DoDrawTextLarge(CFont::TPositionParam& aParam,const CBitmapFont* font);
       
   462 	void DoDrawCharacterLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
       
   463 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
       
   464 	void DoDrawCharacterExLarge(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
       
   465 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor);
       
   466 	void DoDrawCharacterMultiplied(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
       
   467 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthMultiplier,TInt aHeightMultiplier);
       
   468 	void DoDrawTextVertical(CFont::TPositionParam& aParam,const CBitmapFont* font,TBool aUp);
       
   469 	void DoDrawCharacterVertical(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,
       
   470 		TBool aBold,TBool aItalic,TInt aSemiAscent,TInt aWidthFactor,TInt aHeightFactor,TBool aUp);
       
   471 	void DoDrawCharacterVerticalAntiAliased(const TPoint& aTopLeft,const TSize& aDataSize,const TUint8* aData,TBool aUp);
       
   472 	void DoPlot(const TPoint& pt);
       
   473 	void EllipseFill(const TRect& aRect);
       
   474 	void EllipseOutline(const TRect& aRect);
       
   475 	void EllipseOutlineWide(const TRect& aRect);
       
   476 	void GetStrikethroughMetrics(TInt& aTop,TInt& aBottom);
       
   477 	void OutputCharLine(TPoint aPrintPos,TUint32* aBuffer,TInt aDataLength,TInt aNum,TBool aBold,TInt aWidthFactor,TInt aHeightFactor);
       
   478 	void OutputCharLineMultiplied(TPoint aPrintPos,TUint32* aBuffer,TInt aDataLength,TInt aNum,TBool aBold,TInt aWidthMultiplier,TInt aHeightMultiplier);
       
   479 	void OutputCharLineVertical(TPoint aPrintPos,TUint32* aBuffer,TInt aDataLength,TInt aNum,TBool aBold,TInt aWidthFactor,TInt aHeightFactor,TBool aUp);
       
   480 	void PenAllocate();
       
   481 	void PenDrawClipped(TPoint aPoint);
       
   482 	void PenDrawDeferred(TPoint aPoint,TInt* aArray,TInt aFirstElement);
       
   483 	void PieArcOutline(const TRect& aRect,const TPoint& aStartRadius,const TPoint& aEndRadius,TBool aDoPie);
       
   484 	void PieFill(const TRect& ellrect, const TPoint& aStartIntersect, const TPoint& aEndIntersect,
       
   485 		TInt aStartQuadrant, TInt aEndQuadrant, const TBool* aQuadrants);
       
   486 	void PieShell(const TRect& ellrect, const TPoint& startradius, const TPoint& endradius,
       
   487 		const TBool* quads, TInt startquad, TInt endquad);
       
   488 	void PieTriangles(TBool aInside,const TPoint& aStart,const TPoint& aEnd);
       
   489 	void PieSliver(const TRect& ellrect,const TPoint& startradius,const TPoint& endradius,TInt quad);
       
   490 	void PolyFill(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule);
       
   491 	void PolyFillLarge(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule);
       
   492 	void PolyFill(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule);
       
   493 	void PolyFillLarge(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule);
       
   494 	void PolyOutline(const CArrayFix<TPoint>* aPointList);
       
   495 	void PolyOutline(const TPoint* aPointList,TInt aNumPoints);
       
   496 	void RectFill(const TRect& aRect);
       
   497 	void RoundRectFill(const TRect& aRect,TSize aSize);
       
   498 	void RoundRectOutline(const TRect& aRect,TSize aSize);
       
   499 	void SetupDevice() const;
       
   500 	void ShadowFadeArea(const TRegion* aRegion,TInt8 aShadowMode);
       
   501 	TBool UserClipRect(TRect& aRect);
       
   502 	CGraphicsAccelerator* GraphicsAccelerator();
       
   503 	TUint MemoryOffsetForPixelPitch(TUint aX, TDisplayMode aDisplayMode);
       
   504 	TUint32* GetScanLineOffsetPtr(CBitwiseBitmap* aSrce, TUint32*& aSlptr, TInt aLength, TPoint aPixel,TUint32* aBase, TLineScanningPosition& aLineScanningPosition, TUint aXOffset);
       
   505 	void APIExGetUnderlineMetrics(TAny*& aOutput);
       
   506 	TInt APIExSetShadowColor(TAny* aShadowColor);
       
   507 	TInt APIExGetShadowColor(TAny*& aShadowColor);
       
   508 	TInt FastBlendInterface(const CBitwiseBitmap* aSource, const CBitwiseBitmap* aMask, MFastBlend*& aFastBlend) const;
       
   509 	TInt APIExIsFbsBitGc(TAny*& aIsCFbsBitGc);
       
   510 protected:
       
   511 	/** This function should not be used by externals but must retain the
       
   512 	same ordinal number to maintain BC, thus is exported.*/
       
   513 	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);
       
   514 	
       
   515 private:
       
   516 	IMPORT_C void Reserved_CGraphicsContext_2();
       
   517 
       
   518 	IMPORT_C void Reserved_CBitmapContext_1();
       
   519 	IMPORT_C void Reserved_CBitmapContext_2();
       
   520 	IMPORT_C void Reserved_CBitmapContext_3();
       
   521 	
       
   522 	IMPORT_C virtual void Reserved_CFbsBitGc_1();	
       
   523 	IMPORT_C virtual void Reserved_CFbsBitGc_2();	
       
   524 	IMPORT_C virtual void Reserved_CFbsBitGc_3();	
       
   525 	IMPORT_C virtual void Reserved_CFbsBitGc_4();	
       
   526 	IMPORT_C virtual void Reserved_CFbsBitGc_5();	
       
   527 	
       
   528 private:
       
   529 	CFbsBitGcBitmap iBrushBitmap;
       
   530 	TBool iBrushUsed;
       
   531 	TRgb iBrushColor;
       
   532 	TPoint iBrushOrigin;
       
   533 	TBrushStyle iBrushStyle;
       
   534 	TRect iClipRect;
       
   535 	TRegionFix<1> iDefaultRegion;
       
   536 	const TRegion* iDefaultRegionPtr;
       
   537 	TRect iUserClipRect;
       
   538 	CFbsDevice* iDevice;
       
   539 	TPoint iDitherOrigin;
       
   540 	TInt iDotLength;
       
   541 	TInt iDotMask;
       
   542 	TInt iDotParam;
       
   543 	TInt iDotDirection;
       
   544 	TDrawMode iDrawMode;
       
   545 	TRect iDrawnTo;
       
   546 	CFbsBitGcFont iFont;
       
   547 	TInt iCharJustExcess;
       
   548 	TInt iCharJustNum;
       
   549 	TInt iWordJustExcess;
       
   550 	TInt iWordJustNum;
       
   551 	TPoint iLastPrintPosition;
       
   552 	TPoint iLinePosition;
       
   553 	TPoint iOrigin;
       
   554 	CFbsBitGcExtraData* iFbsBitGcExtraData;
       
   555 	TRgb iPenColor;
       
   556 	TPenStyle iPenStyle;
       
   557 	TSize iPenSize;
       
   558 	TInt8 iShadowMode;
       
   559 	TInt8 iAutoUpdateJustification;
       
   560 	TUint8 iFadeBlackMap;
       
   561 	TUint8 iFadeWhiteMap;
       
   562 	TFontStrikethrough iStrikethrough;
       
   563 	TFontUnderline iUnderline;
       
   564 	TDisplayMode iUserDisplayMode;
       
   565 	RRegion iClippingRegion;
       
   566 #if defined(__ALLOW_FAST_BLEND_DISABLE__)
       
   567 	TBool iFastBlendDisabled;
       
   568 #endif
       
   569 	};
       
   570 
       
   571 inline void CFbsBitGc::SetFadeMode(TBool aFadeMode /*=EFalse*/)
       
   572 	{SetFaded(aFadeMode);}
       
   573 inline void CFbsBitGc::SetFadingParameters(TUint8 aBlackMap /*=0*/)
       
   574 	{SetFadingParameters(aBlackMap,255);}		//255 is the value of white map when not fading
       
   575 
       
   576 #endif