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