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