graphicsdeviceinterface/gdi/inc/GDI.H
changeset 0 5d03bc08d59c
child 26 15986eb6c500
child 36 01a6848ebfd7
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1998-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 __GDI_H__
       
    17 #define __GDI_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <f32file.h>
       
    21 #include <s32std.h>
       
    22 #include <displaymode.h>
       
    23 
       
    24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS	
       
    25 #include <graphics/gdi/glyphsample.h>
       
    26 #include <graphics/gdi/gdiconsts.h>
       
    27 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS	
       
    28 
       
    29 class TOpenFontCharMetrics;
       
    30 class RShapeInfo;
       
    31 class CGraphicsContext;
       
    32 class TTextParameters;
       
    33 
       
    34 /**
       
    35 Number of twips per inch. 
       
    36 @publishedAll
       
    37 @released
       
    38 */
       
    39 const TInt KTwipsPerInch=1440;
       
    40 
       
    41 /**
       
    42 Number of twips per point.
       
    43 @publishedAll
       
    44 @released
       
    45 */
       
    46 const TInt KTwipsPerPoint=20;
       
    47 
       
    48 /**
       
    49 Number of points per inch. 
       
    50 @publishedAll
       
    51 @released
       
    52 */
       
    53 const TInt KPointsPerInch=72;
       
    54 
       
    55 /**
       
    56 Number of twips per cm.
       
    57 @publishedAll
       
    58 @released
       
    59 */
       
    60 const TInt KTwipsPerCm=567;
       
    61 #if defined(__NO_CLASS_CONSTS__)
       
    62 /**
       
    63 A4 paper size in twips. 
       
    64 @publishedAll
       
    65 @released
       
    66 */
       
    67 #define KA4PaperSizeInTwips TSize(11906,16838)
       
    68 
       
    69 /** Legal paper size in twips.
       
    70 @publishedAll
       
    71 @released
       
    72 */
       
    73 #define KLegalPaperSizeInTwips TSize(12240,20160)
       
    74 
       
    75 /**
       
    76 Executive paper size in twips. 
       
    77 @publishedAll
       
    78 @released
       
    79 */
       
    80 #define KExecutivePaperSizeInTwips TSize(10440,15120)
       
    81 /** 
       
    82 Letter paper size in twips. 
       
    83 @publishedAll
       
    84 @released
       
    85 */
       
    86 #define KLetterPaperSizeInTwips TSize(12240,15840)
       
    87 
       
    88 /**
       
    89 Com-10 paper size in twips. 
       
    90 @publishedAll
       
    91 @released
       
    92 */
       
    93 #define KCom_10PaperSizeInTwips TSize(5940,13680)
       
    94 
       
    95 /**
       
    96 Monarch paper size in twips. 
       
    97 @publishedAll
       
    98 @released
       
    99 */
       
   100 #define KMonarchPaperSizeInTwips TSize(5580,10800)
       
   101 
       
   102 /**
       
   103 DL paper size in twips. 
       
   104 @publishedAll
       
   105 @released
       
   106 */
       
   107 #define KDLPaperSizeInTwips TSize(6236,12472)
       
   108 
       
   109 /**
       
   110 C5 paper size in twips. 
       
   111 @publishedAll
       
   112 @released
       
   113 */
       
   114 #define KC5PaperSizeInTwips TSize(9184,12983)
       
   115 #else
       
   116 /**
       
   117 @publishedAll
       
   118 @released
       
   119 */
       
   120 const TSize KA4PaperSizeInTwips(11906,16838);
       
   121 const TSize KLegalPaperSizeInTwips(12240,20160);
       
   122 const TSize KExecutivePaperSizeInTwips(10440,15120);
       
   123 const TSize KLetterPaperSizeInTwips(12240,15840);
       
   124 const TSize KCom_10PaperSizeInTwips(5940,13680);
       
   125 const TSize KMonarchPaperSizeInTwips(5580,10800);
       
   126 const TSize KDLPaperSizeInTwips(6236,12472);
       
   127 const TSize KC5PaperSizeInTwips(9184,12983);
       
   128 #endif
       
   129 
       
   130 
       
   131 /**
       
   132 This enumeration holds the possible panic codes that may be raised 
       
   133 by the GDI API on detecting an unrecoverable error. */
       
   134 enum TGdiPanic
       
   135 	{
       
   136 	/** Not used */
       
   137 	EGdiPanic_Unknown				= 0,
       
   138 	/** One or more of the input parameters to the interface were invalid */
       
   139 	EGdiPanic_InvalidInputParam		= 1,
       
   140 	/** Insufficient text for successful completion of the method */
       
   141 	EGdiPanic_OutOfText				= 2,
       
   142 	/** Internal failure. */
       
   143 	EGdiPanic_Invariant				= 3
       
   144 	};
       
   145 
       
   146 
       
   147 /** 24-bit RGB colour value with 8 bits each for red, green and blue.
       
   148 
       
   149 All Graphics drawing functions are specified in terms of a 32-bit TRgb colour 
       
   150 containing the three colour values plus 8 bits for alpha channel. For hardware which 
       
   151 does not support 24-bit colour, a mapping from TRgb to display colours is 
       
   152 performed. 
       
   153 
       
   154 Generally, the convention for the alpha blending fact is 0 = transparent, 
       
   155 255 = opaque, unless otherwise stated.  The exception to this are the TRgb constructor 
       
   156 taking a single value, where the top byte of the passed in parameter is used for 
       
   157 alpha information and the function Value(), which returns alpha information in the top byte.
       
   158 In both these cases, 0 means opaque, 255 means transparent.
       
   159 
       
   160 The supported display modes are enumerated in the TDisplayMode type. In each 
       
   161 display mode a unique index can represent each physical colours supported, 
       
   162 and which can be mapped onto a full RGB value. The mappings are as follows: 
       
   163 
       
   164 16-colour displays use the EGA colour set: black, white, and then both light 
       
   165 and dark versions of grey, red, green, blue, cyan, magenta and yellow
       
   166 
       
   167 256-colour displays support 216 colours made up of 6x6x6 RGB values, each 
       
   168 containing all possible multiples of 51 for R,G,B values. Additionally, all 
       
   169 remaining 10 shades of pure red, green, blue and grey are represented, by 
       
   170 adding all remaining multiples of 17. This use of 256 colours is sometimes 
       
   171 known as the Netscape colour cube.
       
   172 
       
   173 4096-colour displays effectively support RGB values with 4 bits per primary 
       
   174 colour
       
   175 
       
   176 64k-colour displays effectively support RGB values with 5 bits allocated to 
       
   177 red, 6 to green and 5 to blue
       
   178 
       
   179 16 million-colour displays support true colour with 8 bits allocated to each 
       
   180 primary colour
       
   181 
       
   182 @publishedAll
       
   183 @released
       
   184 @see TDisplayMode
       
   185 @see DynamicPalette */
       
   186 class TRgb
       
   187 	{
       
   188 public:
       
   189 	inline TRgb();
       
   190 	inline TRgb(TUint32 aValue);
       
   191 	inline TRgb(TUint32 aInternalValue, TInt aAlpha);
       
   192 	inline TRgb(TInt aRed,TInt aGreen,TInt aBlue);
       
   193 	inline TRgb(TInt aRed, TInt aGreen, TInt aBlue, TInt aAlpha);
       
   194 	inline TInt Red() const;
       
   195 	inline TInt Green() const;
       
   196 	inline TInt Blue() const;
       
   197 	inline TInt Alpha() const;
       
   198 	IMPORT_C void SetRed(TInt aRed);
       
   199 	IMPORT_C void SetGreen(TInt aGreen);
       
   200 	IMPORT_C void SetBlue(TInt aBlue);
       
   201 	IMPORT_C void SetAlpha(TInt aAlpha);
       
   202 	IMPORT_C static TRgb Gray2(TInt aGray2);
       
   203 	IMPORT_C static TRgb Gray4(TInt aGray4);
       
   204 	IMPORT_C static TRgb Gray16(TInt aGray16);
       
   205 	IMPORT_C static TRgb Gray256(TInt aGray256);
       
   206 	IMPORT_C static TRgb Color16(TInt aColor16);
       
   207 	IMPORT_C static TRgb Color256(TInt aColor256);
       
   208 	IMPORT_C static TRgb Color4K(TInt aColor4K);
       
   209 	IMPORT_C static TRgb Color64K(TInt aColor64K);
       
   210 	IMPORT_C static TRgb Color16M(TInt aColor16M);
       
   211 	IMPORT_C TInt Gray2() const;
       
   212 	IMPORT_C TInt Gray4() const;
       
   213 	IMPORT_C TInt Gray16() const;
       
   214 	IMPORT_C TInt Gray256() const;
       
   215 	IMPORT_C TInt Color16() const;
       
   216 	IMPORT_C TInt Color256() const;
       
   217 	IMPORT_C TInt Color4K() const;
       
   218 	IMPORT_C TInt Color64K() const;
       
   219 	IMPORT_C TInt Color16M() const;
       
   220 	inline TBool operator==(const TRgb& aColor) const;
       
   221 	inline TBool operator!=(const TRgb& aColor) const;
       
   222 	inline TRgb operator~() const;
       
   223 	inline TRgb operator&(const TRgb& aColor);
       
   224 	inline TRgb operator|(const TRgb& aColor);
       
   225 	inline TRgb operator^(const TRgb& aColor);
       
   226 	inline TRgb& operator&=(const TRgb& aColor);
       
   227 	inline TRgb& operator|=(const TRgb& aColor);
       
   228 	inline TRgb& operator^=(const TRgb& aColor);
       
   229 	inline TUint32 Value() const;
       
   230 	inline TUint32 Internal() const;
       
   231 	inline void SetInternal(TUint32 aInternal);
       
   232 	IMPORT_C TInt Difference(const TRgb& aColor) const;
       
   233 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   234 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   235 	IMPORT_C static TRgb Color16MU(TInt a0RGB);
       
   236 	IMPORT_C TInt Color16MU() const;
       
   237 	IMPORT_C static TRgb Color16MA(TUint aARGB);
       
   238 	IMPORT_C TUint Color16MA() const;
       
   239 	IMPORT_C static TRgb Color16MAP(TUint aARGB);
       
   240 	IMPORT_C TUint Color16MAP() const;
       
   241 	IMPORT_C TUint _Color16MAP() const;
       
   242 	IMPORT_C static TRgb _Color16MAP(TUint aARGB);
       
   243 	inline TInt _Gray2() const;
       
   244 	inline TInt _Gray4() const;
       
   245 	inline TInt _Gray16() const;
       
   246 	inline TInt _Gray256() const;
       
   247 	inline TInt _Color4K() const;
       
   248 	inline TInt _Color64K() const;
       
   249 	inline TInt _Color16M() const;
       
   250 	inline TInt _Color16MU() const;
       
   251 	inline TUint _Color16MA() const;
       
   252 	inline static TRgb _Gray2(TInt aGray2);
       
   253 	inline static TRgb _Gray4(TInt aGray4);
       
   254 	inline static TRgb _Gray16(TInt aGray16);
       
   255 	inline static TRgb _Gray256(TInt aGray256);
       
   256 	inline static TRgb _Color4K(TInt aColor4K);
       
   257 	inline static TRgb _Color64K(TInt aColor64K);
       
   258 	inline static TRgb _Color16M(TInt aColor16M);
       
   259 	inline static TRgb _Color16MU(TInt a0RGB);
       
   260 	inline static TRgb _Color16MA(TUint aARGB);
       
   261 private:
       
   262 	TUint32 iValue;
       
   263 	};
       
   264 
       
   265 
       
   266 /**
       
   267 @publishedAll
       
   268 @released
       
   269 */
       
   270 #define KRgbBlack		TRgb(0x000000)
       
   271 #define KRgbDarkGray	TRgb(0x555555)
       
   272 #define KRgbDarkRed		TRgb(0x000080)
       
   273 #define KRgbDarkGreen	TRgb(0x008000)
       
   274 #define KRgbDarkYellow	TRgb(0x008080)
       
   275 #define KRgbDarkBlue	TRgb(0x800000)
       
   276 #define KRgbDarkMagenta	TRgb(0x800080)
       
   277 #define KRgbDarkCyan	TRgb(0x808000)
       
   278 #define KRgbRed			TRgb(0x0000ff)
       
   279 #define KRgbGreen		TRgb(0x00ff00)
       
   280 #define KRgbYellow		TRgb(0x00ffff)
       
   281 #define KRgbBlue		TRgb(0xff0000)
       
   282 #define KRgbMagenta		TRgb(0xff00ff)
       
   283 #define KRgbCyan		TRgb(0xffff00)
       
   284 #define KRgbGray		TRgb(0xaaaaaa)
       
   285 #define KRgbWhite		TRgb(0xffffff)
       
   286 #define KRgbTransparent	TRgb(0x000000,0x00)
       
   287 
       
   288 /** A set of static utility functions to get information about a display mode. 
       
   289 @publishedAll 
       
   290 @released
       
   291 */
       
   292 class TDisplayModeUtils
       
   293 	{
       
   294 public:
       
   295 	IMPORT_C static TBool IsDisplayModeColor(TDisplayMode aDispMode);
       
   296 	IMPORT_C static TBool IsDisplayModeValid(TDisplayMode aDispMode);
       
   297 	IMPORT_C static TInt NumDisplayModeColors(TDisplayMode aDispMode);
       
   298 	IMPORT_C static TInt NumDisplayModeBitsPerPixel(TDisplayMode aDispMode);
       
   299 	};
       
   300 
       
   301 /** Provides user-definable palette support to the GDI.
       
   302 
       
   303 A palette is a user-defined set of colours, which is a subset of the full 
       
   304 range of 24-bit colours. This allows users the advantages of having a low 
       
   305 bpp colour mode whilst being able to specify the colours available in that 
       
   306 mode. To give an example, the EColor16 mode provides a palette of 16 colours 
       
   307 as it provides a mapping between an integer index and a TRgb colour (see the 
       
   308 table EGA Low-colour constants). Only a palette of 16 colour enables you to 
       
   309 change the palette. Palettes are also used to allow 24-bit bitmaps to be stored 
       
   310 in a more compressed form by finding the actual number of different colours 
       
   311 used in the bitmap, creating a palette to allow the mapping of these colours 
       
   312 to a smaller index space, and encoding the bitmaps pixels using indexes 
       
   313 to this new index space. 
       
   314 
       
   315 A palette has a size which is set at its creation and cannot be altered 
       
   316 the number of entries in the palette. Each entry in a palette is a mapping 
       
   317 between that entrys index and a TRgb value. Palette entries can be got 
       
   318 and set at any time between the palettes creation and destruction. The 
       
   319 GDIs palette support also provides functions to find the nearest palette 
       
   320 colour to a requested TRgb colour. 
       
   321 @publishedAll
       
   322 @released
       
   323 */
       
   324 class CPalette : public CBase
       
   325 	{
       
   326 public:
       
   327 	IMPORT_C static CPalette* NewL(TInt aNumberOfEntries);
       
   328 	IMPORT_C static CPalette* NewDefaultL(TDisplayMode aDispMode);
       
   329 	IMPORT_C ~CPalette();
       
   330 	IMPORT_C void Clear();
       
   331 	inline TInt Entries() const;
       
   332 	IMPORT_C TRgb GetEntry(TInt aPaletteIndex) const;
       
   333 	IMPORT_C TRgb NearestEntry(const TRgb& aColor) const;
       
   334 	IMPORT_C TInt NearestIndex(const TRgb& aColor) const;
       
   335 	IMPORT_C void SetEntry(TInt aPaletteIndex,const TRgb& aPaletteEntry);
       
   336 	IMPORT_C void GetDataPtr(TInt aFirstColor,TInt aNumColors,TPtr8& aPtr);
       
   337 protected:
       
   338 	IMPORT_C CPalette();
       
   339 	void ConstructL(TInt aNumberOfEntries);
       
   340 protected:
       
   341 	TRgb* iArray;
       
   342 	TInt iNumEntries;
       
   343 	};
       
   344 
       
   345 
       
   346 /** Enables conversion, in both directions, between a TRgb object and an index 
       
   347 into an arbitrary 256 colour palette. 
       
   348 @publishedAll 
       
   349 @released
       
   350 */
       
   351 class TColor256Util
       
   352 	{
       
   353 public:
       
   354 	IMPORT_C void Construct(const CPalette& aPalette);
       
   355 	IMPORT_C TInt Color256(TRgb aRgb) const;
       
   356 	IMPORT_C void Color256(TUint8* aDestination,const TRgb* aSource,TInt aNumPixels) const;
       
   357 	inline TRgb Color256(TInt aColor256) const;
       
   358 	IMPORT_C static const TColor256Util* Default();
       
   359 public:
       
   360 	/** 256 colour lookup table.
       
   361 	
       
   362 	Each entry is a 32 bit value which corresponds to a TRgb value in the 
       
   363 	palette passed to Construct(). If there are more than 256 colours in the 
       
   364 	palette, the first 256 colours are used in this table. If there are fewer 
       
   365 	than 256 entries, the remaining entries in the table are set to zero. */
       
   366 	TUint32	iColorTable[256];
       
   367 
       
   368 	/** Inverse colour lookup table.
       
   369 	
       
   370 	It has 4096 entries. Each entry is the index of a colour in the palette 
       
   371 	that the object was created with (see Construct()) that most closely 
       
   372 	matches the 4096 degrees of intensity of red, green and blue on a uniform 
       
   373 	16x16x16 colour cube.
       
   374 	
       
   375 	It is called "inverse" because iColorTable maps indices (0..255) to TRgb 
       
   376 	values, but this table maps TRgb values to palette indices. */
       
   377 	TUint8	iInverseColorTable[0x1000];
       
   378 	};
       
   379 
       
   380 
       
   381 /** Linear digital differential analyser.
       
   382 
       
   383 This is used to calculate the pixels which most closely approximate a specified 
       
   384 straight line, or when scaling a bitmap. Note that a line is infinitely thin, 
       
   385 and can only be approximated by pixels with real width and height.
       
   386 
       
   387 Functions are provided for: pixel line traversing; jumping to a rectangle or 
       
   388 co-ordinate 
       
   389 @publishedAll 
       
   390 @released
       
   391 */
       
   392 class TLinearDDA
       
   393 	{
       
   394 public:
       
   395 	/** LDDA Line mode. */
       
   396 	enum TLineMode
       
   397 		{
       
   398 		/** Centres scan-lines in the pixel line */
       
   399 		ECenter,
       
   400 		/** Starts at the beginning of a complete scan line. Used for bitmap 
       
   401 		scaling. */
       
   402 		ELeft
       
   403 		};
       
   404 public:
       
   405 	IMPORT_C TLinearDDA();
       
   406 	IMPORT_C TLinearDDA(const TLinearDDA& aLine);
       
   407 	IMPORT_C void Construct(const TPoint& aStart,const TPoint& aFinish,TLineMode aMode=ECenter);
       
   408 	IMPORT_C TBool SingleStep(TPoint& aPosition);
       
   409 	IMPORT_C TBool SingleScanline(TPoint& aStartPosition,TPoint& aEndPosition);
       
   410 	IMPORT_C TBool NextStep(TPoint& aPosition);
       
   411 	IMPORT_C void JumpToRect(const TRect& aRect);
       
   412 	IMPORT_C void JumpToXCoord(const TInt aXCoord,TInt& aYCoord);
       
   413 	IMPORT_C void JumpToYCoord(TInt& aXCoord,const TInt aYCoord);
       
   414 	IMPORT_C void JumpToXCoord2(TInt aXCoord,TInt& aYCoord);
       
   415 	IMPORT_C void JumpToYCoord2(TInt& aXCoord,TInt aYCoord);
       
   416 private:
       
   417 	void UpdatePosition();
       
   418 private:
       
   419 	enum TLineStatus
       
   420 		{
       
   421 		EInitialised,
       
   422 		ECurrent,
       
   423 		EComplete
       
   424 		};
       
   425 private:
       
   426 	TInt iCount;
       
   427 	TSize iDifference;
       
   428 	TPoint iFinish;
       
   429 	TInt iGradient;
       
   430 	TPoint iInc;
       
   431 	TPoint iPos;
       
   432 	TPoint iStart;
       
   433 	TRect iBoundingRect;
       
   434 	TBool iBoundingRectSet;
       
   435 	TInt16 iInsideX; // boolean, defined as TInt16 to maintain binary compatibility
       
   436 	TInt16 iInsideY; // boolean, defined as TInt16 to maintain binary compatibility
       
   437 	TLineStatus iStatus;
       
   438 	};
       
   439 
       
   440 
       
   441 /**
       
   442 Font posture flags.
       
   443 Fonts can be either upright or italic. 
       
   444 @publishedAll	
       
   445 @released
       
   446 */
       
   447 enum TFontPosture
       
   448 	{
       
   449 	/** Font posture is normal (upright). */
       
   450 	EPostureUpright,
       
   451 	/** Font posture is italic. */
       
   452 	EPostureItalic
       
   453 	};
       
   454 
       
   455 /**
       
   456 Font stroke weight flags. 
       
   457 @publishedAll	
       
   458 @released
       
   459 */
       
   460 enum TFontStrokeWeight
       
   461 	{
       
   462 	/** Font stroke weight is normal. */
       
   463 	EStrokeWeightNormal,
       
   464 	/** Font stroke weight is bold. */
       
   465 	EStrokeWeightBold
       
   466 	};
       
   467 
       
   468 /**
       
   469 Font print position flags.
       
   470 Fonts can be normal, superscript or subscript. 
       
   471 @publishedAll	
       
   472 @released
       
   473 */
       
   474 enum TFontPrintPosition
       
   475 	{
       
   476 	/** Font is normal. */
       
   477 	EPrintPosNormal,
       
   478 	/** Font is superscript. */
       
   479 	EPrintPosSuperscript,
       
   480 	/** Font is subscript. */
       
   481 	EPrintPosSubscript
       
   482 	};
       
   483 
       
   484 /**
       
   485 Font underline flags. 
       
   486 @publishedAll	
       
   487 @released
       
   488 */
       
   489 enum TFontUnderline
       
   490 	{
       
   491 	/** Font is not underlined. */
       
   492 	EUnderlineOff,
       
   493 	/** Font is underlined. */
       
   494 	EUnderlineOn
       
   495 	};
       
   496 
       
   497 /**
       
   498 Font strike-through flags. 
       
   499 @publishedAll	
       
   500 @released
       
   501 */
       
   502 enum TFontStrikethrough
       
   503 	{
       
   504 	/** Font is not struck-through. */
       
   505 	EStrikethroughOff,
       
   506 	/** Font is struck-through. */
       
   507 	EStrikethroughOn
       
   508 	};
       
   509 
       
   510 /**
       
   511 The maximum length of a typeface name (in characters). 
       
   512 @publishedAll	
       
   513 @released
       
   514 */
       
   515 const TInt KMaxTypefaceNameLength=0x18;
       
   516 
       
   517 
       
   518 /** Typeface name and attributes.
       
   519 
       
   520 This class identifies a typeface by name, and contains the combination of 
       
   521 attributes of the typeface. These attributes define whether it is a symbol 
       
   522 typeface, whether the typeface is proportional, and whether it is serif or 
       
   523 sans-serif. 
       
   524 
       
   525 The combination of attributes for a typeface are stored in a bitmask, with 
       
   526 the various bits indicating different attributes. The bitmask is calculated 
       
   527 for any particular attribute combination by ORing the enumerated value for 
       
   528 each individual attribute. 
       
   529 @publishedAll 
       
   530 @released
       
   531 */
       
   532 class TTypeface
       
   533     {
       
   534 public:
       
   535 	enum
       
   536 		{
       
   537 		/** Typeface is a proportional typeface (e.g. Swiss)
       
   538 		*/
       
   539 		EProportional = 1,
       
   540 		/** Typeface is a serif typeface (e.g. Times)
       
   541 		*/
       
   542 		ESerif = 2,
       
   543 		/** Typeface is a symbol typeface (e.g. Symbol)
       
   544 		*/
       
   545 		ESymbol = 4,
       
   546 		};
       
   547 public:
       
   548 	IMPORT_C TTypeface();
       
   549 	IMPORT_C TBool operator==(const TTypeface& aTypeface) const;
       
   550 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   551 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   552 	IMPORT_C void SetAttributes(TInt aAttributes);
       
   553 	IMPORT_C void SetIsProportional(TBool aIsProportional);
       
   554 	IMPORT_C void SetIsSerif(TBool aIsSerif);
       
   555 	IMPORT_C void SetIsSymbol(TBool aIsSymbol);
       
   556 	IMPORT_C TInt Attributes() const;
       
   557 	IMPORT_C TBool IsProportional() const;
       
   558 	IMPORT_C TBool IsSerif() const;
       
   559 	IMPORT_C TBool IsSymbol() const;
       
   560 	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
       
   561 	IMPORT_C void SetScriptTypeForMetrics(TInt aScript);
       
   562 	IMPORT_C TInt ScriptTypeForMetrics() const;
       
   563 private:
       
   564 	void ResetAttributes();
       
   565 	void ResetScriptType();
       
   566 public:
       
   567 	/** The typeface name. */
       
   568     TBufC<KMaxTypefaceNameLength> iName;
       
   569 private:
       
   570     TUint32 iFlags;
       
   571     };
       
   572 
       
   573 
       
   574 /**
       
   575 An enumerated type for the format of a glyph bitmap. This type is currently 
       
   576 used to indicate whether glyph bitmaps for scalable fonts are drawn anti-aliased. 
       
   577 Additional values may be defined in the future.
       
   578 
       
   579 @see TFontStyle::SetBitmapType()
       
   580 @see CFbsTypefaceStore::SetDefaultBitmapType() 
       
   581 @publishedAll
       
   582 @released	
       
   583 */
       
   584 enum TGlyphBitmapType
       
   585 	{
       
   586 	/** The font store's default glyph bitmap format is used. */
       
   587 	EDefaultGlyphBitmap = 0,
       
   588 	/** The standard monochrome format: no anti-aliasing, 1 bit per pixel, 
       
   589 	run-length encoded. */
       
   590 	EMonochromeGlyphBitmap,
       
   591 	/** Standard 8-bits-per-pixel with anti-aliasing. */
       
   592 	EAntiAliasedGlyphBitmap,
       
   593 	/** The format used when sub-pixel font rendering is used. */
       
   594 	ESubPixelGlyphBitmap,
       
   595 	/** The format used when outline and shadow font rendering is used. 
       
   596 
       
   597 	If the raterizer supports the outline and shadow fonts, it will set the bitmaptype as 
       
   598 	EFourColourBlendGlyphBitmap but only when glyph bitmap type is set as EAntiAliasedGlyphBitmap and 
       
   599 	when any of the EDropShadow or EOutline effect is on. Only rasterizer providers can use this enum.
       
   600 	*/
       
   601 	EFourColourBlendGlyphBitmap,
       
   602 	/**
       
   603 	This is used for glyphs, and not fonts, and is needed to inform the font drawing routines
       
   604 	that the character should be drawn using the overall font setting. 
       
   605 	For Internal Use Only.
       
   606 	*/
       
   607 	EGlyphBitmapTypeNotDefined,
       
   608 	/**
       
   609 	This is used to inform the rasterizer that the best match should be
       
   610 	found for the bitmap type based upon its knowledge.
       
   611 	For Internal Use Only.
       
   612 	*/
       
   613 	EAntiAliasedOrMonochromeGlyphBitmap,
       
   614 	};
       
   615 
       
   616 /**
       
   617 Defines a set of font effects flags.
       
   618 
       
   619 @publishedAll 
       
   620 @released
       
   621 WARNING: This Class is for use by system/UI software ONLY.
       
   622 */
       
   623 NONSHARABLE_CLASS(FontEffect)
       
   624 	{
       
   625 public:
       
   626 	enum TEffect
       
   627 		{
       
   628 		ENone			= 0x0,		// No effects.
       
   629 		EAlgorithmicBold= 0x10,		// Font is algorithmic bold (a.k.a pseudo bold.)
       
   630 		EDropShadow		= 0x20,		// Font has a drop shadow.
       
   631 		EOutline		= 0x40,		// Font is an outline font.
       
   632 		EEmbossed		= 0x80,		// Font is embossed.
       
   633 		EEngraved		= 0x100,	// Font is engraved.
       
   634 		ESoftEdge		= 0x200,	// Font is soft edged.
       
   635 		EReserved1		= 0x400,	// Reserved for Symbian use.
       
   636 		EReserved2		= 0x800,	// Reserved for Symbian use.
       
   637 		EReserved3		= 0x1000,	// Reserved for Symbian use.
       
   638 		EReserved4		= 0x2000,	// Reserved for Symbian use.
       
   639 		EReserved5		= 0x4000,	// Reserved for Symbian use.
       
   640 		EReserved6		= 0x8000,	// Reserved for Symbian use.
       
   641 		};
       
   642 public:
       
   643 	IMPORT_C static TBool IsEffectOn(TEffect aEffect, TUint32 aFontEffect);
       
   644 	IMPORT_C static void SetEffect(TEffect aEffect, TBool aOn, TUint32& aFontEffect);
       
   645 	};
       
   646 
       
   647 /** Encapsulates a font style. 
       
   648 
       
   649 The font style information is comprised of:
       
   650 
       
   651 the posture of the font upright or italic
       
   652 
       
   653 the stroke weight of the font  normal or bold
       
   654 
       
   655 the print position of the font normal, subscript or superscript
       
   656 
       
   657 Note that the underline and strike-through attributes are not included in 
       
   658 this class, but are set in the graphics context.
       
   659 
       
   660 @see CGraphicsContext::SetUnderlineStyle()
       
   661 @see CGraphicsContext::SetStrikethroughStyle() 
       
   662 @publishedAll
       
   663 @released
       
   664 */
       
   665 class TFontStyle
       
   666 	{
       
   667 public:
       
   668 	IMPORT_C TFontStyle();
       
   669 	IMPORT_C TFontStyle(TFontPosture aPost,TFontStrokeWeight aStrWgt,TFontPrintPosition aPrintPos);
       
   670 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   671 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   672 	IMPORT_C TFontPosture Posture() const;
       
   673 	IMPORT_C TFontStrokeWeight StrokeWeight() const;
       
   674 	IMPORT_C TFontPrintPosition PrintPosition() const;
       
   675 	IMPORT_C void SetPosture(TFontPosture aPosture);
       
   676 	IMPORT_C void SetStrokeWeight(TFontStrokeWeight aStrokeWeight);
       
   677 	IMPORT_C void SetPrintPosition(TFontPrintPosition aPrintPosition);
       
   678 	inline TGlyphBitmapType BitmapType() const;
       
   679 	inline void SetBitmapType(TGlyphBitmapType aBitmapType);
       
   680 	IMPORT_C TBool operator==(const TFontStyle& aFontStyle) const;
       
   681 	IMPORT_C TUint32 Effects() const;
       
   682 	IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const;
       
   683 	IMPORT_C void SetEffects(TUint32 aEffects);
       
   684 	IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn);
       
   685 private:
       
   686 	enum
       
   687 		{
       
   688 		EItalic=0x1,
       
   689 		EBold=0x2,
       
   690 		ESuper=0x4,
       
   691 		ESub=0x8
       
   692 		};
       
   693 private:
       
   694 	TUint32 iFlags; // bitmap type - 16 bits (high), font effects - 12 bits (middle), style - 4 bits (low)
       
   695 	TAny* iReserved1;
       
   696 	TAny* iReserved2;
       
   697 	};
       
   698 
       
   699 
       
   700 
       
   701 /**
       
   702 Specifies the font specification in device independent terms.
       
   703 @publishedAll 
       
   704 @released
       
   705 */
       
   706 class TFontSpec
       
   707 	{
       
   708 public:
       
   709 	IMPORT_C TFontSpec();
       
   710 	IMPORT_C TFontSpec(const TDesC& aTypefaceName,TInt aHeight);
       
   711 	IMPORT_C TBool operator==(const TFontSpec& aFontSpec) const;
       
   712 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   713 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   714 	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
       
   715 	IMPORT_C TInt ScriptTypeForMetrics() const;
       
   716 public:
       
   717 	/** The typeface. */
       
   718 	TTypeface iTypeface;
       
   719 	/** The height of the typeface (in twips). */
       
   720 	TInt iHeight;
       
   721 	/** The font style of the typeface. */
       
   722 	TFontStyle iFontStyle;
       
   723 	};
       
   724 
       
   725 
       
   726 
       
   727 /** Typeface family support information.
       
   728 
       
   729 This data-only class includes the name and attributes of a typeface, how many 
       
   730 font heights are available, its minimum and maximum heights, and whether or 
       
   731 not it is scaleable  a typeface is scaleable if it supports heights at 
       
   732 fixed intervals between the minimum and maximum heights. 
       
   733 @publishedAll 
       
   734 @released
       
   735 */
       
   736 class TTypefaceSupport
       
   737     {
       
   738 public:
       
   739 	/** The name and attributes of the typeface. */
       
   740     TTypeface iTypeface;
       
   741 	/** The number of distinct font heights available in the typeface. */
       
   742     TInt iNumHeights;
       
   743 	/** The typeface's minimum font height, in twips. */
       
   744     TInt iMinHeightInTwips;
       
   745 	/** The typeface's maximum font height, in twips. */
       
   746     TInt iMaxHeightInTwips;
       
   747 	/** Whether the typeface is scaleable. ETrue if it is scaleable, otherwise 
       
   748 	EFalse. */
       
   749     TBool iIsScalable; // supports heights from min to max at fixed interval
       
   750     };
       
   751 
       
   752 /**
       
   753 The percentage used to multiply a normal font height when calculating its 
       
   754 superscript or subscript height. 
       
   755 @publishedAll	
       
   756 @released
       
   757 */
       
   758 const TInt KSuperSubScalingPercentage=67;
       
   759 
       
   760 /**
       
   761 The percentage of a font height used to calculate its baseline offset for a 
       
   762 superscript print position. 
       
   763 @publishedAll	
       
   764 @released
       
   765 */
       
   766 const TInt KSuperscriptOffsetPercentage=-28;
       
   767 
       
   768 /**
       
   769 The percentage of a font height used to calculate its baseline offset for a 
       
   770 subscript print position. 
       
   771 @publishedAll	
       
   772 @released
       
   773 */
       
   774 const TInt KSubscriptOffsetPercentage=14;
       
   775 
       
   776 class CFont;
       
   777 
       
   778 /** Typeface store abstract base interface.
       
   779 
       
   780 This class provides the interface to a store for typefaces.
       
   781 
       
   782 See also CFontStore. 
       
   783 @publishedAll
       
   784 @released
       
   785 */
       
   786 class CTypefaceStore : public CBase
       
   787 	{
       
   788 public:
       
   789 	IMPORT_C ~CTypefaceStore();
       
   790 
       
   791 	/**
       
   792 	Gets the font which is the nearest to the given font specification.
       
   793 
       
   794 	When the font is no longer needed, call @c ReleaseFont().
       
   795 
       
   796 	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips() 
       
   797 	yielding (virtually) the same result. However clients are strongly encouraged to use the new
       
   798 	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
       
   799 	character within any given text string will fit within the given amount of twips, whereas the design 
       
   800 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
   801 	may result in cropped characters.
       
   802 
       
   803 	@param aFont On return, contains a pointer to the nearest font.
       
   804 	@param aFontSpec The specification of the font to be matched.
       
   805 	@return KErrNone if successful; a system-wide error code otherwise.
       
   806 	@publishedAll
       
   807 	@deprecated Use GetNearestFontToDesignHeightInTwips
       
   808 	*/
       
   809 	virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
       
   810 
       
   811 	/**
       
   812 	Gets the font which is the nearest to the given font specification.
       
   813 	
       
   814 	When the font is no longer needed, call @c ReleaseFont().
       
   815 
       
   816 	This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the 
       
   817 	same result. However clients are strongly encouraged to use the new
       
   818 	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
       
   819 	character within any given text string will fit within the given amount of twips, whereas the design 
       
   820 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
   821 	may result in cropped characters.
       
   822 
       
   823 	@param aFont On return, contains a pointer to the nearest font.
       
   824 	@param aFontSpec The specification of the font to be matched.
       
   825 	@return KErrNone if successful; a system-wide error code otherwise.
       
   826 	@publishedAll
       
   827 	@released
       
   828 	*/
       
   829 	virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
       
   830 	
       
   831 	/**
       
   832 	Gets the font which is the nearest to the given font specification.
       
   833 	
       
   834 	When the font is no longer needed, call @c ReleaseFont().
       
   835 
       
   836 	The font and bitmap server returns a pointer to the nearest matching font 
       
   837 	from those available. Matches to max height of font - this does its best 
       
   838 	to return a font that will fit within the maximum height specified (but 
       
   839 	note that variations due to hinting algorithms may rarely result in this 
       
   840 	height being exceeded by up to one pixel). Problems can also be 
       
   841 	encountered with bitmap fonts where the typeface exists but doesn't have 
       
   842 	a font small enough.
       
   843 
       
   844 	@param aFont On return, contains a pointer to the nearest font.
       
   845 	@param aFontSpec The specification of the font to be matched.
       
   846 	@param aMaxHeight The maximum height within which the font must fit.
       
   847 	@return KErrNone if successful; a system-wide error code otherwise.
       
   848 	@publishedAll
       
   849 	@released
       
   850 	*/
       
   851 	virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) = 0;
       
   852 
       
   853 	/** Gets the number of typefaces supported by the typeface store.
       
   854 	
       
   855 	@return The number of supported typefaces. */
       
   856 	virtual TInt NumTypefaces() const=0;
       
   857 
       
   858 	/** Gets typeface information for a specified typeface index.
       
   859  
       
   860  	This information is returned in aTypefaceSupport, and
       
   861 	includes the typeface name and typeface attributes, the number of font
       
   862  	heights, the maximum and minimum font heights, and whether it is a
       
   863 	scaleable typeface.
       
   864  
       
   865  	@param aTypefaceSupport On return, if the function executed successfully, 
       
   866  	this object contains the typeface information.
       
   867   	@param aTypefaceIndex A typeface index number, in the range: zero to
       
   868              (NumTypefaces() - 1). */
       
   869 	virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
       
   870 
       
   871 	/** Gets the height of the font with specified height and typeface indices, 
       
   872 	in twips.
       
   873 	
       
   874 	The value returned is rounded up or down to the nearest font height in twips.
       
   875 	
       
   876 	@param aTypefaceIndex A typeface index number, in the range: 0 to 
       
   877 	(NumTypefaces() - 1). 
       
   878 	@param aHeightIndex A font height index number.
       
   879 	@return The height of the font, in twips. */
       
   880 	virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
       
   881 	IMPORT_C void ReleaseFont(CFont* aFont);
       
   882 	IMPORT_C static TInt BaselineOffset(TInt aHeight,TFontPrintPosition aPos);
       
   883 	IMPORT_C static TInt SuperSubHeight(TInt aHeight,TFontPrintPosition aPos);
       
   884 protected:
       
   885 	IMPORT_C CTypefaceStore();
       
   886 	IMPORT_C void ConstructL();
       
   887 	IMPORT_C void AddFontL(CFont* aFont);
       
   888 	IMPORT_C TBool IncrementFontCount(const CFont* aFont);
       
   889 private:
       
   890 	TBool FindFont(const CFont* aFont, TInt& aIdx) const;
       
   891 	NONSHARABLE_CLASS(TFontAccess)
       
   892 	/**
       
   893 	Pairs a font with a count of how many clients of the typeface store 
       
   894 	are accessing that font. 
       
   895     */
       
   896 		{
       
   897 	public:
       
   898 		/** A device specific font. */
       
   899 		CFont* iFont;
       
   900 		/** The number of clients accessing the font. */
       
   901 		TInt iAccessCount;
       
   902 		};
       
   903 protected:
       
   904 	/** A list of fonts accessed by clients of the typeface store, which pairs 
       
   905 	a font with a count of the number of clients accessing the font.
       
   906 	
       
   907 	Implemented as an array of TFontAccess objects.
       
   908 	
       
   909 	An object is added to this array for every font accessed. If the font is 
       
   910 	released by all clients, and the access count drops to zero, the font is 
       
   911 	removed from the list. */
       
   912 	CArrayFixFlat<TFontAccess>* iFontAccess;
       
   913 	};
       
   914 
       
   915 /** The maximum number of entries in the font cache.
       
   916 
       
   917 @see CFontCache */
       
   918 const TInt KMaxFontCacheEntries=32;
       
   919 
       
   920 /** Font cache. 
       
   921 
       
   922 When a CFont* needs to be found for a particular TFontSpec, the cache can 
       
   923 be searched to see if the TFontSpec is already in the cache. If the TFontSpec 
       
   924 is in the cache, its corresponding CFont* can be returned. Otherwise 
       
   925 GetNearestFontInTwips() must be used to search all of the available fonts for 
       
   926 the nearest CFont- a procedure which takes much longer than a simple cache
       
   927 search.
       
   928 
       
   929 The current font cache should be destroyed and a new cache created whenever 
       
   930 the zoom factor or device map changes, as these changes break the relation 
       
   931 between CFont and TFontSpec. 
       
   932 @publishedAll
       
   933 @released
       
   934 */
       
   935 class CFontCache : public CBase
       
   936 	{
       
   937 public:
       
   938 	IMPORT_C CFontCache();
       
   939 	IMPORT_C CFontCache(TInt aMaxEntries);
       
   940 	IMPORT_C ~CFontCache();
       
   941 	IMPORT_C CFont* Search(const TFontSpec& aFontSpec);
       
   942 	IMPORT_C CFont* AddEntryL(CFont* aFont,const TFontSpec& aFontSpec);
       
   943 	IMPORT_C CFont* RemoveFirstEntry();
       
   944 public:
       
   945 	/** The number of cache hits since the font cache was created i.e. 
       
   946 	successful results from CFontCache::Search(). */
       
   947 	TInt iNumHits;
       
   948 	/** The number of cache misses since the font cache was created i.e. 
       
   949 	unsuccessful results from CFontCache::Search(). */
       
   950 	TInt iNumMisses;
       
   951 private:
       
   952 	class CFontCacheEntry : public CBase
       
   953 		{
       
   954 	public:
       
   955 		CFontCacheEntry(CFont* aFont,const TFontSpec& aFontSpec,CFontCacheEntry* aNext);
       
   956 	public:
       
   957 		CFont* iFont;
       
   958 		TFontSpec iSpec;
       
   959 		CFontCacheEntry* iNext;
       
   960 		};
       
   961 private:
       
   962 	TInt iNumEntries;
       
   963 	TInt iMaxEntries;
       
   964 	CFontCacheEntry* iFirst;
       
   965 	};
       
   966 
       
   967 /** Interface class for mapping between twips and device-specific units (pixels).
       
   968 
       
   969 TZoomFactor is derived from MGraphicsDeviceMap.
       
   970 
       
   971 @see CGraphicsDevice
       
   972 @see TZoomFactor 
       
   973 @publishedAll
       
   974 @released
       
   975 */
       
   976 class MGraphicsDeviceMap
       
   977     {
       
   978 public:
       
   979 	IMPORT_C MGraphicsDeviceMap();
       
   980 	IMPORT_C virtual ~MGraphicsDeviceMap();
       
   981 	IMPORT_C TPoint TwipsToPixels(const TPoint& aTwipPoint) const;
       
   982 	IMPORT_C TRect TwipsToPixels(const TRect& aTwipRect) const;
       
   983 	IMPORT_C TPoint PixelsToTwips(const TPoint& aPixelPoint) const;
       
   984 	IMPORT_C TRect PixelsToTwips(const TRect& aPixelRect) const;
       
   985 
       
   986 	/** Converts a horizontal dimension from twips to pixels.
       
   987 	
       
   988 	An implementation is supplied by a derived class.
       
   989 	
       
   990 	@param aTwips A horizontal dimension of a device in twips. 
       
   991 	@return A horizontal dimension of a device in pixels. */
       
   992 	virtual TInt HorizontalTwipsToPixels(TInt aTwips) const=0;
       
   993 
       
   994 	/** Converts a vertical dimension from twips to pixels.
       
   995 	
       
   996 	An implementation is supplied by a derived class.
       
   997 	
       
   998 	@param aTwips A vertical dimension of a device in twips. 
       
   999 	@return A vertical dimension of a device in pixels. */
       
  1000 	virtual TInt VerticalTwipsToPixels(TInt aTwips) const=0;
       
  1001 
       
  1002 	/** Converts a horizontal dimension from pixels to twips.
       
  1003 	
       
  1004 	An implementation is supplied by a derived class.
       
  1005 	
       
  1006 	@param aPixels A horizontal dimension of a device in pixels. 
       
  1007 	@return A horizontal dimension of a device in twips. */
       
  1008 	virtual TInt HorizontalPixelsToTwips(TInt aPixels) const=0;
       
  1009 
       
  1010 	/** Converts a vertical dimension from pixels to twips.
       
  1011 	
       
  1012 	An implementation is supplied by a derived class.
       
  1013 	
       
  1014 	@param aPixels A vertical dimension of a device in pixels. 
       
  1015 	@return A vertical dimension of a device in twips. */
       
  1016 	virtual TInt VerticalPixelsToTwips(TInt aPixels) const=0;
       
  1017 
       
  1018 	/**
       
  1019 	Gets the font which is the nearest to the given font specification.
       
  1020 
       
  1021 	When the font is no longer needed, call @c ReleaseFont().
       
  1022 
       
  1023 	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips() 
       
  1024 	yielding (virtually) the same result. However clients are strongly encouraged to use the new
       
  1025 	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
       
  1026 	character within any given text string will fit within the given amount of twips, whereas the design 
       
  1027 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
  1028 	may result in cropped characters.
       
  1029 
       
  1030 	@param aFont On return, contains a pointer to the nearest font.
       
  1031 	@param aFontSpec The specification of the font to be matched.
       
  1032 	@return KErrNone if successful; a system-wide error code otherwise.
       
  1033 	@publishedAll
       
  1034 	@deprecated Use GetNearestFontToDesignHeightInTwips
       
  1035 	*/
       
  1036 	virtual TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec)=0;
       
  1037 
       
  1038 	/**
       
  1039 	Gets the font which is the nearest to the given font specification.
       
  1040 	
       
  1041 	When the font is no longer needed, call @c ReleaseFont().
       
  1042 
       
  1043 	This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the 
       
  1044 	same result. However clients are strongly encouraged to use the new
       
  1045 	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
       
  1046 	character within any given text string will fit within the given amount of twips, whereas the design 
       
  1047 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
  1048 	may result in cropped characters.
       
  1049 
       
  1050 	@param aFont On return, contains a pointer to the nearest font.
       
  1051 	@param aFontSpec The specification of the font to be matched.
       
  1052 	@return KErrNone if successful; a system-wide error code otherwise.
       
  1053 	@publishedAll
       
  1054 	@released
       
  1055 	*/
       
  1056 	virtual TInt GetNearestFontToDesignHeightInTwips(
       
  1057 		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/) { return KErrNotSupported; }
       
  1058 
       
  1059 	/**
       
  1060 	Gets the font which is the nearest to the given font specification.
       
  1061 
       
  1062 	When the font is no longer needed, call @c ReleaseFont().
       
  1063 
       
  1064 	The font and bitmap server returns a pointer to the nearest matching font 
       
  1065 	from those available. Matches to max height of font - this does its best 
       
  1066 	to return a font that will fit within the maximum height specified (but 
       
  1067 	note that variations due to hinting algorithms may rarely result in this 
       
  1068 	height being exceeded by up to one pixel). Problems can also be 
       
  1069 	encountered with bitmap fonts where the typeface exists but doesn't have 
       
  1070 	a font small enough.
       
  1071 
       
  1072 	@param aFont On return, contains a pointer to the nearest font.
       
  1073 	@param aFontSpec The specification of the font to be matched.
       
  1074 	@param aMaxHeight The maximum height within which the font must fit.
       
  1075 	This overrides the height specified in aFontSpec.
       
  1076 	@return KErrNone if successful; a system-wide error code otherwise.
       
  1077 	@publishedAll
       
  1078 	@released
       
  1079 	*/
       
  1080 	virtual TInt GetNearestFontToMaxHeightInTwips(
       
  1081 		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/, TInt /*aMaxHeight*/) { return KErrNotSupported; }
       
  1082 
       
  1083 	/** Releases the specified font.
       
  1084 	
       
  1085 	It is used to indicate that the specified font is no longer needed for use 
       
  1086 	by the device map. As fonts can be shared between applications, this 
       
  1087 	function does not delete the copy of the font from RAM unless the font was 
       
  1088 	only being used by this particular device map.
       
  1089 	
       
  1090 	An implementation is supplied by a derived class.
       
  1091 	
       
  1092 	@param aFont A pointer to the font to be released. */
       
  1093 	virtual void ReleaseFont(CFont* aFont)=0;
       
  1094     };
       
  1095 
       
  1096 class CGraphicsContext;
       
  1097 
       
  1098 /** Specifies the interface for concrete device classes.
       
  1099 
       
  1100 It holds information on the capabilities and attributes of a graphics device. 
       
  1101 The CBitmapDevice and CPrinterDevice classes are derived from CGraphicsDevice.
       
  1102 
       
  1103 @see CGraphicsDevice
       
  1104 @see CPrinterDevice 
       
  1105 @publishedAll
       
  1106 @released
       
  1107 */
       
  1108 class CGraphicsDevice : public CBase , public MGraphicsDeviceMap
       
  1109     {
       
  1110 public:
       
  1111 	/** Gets the display mode of the device.
       
  1112 	
       
  1113 	@return The display mode of the device. */
       
  1114 	virtual TDisplayMode DisplayMode() const=0;
       
  1115 
       
  1116 	/** Gets the size of the device area in pixels.
       
  1117 	
       
  1118 	@return The width and height of the device area, in pixels */
       
  1119 	virtual TSize SizeInPixels() const=0;
       
  1120 
       
  1121 	/** Gets the size of the device area in twips.
       
  1122 	
       
  1123 	@return The width and height of the device area, in twips */
       
  1124 	virtual TSize SizeInTwips() const=0;
       
  1125 
       
  1126  	/** Creates a graphics context for the device.
       
  1127 	
       
  1128 	@param aGC On return, contains a pointer to the created graphics context. 
       
  1129 	@return KErrNone, if successful; otherwise, another of the system-wide error 
       
  1130 	codes. */
       
  1131     virtual TInt CreateContext(CGraphicsContext*& aGC)=0;
       
  1132 
       
  1133 	/** Gets the number of typefaces supported by the graphics device.
       
  1134 	
       
  1135 	@return The number of typefaces supported. */
       
  1136     virtual TInt NumTypefaces() const=0;
       
  1137 
       
  1138  	/** Gets typeface information for a specified typeface.
       
  1139 	
       
  1140 	This information is returned in aTypefaceSupport, and includes:
       
  1141 	
       
  1142 	the typeface name and typeface attributes
       
  1143 	
       
  1144 	the number of font heights
       
  1145 	
       
  1146 	the maximum and minimum font heights
       
  1147 	
       
  1148 	whether it is a scalable typeface
       
  1149 	
       
  1150 	@param aTypefaceSupport On return, contains the typeface information. 
       
  1151 	@param aTypefaceIndex A typeface index number, in the range: zero to 
       
  1152 	(NumTypefaces() - 1). 
       
  1153 	@see NumTypefaces() */
       
  1154     virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
       
  1155 
       
  1156 	/** Get the height of a font in twips.
       
  1157 	
       
  1158 	The font is identified by typeface and height.
       
  1159 	
       
  1160 	The value returned is rounded up or down to the nearest font height in twips.
       
  1161 	
       
  1162 	@param aTypefaceIndex An index identifying the typeface, in the range: 0 
       
  1163 	to (NumTypefaces() - 1). 
       
  1164 	@param aHeightIndex An index identifying the font height, in the range: 0 
       
  1165 	to (iNumHeights - 1). Note that iNumHeights is in the TTypefaceSupport 
       
  1166 	object returned by TypefaceSupport(). 
       
  1167 	@return The height of the font, in twips. */
       
  1168 	virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
       
  1169 
       
  1170 	/** Gets the palette attributes of the device.
       
  1171 	
       
  1172 	@param aModifiable On return, holds information on whether or not the device's 
       
  1173 	palette is modifiable (ETrue) or fixed (EFalse). 
       
  1174 	@param aNumEntries On return, holds the number of entries in the device's 
       
  1175 	palette. */
       
  1176 	virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const=0;
       
  1177 
       
  1178 	/** Sets the device's palette.
       
  1179 	
       
  1180 	Setting the palette is only possible if the device has a modifiable palette, 
       
  1181 	which can be determined by calling PaletteAttributes().
       
  1182 	
       
  1183 	@param aPalette The new palette for the device. */
       
  1184 	virtual void SetPalette(CPalette* aPalette)=0;
       
  1185 
       
  1186 	/** Gets the device's current palette.
       
  1187 	
       
  1188 	This function is only supported if the device has a modifiable palette, 
       
  1189 	which can be determined by calling PaletteAttributes().
       
  1190 	
       
  1191 	@param aPalette On return, holds the device's current palette.
       
  1192 	@return KErrNone, if successful; otherwise, another of the system-wide error 
       
  1193 	codes. */
       
  1194 	virtual TInt GetPalette(CPalette*& aPalette) const=0;
       
  1195     };
       
  1196 
       
  1197 
       
  1198 /** 
       
  1199 Code section range information. 
       
  1200 
       
  1201 A code section defines the bitmaps for characters in a specified range -
       
  1202 the range is stored in objects of this type. 
       
  1203 @publishedAll
       
  1204 @deprecated 	This is not used anywhere in version 6.0.
       
  1205 */
       
  1206 class TCodeSection
       
  1207 	{
       
  1208 public:
       
  1209 	/** The beginning of the range. */
       
  1210 	TInt iStart;
       
  1211 	/** The end of the range. */
       
  1212 	TInt iEnd;
       
  1213 	};
       
  1214 
       
  1215 /**
       
  1216 WARNING: this Class is for internal use ONLY.  Compatibility is not guaranteed in future releases.
       
  1217 UIDs corresponding to the CFont API extension functions
       
  1218 @internalTechnology
       
  1219 */
       
  1220 const TUid KFontCapitalAscent	= {0x1020498E};
       
  1221 const TUid KFontMaxAscent		= {0x10204B10};
       
  1222 const TUid KFontStandardDescent	= {0x10204B11};
       
  1223 const TUid KFontMaxDescent		= {0x10205AFC};
       
  1224 const TUid KFontLineGap			= {0x10204B12};
       
  1225 
       
  1226 
       
  1227 
       
  1228 /** Abstract font interface.
       
  1229 
       
  1230 The CFont class provides a device-independent interface to a device-dependent 
       
  1231 font usually obtained from a call to GetNearestFont...() on a graphics device. 
       
  1232 It is used as a handle in CGraphicsContext::UseFont() and to obtain 
       
  1233 device-dependent information about the font - notably the pixel width of a text 
       
  1234 string.
       
  1235 
       
  1236 @see CFbsFont
       
  1237 @see CGraphicsContext::UseFont() 
       
  1238 @publishedAll 
       
  1239 @released
       
  1240 */
       
  1241 class CFont : public CBase
       
  1242 	{
       
  1243 	friend class CTypefaceStore;
       
  1244 public:
       
  1245 
       
  1246 	/** Text direction flags.
       
  1247 
       
  1248 	This enum is used in TMeasureTextInput and determines whether the text is 
       
  1249 	drawn horizontally or vertically. Note: text is drawn vertically in some 
       
  1250 	styles of Japanese, etc.
       
  1251 
       
  1252 	@see TMeasureTextInput */
       
  1253 	enum TTextDirection
       
  1254 		{
       
  1255 	/** Text is drawn horizontally. */
       
  1256  		/** Text is drawn horizontally. */
       
  1257    		EHorizontal,
       
  1258  		/** Text is drawn vertically. */
       
  1259 		EVertical
       
  1260 		};
       
  1261 
       
  1262 	/** Complicated parameter block used for contextual glyph selection, 
       
  1263 	ligature creation and diacritic placement when drawing text in complex 
       
  1264 	scripts
       
  1265 
       
  1266 	This class declares a constructor, another scoped class, and several other 
       
  1267 	enums. However this class is unlikely to be useful to third party developers.
       
  1268 
       
  1269 	@see CFont::GetCharacterPosition()
       
  1270 	@see CFont::GetCharacterPosition2()
       
  1271 	@publishedAll
       
  1272 	@released
       
  1273 	*/
       
  1274 	class TPositionParam
       
  1275 		{
       
  1276 	public:
       
  1277 		/** Standard constructor. */
       
  1278 		TPositionParam():
       
  1279 			iDirection(EHorizontal),
       
  1280 			iFlags(0),
       
  1281 			iPosInText(0),
       
  1282 			iOutputGlyphs(0)
       
  1283 			{
       
  1284 			}
       
  1285 
       
  1286 		enum
       
  1287 			{
       
  1288 			EMaxInputChars = 18,	// ligatures cannot be made from more than 18 components
       
  1289 			EMaxOutputGlyphs = 8	// output can consist of up to 8 characters (one base and 7 combining characters)
       
  1290 			};
       
  1291 
       
  1292 		/**Flags for TPositionParam::iFlags. */
       
  1293 		enum TFlags
       
  1294 			{
       
  1295 			/** Input text is logically ordered not visually ordered. */
       
  1296 			EFLogicalOrder = 1
       
  1297 			};
       
  1298 
       
  1299 		/** Input: Orientation (EHorizontal or EVertical) in which to draw
       
  1300 		the text. */
       
  1301 		TInt16 iDirection;
       
  1302 		/** Input: Flags from TFlags. */
       
  1303 		TUint16 iFlags;
       
  1304 		/** Input: Text containing the characters to be positioned. */
       
  1305 		TPtrC iText;
       
  1306 
       
  1307 		/** Input and output: Position within iText to shape. On exit
       
  1308 		it will index the first character not positioned */
       
  1309 		TInt iPosInText;
       
  1310 		/** Input and output: Pen position. */
       
  1311 		TPoint iPen;			
       
  1312 
       
  1313 		/** Output of GetCharacterPosition and GetCharacterPosition2.
       
  1314 		@see CFont::GetCharacterPosition
       
  1315 		@see CFont::GetCharacterPosition2
       
  1316 		@publishedAll
       
  1317 		@released */
       
  1318 		class TOutput
       
  1319 			{
       
  1320 		public:
       
  1321 			/** Standard constructor. */
       
  1322 			TOutput() : iBitmapSize(TSize::EUninitialized),
       
  1323 				iBounds(TRect::EUninitialized) {}
       
  1324 			/** Character or glyph code. */
       
  1325 			TUint iCode;			
       
  1326 			/** Bitmap data for the glyph, if available */
       
  1327 			const TUint8* iBitmap;	
       
  1328 			/** Size of the bitmap before algorithmic bolding, size 
       
  1329 			multiplication, etc. */
       
  1330 			TSize iBitmapSize;		
       
  1331 			/** Bitmap bounds relative to the original pen position. */
       
  1332 			TRect iBounds;			
       
  1333 			};
       
  1334 
       
  1335 		/** Information about the glyphs that were output. */
       
  1336 		TOutput iOutput[EMaxOutputGlyphs];	
       
  1337 		/** Number of glyphs actually output. */
       
  1338 		TInt iOutputGlyphs;					
       
  1339 		};	
       
  1340 
       
  1341 
       
  1342 	/** Input parameter block.
       
  1343 
       
  1344 	This is optionally used by CFont::MeasureText(), which is the powerful text 
       
  1345 	measurement function underlying all the other text measurement functions.
       
  1346 
       
  1347 	@see CFont::MeasureText() 
       
  1348 	@publishedAll
       
  1349 	@released
       
  1350 	*/
       
  1351 	class TMeasureTextInput
       
  1352 		{
       
  1353 	public:
       
  1354 		TMeasureTextInput():
       
  1355 			iStartInputChar(0),
       
  1356 			iEndInputChar(KMaxTInt),
       
  1357 			iDirection(EHorizontal),
       
  1358 			iFlags(0),
       
  1359 			iMaxAdvance(KMaxTInt),
       
  1360 			iMaxBounds(KMaxTInt),
       
  1361 			iCharJustNum(0),
       
  1362 			iCharJustExcess(0),
       
  1363 			iWordJustNum(0),
       
  1364 			iWordJustExcess(0)
       
  1365 			{
       
  1366 			}
       
  1367 
       
  1368 		/**Flags for TMeasureTextInput::iFlags. */
       
  1369 		enum TFlags
       
  1370 			{
       
  1371  			/** Input text is visually ordered left-to-right. */
       
  1372  			EFVisualOrder = 1,
       
  1373  			/** Input text is visually ordered right-to-left.
       
  1374  			Overrides EFVisualOrder. */
       
  1375  			EFVisualOrderRightToLeft = 2,
       
  1376  			/** Flag to consider side bearings when checking bounds for line-break */
       
  1377  			EFIncludePenPositionInBoundsCheck = 4
       
  1378 			};
       
  1379 
       
  1380 		/** Starting index specifying first input character in iText.
       
  1381 	
       
  1382 		Together with iEndInputChar, this allows some context before and 
       
  1383 		after the measured text to be supplied so that shaping can work 
       
  1384 		properly. */
       
  1385 		TInt iStartInputChar;	
       
  1386 	
       
  1387 		/** Index specifying the final input character.
       
  1388 	
       
  1389 		Together with iStartInputChar, this allows some context before and 
       
  1390 		after the measured text to be supplied so that shaping can work 
       
  1391 		properly. */
       
  1392 		TInt iEndInputChar;		
       
  1393 	
       
  1394 		/** The direction in which to draw the text. */
       
  1395 		TUint16 iDirection;
       
  1396 	
       
  1397 		/** Flags from TFlags. */
       
  1398 		TUint16 iFlags;
       
  1399 	
       
  1400 		/** The maximum advance. */
       
  1401 		TInt iMaxAdvance;		
       
  1402 		
       
  1403 		/** The maximum width (or height if drawing vertically) of bounds. */
       
  1404 		TInt iMaxBounds;		
       
  1405 	
       
  1406 		/** The number of glyph groups to be letter-spaced. */
       
  1407 		TInt iCharJustNum;		
       
  1408 	
       
  1409 		/** The amount of space to be used for letter spacing. */
       
  1410 		TInt iCharJustExcess;	
       
  1411 		
       
  1412 		/** The number of spaces to be used for word spacing. */
       
  1413 		TInt iWordJustNum;		
       
  1414 	
       
  1415 		/** The amount of space to be used for word spacing. */
       
  1416 		TInt iWordJustExcess;	
       
  1417 		};
       
  1418 
       
  1419 	/** Output parameter block.
       
  1420 
       
  1421 	This is optionally used by CFont::MeasureText(), which is the powerful text 
       
  1422 	measurement function underlying all the other text measurement functions.
       
  1423 
       
  1424 	@see CFont::MeasureText() 
       
  1425 	@publishedAll
       
  1426 	@released
       
  1427 	*/
       
  1428 	class TMeasureTextOutput
       
  1429 		{
       
  1430 		public:
       
  1431 		/** The number of input characters that would be drawn.
       
  1432 	
       
  1433 		This may be less than the length of the text if a maximum advance or bounding 
       
  1434 		box size is specified. */
       
  1435 		TInt iChars;			
       
  1436 		/** The number of glyphs that would be drawn. */
       
  1437 		TInt iGlyphs;			
       
  1438 		/** The number of groups that would be drawn.
       
  1439 	
       
  1440 		A group is a base glyph plus one or more combining characters. */
       
  1441 		TInt iGroups;			
       
  1442 		/** The number of word spaces (U+0020) that would be drawn. */
       
  1443 		TInt iSpaces;			
       
  1444 		/** The bounding box of all the glyphs that would be drawn. */
       
  1445 		TRect iBounds;			
       
  1446 		/** The maximum width and height of any glyph. */
       
  1447 		TSize iMaxGlyphSize;	
       
  1448 		};
       
  1449 
       
  1450 	/**
       
  1451 	Data availability flags.
       
  1452 
       
  1453 	Some fonts like printer fonts may only have width information and can return 
       
  1454 	ECharacterWidthOnly to show this: the text drawing routines in CFont synthesize 
       
  1455 	the rest of the data if necessary.
       
  1456 
       
  1457 	@see GetCharacterData() 
       
  1458 	@publishedAll	
       
  1459 	@released
       
  1460 	*/
       
  1461 	enum TCharacterDataAvailability
       
  1462 		{
       
  1463 		/** No font information available. */
       
  1464 		ENoCharacterData,
       
  1465 		/** Width information only is available. */
       
  1466 		ECharacterWidthOnly,
       
  1467 		/** All character data is available. */
       
  1468 		EAllCharacterData
       
  1469 		};
       
  1470 
       
  1471 private:
       
  1472 	// virtual functions have been made protected and public non-virtual ones
       
  1473 	// added to convert CFont to a handle-body pattern. SC is kept throught the
       
  1474 	// new functions and BC is kept by keeping the protected functions in the
       
  1475 	// same place in the class, and therefore in the same place in the vtable
       
  1476 	/**
       
  1477 	@publishedAll
       
  1478 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1479 	*/
       
  1480 	virtual TUid DoTypeUid() const=0;
       
  1481 	/**
       
  1482 	@publishedAll
       
  1483 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1484 	*/
       
  1485 	virtual TInt DoHeightInPixels() const=0;
       
  1486 	/**
       
  1487 	@publishedAll
       
  1488 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1489 	*/
       
  1490 	virtual TInt DoAscentInPixels() const=0;
       
  1491 	IMPORT_C virtual TInt DoDescentInPixels() const;
       
  1492 	/**
       
  1493 	@publishedAll
       
  1494 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1495 	*/
       
  1496 	virtual TInt DoCharWidthInPixels(TChar aChar) const=0;
       
  1497 	/**
       
  1498 	@publishedAll
       
  1499 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1500 	*/
       
  1501 	virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0;
       
  1502 	/**
       
  1503 	@publishedAll
       
  1504 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1505 	*/
       
  1506 	virtual TInt DoBaselineOffsetInPixels() const=0;
       
  1507 	/**
       
  1508 	@publishedAll
       
  1509 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1510 	*/
       
  1511 	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0;
       
  1512 	/**
       
  1513 	@publishedAll
       
  1514 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1515 	*/
       
  1516 	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0;
       
  1517 	/**
       
  1518 	@publishedAll
       
  1519 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1520 	*/
       
  1521 	virtual TInt DoMaxCharWidthInPixels() const=0;
       
  1522 	/**
       
  1523 	@publishedAll
       
  1524 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1525 	*/
       
  1526 	virtual TInt DoMaxNormalCharWidthInPixels() const=0;
       
  1527 	/**
       
  1528 	@publishedAll
       
  1529 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
       
  1530 	*/
       
  1531 	virtual TFontSpec DoFontSpecInTwips() const=0;
       
  1532 
       
  1533 protected:	
       
  1534 	IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
       
  1535 	IMPORT_C virtual TBool DoGetCharacterPosition(TPositionParam& aParam) const;
       
  1536 	IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
       
  1537 
       
  1538 protected:
       
  1539 	IMPORT_C virtual ~CFont();
       
  1540 
       
  1541 public:
       
  1542 	inline TInt FontCapitalAscent() const;
       
  1543 	inline TInt FontMaxAscent() const;
       
  1544 	inline TInt FontStandardDescent() const;
       
  1545 	inline TInt FontMaxDescent() const;
       
  1546 	inline TInt FontLineGap() const;
       
  1547 	inline TInt FontMaxHeight() const;
       
  1548 
       
  1549 public:
       
  1550 	/** Gets run-time identity of the actual font type. This enables safe casting to 
       
  1551 	a derived type.
       
  1552 	
       
  1553 	For example, if the derived type is a CFbsFont, the return value is KCFbsFontUid. 
       
  1554 	You would need to cast to a CFbsFont to get a character bounding box. Similarly, 
       
  1555 	a CBitmapFont returns KCBitmapFontUidVal.
       
  1556 	
       
  1557 	@return The font-type identifier. */
       
  1558 	IMPORT_C TUid TypeUid() const;
       
  1559 
       
  1560 	/** Gets the font height in pixels.
       
  1561 	Note that this deprecated function is replaced by the new @c FontMaxHeight().
       
  1562 
       
  1563 	@return The font height in pixels.
       
  1564 	@see FontMaxHeight()
       
  1565 	@deprecated */
       
  1566 	IMPORT_C TInt HeightInPixels() const;
       
  1567 
       
  1568 	/** Gets the font ascent in pixels.
       
  1569 	Note that this deprecated function is replaced by the new @c FontMaxAscent()
       
  1570 	or in some cases @c FontCapitalAscent().	
       
  1571 	
       
  1572 	@return The font ascent in pixels.
       
  1573 	@see FontCapitalAscent()
       
  1574 	@see FontMaxAscent()
       
  1575 	@deprecated */
       
  1576 	IMPORT_C TInt AscentInPixels() const;
       
  1577 	
       
  1578 	/** Gets the font descent in pixels.
       
  1579 	Note that this deprecated function is replaced by the new @c FontMaxDescent()
       
  1580 	or in some cases @c FontStandardDescent().	
       
  1581 	
       
  1582 	@return The font descent in pixels.
       
  1583 	@see FontStandardDescent() 
       
  1584 	@see FontMaxDescent()
       
  1585 	@deprecated */
       
  1586 	IMPORT_C TInt DescentInPixels() const;
       
  1587 
       
  1588 	/** Gets the width in pixels in this font of the specified character.
       
  1589 	
       
  1590 	Note: For OpenType fonts this function returns the horizontal advance of
       
  1591 	the character, which may be different from the actual width.
       
  1592 	
       
  1593 	@param aChar The character whose width should be determined. 
       
  1594 	@return The width in pixels of the specified character in this font. */
       
  1595 	IMPORT_C TInt CharWidthInPixels(TChar aChar) const;
       
  1596 
       
  1597 	/** Gets the width in pixels of the specified descriptor when displayed in this 
       
  1598 	font.
       
  1599 	
       
  1600 	@param aText The descriptor whose width should be determined. 
       
  1601 	@return The width of the specified descriptor when displayed in this font, 
       
  1602 	in pixels. */
       
  1603 	IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const;
       
  1604 
       
  1605 	/** Gets the baseline offset in pixels. 
       
  1606 	
       
  1607 	The baseline offset is how far a font is raised or lowered from its normal 
       
  1608 	baseline.
       
  1609 	
       
  1610 	@return Offset from normal baseline, in pixels. */
       
  1611 	IMPORT_C TInt BaselineOffsetInPixels() const;
       
  1612 
       
  1613 	/** Gets how much of the specified descriptor can be displayed in this font without 
       
  1614 	exceeding the specified width.
       
  1615 	
       
  1616 	Note:
       
  1617 	
       
  1618 	This function does not display any of the descriptor itself - it is used 
       
  1619 	before display, to test whether the whole descriptor can be displayed.
       
  1620 	
       
  1621 	@param aText The descriptor. 
       
  1622 	@param aWidthInPixels The available width for character display. 
       
  1623 	@return The number of characters which will be able to be displayed without 
       
  1624 	exceeding the specified width. The count starts from the beginning of the 
       
  1625 	descriptor. */
       
  1626 	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels) const;
       
  1627 
       
  1628 	/** Gets how much of the specified descriptor can be displayed in this font without 
       
  1629 	exceeding the specified width. 
       
  1630 	
       
  1631 	It also returns the excess width - defined as the specified available width 
       
  1632 	minus the width of the portion of the descriptor which can be displayed without 
       
  1633 	exceeding the available width.
       
  1634 	
       
  1635 	@param aText The descriptor. 
       
  1636 	@param aWidthInPixels The available width for character display. 
       
  1637 	@param aExcessWidthInPixels The excess width after displaying the portion of 
       
  1638 	the descriptor, in pixels. 
       
  1639 	@return The number of characters which will be able to be displayed without 
       
  1640 	exceeding the specified width. The count starts from the beginning of the 
       
  1641 	descriptor. */
       
  1642 	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;
       
  1643 
       
  1644 	/** Gets the width in pixels of the widest character in this font.
       
  1645 	
       
  1646 	@return The width of the maximum width character, in pixels. */
       
  1647 	IMPORT_C TInt MaxCharWidthInPixels() const;
       
  1648 
       
  1649 	/** Gets the width in pixels of the widest normal character in this font.
       
  1650 	
       
  1651 	Normal characters include all character in a character set except non-alphabetic 
       
  1652 	characters (e.g. the copyright symbol, or a block graphics symbol, for example).
       
  1653 	
       
  1654 	@return The width of the maximum width normal character, in pixels. */
       
  1655 	IMPORT_C TInt MaxNormalCharWidthInPixels() const;
       
  1656 
       
  1657 	/** Gets the font specification of this font in twips.
       
  1658 	
       
  1659 	@return The font specification of this font (in twips). */
       
  1660 	IMPORT_C TFontSpec FontSpecInTwips() const;
       
  1661 	IMPORT_C TCharacterDataAvailability GetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
       
  1662 	IMPORT_C TBool GetCharacterPosition(TPositionParam& aParam) const;
       
  1663 	IMPORT_C TInt WidthZeroInPixels() const;
       
  1664 	IMPORT_C TInt MeasureText(const TDesC& aText, const TMeasureTextInput* aInput = NULL, TMeasureTextOutput* aOutput = NULL) const;
       
  1665 	IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter);
       
  1666 	IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
       
  1667 	IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const;
       
  1668 
       
  1669 	/** Gets the width in pixels of the specified descriptor when displayed in this 
       
  1670 	font.
       
  1671 	
       
  1672 	@param aText The descriptor whose width should be determined.
       
  1673 	@param aParam Parameter block that controls how much of aText is measured
       
  1674 	@return The width of the specified descriptor when displayed in this font, 
       
  1675 	in pixels. */
       
  1676 	IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
       
  1677 	};
       
  1678 
       
  1679 class CFbsBitmap;
       
  1680 class CWsBitmap;
       
  1681 /** Abstract base class for all graphics contexts.
       
  1682 
       
  1683 Created by a CGraphicsDevice.
       
  1684 
       
  1685 Provides the 'context' in which you are drawing to an associated device, in 
       
  1686 the sense that it holds the settings for drawing, such as the pen and brush 
       
  1687 settings (e.g. color, line styles) and the font settings (e.g. bold, underline, 
       
  1688 italic). These settings are device-independent.
       
  1689 
       
  1690 Also provides the clipping region (the visible drawing area).
       
  1691 
       
  1692 The settings and clipping area can be updated while drawing.
       
  1693 
       
  1694 This class also contains the main drawing functions, and all drawing is done 
       
  1695 through a CGraphicsContext.
       
  1696 
       
  1697 The graphics context deals with pixels of device-dependent size and uses fonts 
       
  1698 with device-dependent size and representation. The sizes and fonts to be passed 
       
  1699 to the class functions therefore need to be converted from size-independent 
       
  1700 units to size-dependent units first. This is done by an MGraphicsDeviceMap 
       
  1701 derived class. This may be a TZoomFactor or the CGraphicsDevice.
       
  1702 
       
  1703 See CGraphicsContext::Reset() for the default graphics context settings immediately 
       
  1704 after construction.
       
  1705 
       
  1706 @see CBitmapContext 
       
  1707 @publishedAll
       
  1708 @released
       
  1709 */
       
  1710 class CGraphicsContext : public CBase
       
  1711 	{
       
  1712 public:
       
  1713 
       
  1714 
       
  1715 	/** Text alignment.
       
  1716 	@publishedAll
       
  1717 	@released
       
  1718 	*/
       
  1719 	enum TTextAlign
       
  1720 		{
       
  1721 		/** Text is left-aligned. */
       
  1722 		ELeft,
       
  1723 		/** Text is centred. */
       
  1724 		ECenter,
       
  1725 		/** Text is right-aligned. */
       
  1726 		ERight
       
  1727 		};
       
  1728 
       
  1729 	/** 
       
  1730 	Drawing mode components.
       
  1731 	This enum is not intended to be used directly, but provides components for 
       
  1732 	the easy specification of drawing modes in the TDrawMode enum. 
       
  1733 	@publishedAll
       
  1734 	@released
       
  1735 	*/
       
  1736 	enum TDrawModeComponents
       
  1737 		{
       
  1738 		/** 1 */
       
  1739 		EInvertScreen=1,
       
  1740 		/** 2 */
       
  1741 		EXor=2,
       
  1742 		/** 4 */
       
  1743 		EOr=4,
       
  1744 		/** 8 */
       
  1745 		EAnd=8,
       
  1746 		/** 14 */
       
  1747 		ELogicalOp=14,
       
  1748 		/** 16 */
       
  1749 		EInvertPen=16,
       
  1750 		/** 32 */
       
  1751 		EPenmode=32,
       
  1752 		/** 64 */
       
  1753 		EWriteAlpha=64,
       
  1754 		};
       
  1755 
       
  1756 
       
  1757 	/** 
       
  1758 	Drawing modes.
       
  1759 
       
  1760 	This enum builds on the drawing mode components in the TDrawModeComponents 
       
  1761 	enum.
       
  1762 
       
  1763 	If the pen colour is p, brush colour is b and screen colour is s, the effect 
       
  1764 	of TDrawMode::EDrawModeAND is P=p&s and B=b&s. In other words, the effective 
       
  1765 	colour of the pen on the screen, P, is that produced by the bitwise ANDing 
       
  1766 	of the current screen colour and the current pen colour. The effect is similar 
       
  1767 	for the effective brush colour, B.
       
  1768 
       
  1769 	The effective pen and brush colour are given in the table using the key
       
  1770 	Inputs: pen colour is p, brush colour is b and screen colour is s
       
  1771 	Outputs: effective brush colour is B, effective pen colour is P. 
       
  1772 
       
  1773 	Some notes on using EDrawModeWriteAlpha:-
       
  1774 
       
  1775 	- It is rare for client code to need to use this draw mode: see the documentation
       
  1776 	of SetDrawMode() for more information.
       
  1777 	- EDrawModeWriteAlpha should only be used with DrawRect(), Clear(), BitBlt(), and BitBltMasked() 
       
  1778 	with EGray2 mask (and DrawBitmap() and DrawBitmapMasked()). For other draw operations, it is not 
       
  1779 	supported, and may have unintended effects.
       
  1780 	- EDrawModeWriteAlpha has the same effect as EDrawModePEN, unless the brush colour has transparency 
       
  1781 	(DrawRect(), Clear()), or the source bitmap is EColor16MA (and has transparency) (BitBlt(), BitBltMasked())
       
  1782 	- EDrawModeWriteAlpha has the same effect as EDrawModePEN if the draw mode of the destination does not 
       
  1783 	support alpha blending. (Blending is only supported in 24bpp and 32bpp colour i.e. EColor16M, EColor16MU, EColor16MA)
       
  1784 	- In these cases, EDrawModePEN does alpha blending, whereas EDrawModeWriteAlpha means don't do alpha blending.
       
  1785 
       
  1786 	@see SetDrawMode()
       
  1787 	@publishedAll
       
  1788 	@released
       
  1789 	*/
       
  1790 	enum TDrawMode
       
  1791 		{
       
  1792 		/** Bitwise ANDs the pen and brush colours with the screen colour. 
       
  1793 		P=p&s, B=b&s */
       
  1794 		EDrawModeAND=EAnd,
       
  1795 		/** Inverts the pen and brush colours before ANDing. P=(~p)&s, 
       
  1796 		B=(~b)&s */
       
  1797 		EDrawModeNOTAND=EInvertScreen|EAnd,
       
  1798 		/** Uses both pen and brush colour as they are. P=p, B=b */
       
  1799 		EDrawModePEN=EPenmode,
       
  1800 		/** Inverts the screen colour before ANDing. P=p&(~s), B=b&(~s) */
       
  1801 		EDrawModeANDNOT=EAnd|EInvertPen,
       
  1802 		/** Bitwise XORs the pen and brush colours with the screen colour. 
       
  1803 		P=p^s, B=b^s */
       
  1804 		EDrawModeXOR=EXor,
       
  1805 		/** Bitwise ORs the pen and brush colours with the screen colour. 
       
  1806 		P=p|s, B=b|s */
       
  1807 		EDrawModeOR=EOr,
       
  1808 		/** Inverts the screen and pen and brush colours before ANDing. 
       
  1809 		P=(~p)&(~s), B=(~b)&(~s) */
       
  1810 		EDrawModeNOTANDNOT=EInvertScreen|EAnd|EInvertPen,
       
  1811 		/** Inverts the pen and brush colours before XORing. P=(~p)^s, 
       
  1812 		B=(~b)^s */
       
  1813 		EDrawModeNOTXOR=EInvertScreen|EXor,
       
  1814 		/** Inverts the colour of each pixel that is drawn over, (pen and 
       
  1815 		brush attributes are ignored). P=~s, B=~s */
       
  1816 		EDrawModeNOTSCREEN=EInvertScreen,
       
  1817 		/** Inverts the screen colour before ORing. P=p|(~s), 
       
  1818 		B=b|(~s) */
       
  1819 		EDrawModeNOTOR=EInvertScreen|EOr,
       
  1820 		/** Inverts the pen and brush colours. P=~p, B=~b */
       
  1821 		EDrawModeNOTPEN=EInvertPen|EPenmode,
       
  1822 		/** Inverts the pen and brush colours before ORing. P=(~p)|s, 
       
  1823 		B=(~b)|s */
       
  1824 		EDrawModeORNOT=EOr|EInvertPen,
       
  1825 		/** Inverts the screen and pen and brush colours before ORing.
       
  1826 		P=(~p)|(~s), B=(~b)|(~s) */
       
  1827 		EDrawModeNOTORNOT=EInvertScreen|EOr|EInvertPen,
       
  1828 		/** Writes alpha information in the source directly into the destination, rather than blending. */
       
  1829 		EDrawModeWriteAlpha=EWriteAlpha,
       
  1830 		};
       
  1831 
       
  1832 	/** 
       
  1833 	Pen styles. The screen pattern unit in each definition below describes the 
       
  1834 	pattern drawn by the line 1 represents a pixel drawn, 0 represents a 
       
  1835 	pixel that is not affected. 
       
  1836 	@publishedAll
       
  1837 	@released
       
  1838 	*/
       
  1839 	enum TPenStyle
       
  1840 		{
       
  1841 		/** The pen does not draw. Screen pattern unit = 00... */
       
  1842 		ENullPen,
       
  1843 		/** A solid line (default). Screen pattern unit = 11... */
       
  1844 		ESolidPen,
       
  1845 		/** A dotted line. Screen pattern unit = 1000... */
       
  1846 		EDottedPen,
       
  1847 		/** A dashed line. Screen pattern unit = 111000... */
       
  1848 		EDashedPen,
       
  1849 		/** A line of alternating dashes and dots. Screen pattern unit = 
       
  1850 		1111001100... */
       
  1851 		EDotDashPen,
       
  1852 		/** A line of alternating single dashes and pairs of dots. Screen 
       
  1853 		pattern unit = 11110011001100... */
       
  1854 		EDotDotDashPen
       
  1855 		};
       
  1856 
       
  1857 	/** 
       
  1858 	Brush styles. 
       
  1859 	@publishedAll
       
  1860 	@released
       
  1861 	*/
       
  1862 	enum TBrushStyle
       
  1863 		{
       
  1864 		/** The brush fill has no effect (default). */
       
  1865 		ENullBrush,
       
  1866 		/** The brush fills with a solid single colour, determined by 
       
  1867 		SetBrushColor() and the drawing mode. */
       
  1868 		ESolidBrush,
       
  1869 		/** The brush fills with a selected bitmap pattern, set by 
       
  1870 		UseBrushPattern(). */
       
  1871 		EPatternedBrush,
       
  1872 		/** The brush fills with vertical hatching  lines going from top to 
       
  1873 		bottom. */
       
  1874 		EVerticalHatchBrush,
       
  1875 		/** The brush fills with diagonal hatching lines going from bottom 
       
  1876 		left to top right. */
       
  1877 		EForwardDiagonalHatchBrush,
       
  1878 		/** The brush fills with horizontal hatching  lines going from left 
       
  1879 		to right. */
       
  1880 		EHorizontalHatchBrush,
       
  1881 		/** The brush fills with rearward diagonal hatching lines going from top 
       
  1882 		left to bottom right. */
       
  1883 		ERearwardDiagonalHatchBrush,
       
  1884 		/** The brush fills with horizontal and vertical hatching  lines going 
       
  1885 		from left to right plus lines going from top to bottom  giving the 
       
  1886 		effect of a grid of small squares */
       
  1887 		ESquareCrossHatchBrush,
       
  1888 		/** The brush fills with forward diagonal and rearward diagonal hatching 
       
  1889 		lines going from bottom left to top right plus lines going from top left 
       
  1890 		to bottom right giving the effect of a grid of small diamonds. */
       
  1891 		EDiamondCrossHatchBrush
       
  1892 		};
       
  1893 
       
  1894 	/** 
       
  1895 	Rules used to fill self crossing polygons. 
       
  1896 
       
  1897 	The filling of a polygon proceeds as follows: for a given point in the 
       
  1898 	polygon, then
       
  1899 
       
  1900 	if the rule is TFillRule::EAlternate (default) and it has an odd winding 
       
  1901 	number, then fill the surrounding area.
       
  1902 
       
  1903 	if the rule is TFillRule::EWinding and it has a winding number greater than 
       
  1904 	zero, then fill the surrounding area. 
       
  1905 	@publishedAll
       
  1906 	@released
       
  1907 	*/
       
  1908 	enum TFillRule
       
  1909 		{
       
  1910 		/** Only fill areas with odd winding numbers. */
       
  1911 		EAlternate,
       
  1912 		/** Fill areas with winding numbers greater than zero. */
       
  1913 		EWinding
       
  1914 		};
       
  1915 
       
  1916 	/** Parameters to control the drawing of text. */
       
  1917 	struct TDrawTextParam
       
  1918 		{
       
  1919 	public:
       
  1920 		TDrawTextParam():
       
  1921 			iDirection(CFont::EHorizontal),
       
  1922 			iCharJustNum(0),
       
  1923 			iCharJustExcess(0),
       
  1924 			iWordJustNum(0),
       
  1925 			iWordJustExcess(0)
       
  1926 	/** Reserved for future use. */
       
  1927 			{}
       
  1928 	public:
       
  1929 		/** the direction in which to draw the text. */
       
  1930 		CFont::TTextDirection iDirection;	
       
  1931 		/** number of glyph groups to be letterspaced */
       
  1932 		TInt iCharJustNum;					
       
  1933 		/** amount of space to be used for letterspacing */
       
  1934 		TInt iCharJustExcess;				
       
  1935 		/** number of spaces to be used for wordspacing*/
       
  1936 		TInt iWordJustNum;					
       
  1937 		/**  amount of space to be used for wordspacing*/
       
  1938 		TInt iWordJustExcess;				
       
  1939 		};
       
  1940 
       
  1941 
       
  1942 	/** Parameters for extended text drawing and measuring. It is used by 
       
  1943 	CGraphicsContext::DrawTextExtended() to indicate whether text should be 
       
  1944 	drawn from right-to-left or left-to-right. */
       
  1945 	struct TDrawTextExtendedParam : public TDrawTextParam
       
  1946 		{
       
  1947 	public:
       
  1948 		/** Constructor. Initialises iParRightToLeft to EFalse. */
       
  1949 		TDrawTextExtendedParam():
       
  1950 			iParRightToLeft(EFalse)
       
  1951 			{}
       
  1952 	public:
       
  1953 		/** ETrue if the text direction is right-to-left (for scripts like 
       
  1954 		Arabic and Hebrew). EFalse if left-to-right. */
       
  1955 		TBool iParRightToLeft;	
       
  1956 		};
       
  1957 	
       
  1958 	/**
       
  1959 	Parameters used in drawing text within supplied context.
       
  1960 	It is used by CGraphicsContext::DrawText() and CGraphicsContext::DrawTextVertical() family of API's
       
  1961 	to draw text from iStart to iEnd withing the supplied text descriptor.
       
  1962 	*/
       
  1963 	class TTextParameters
       
  1964 		{
       
  1965 	public:
       
  1966 		TTextParameters():
       
  1967 			iStart(0),
       
  1968 			iEnd(KMaxTInt),
       
  1969 			iFlags(0)
       
  1970 				{
       
  1971 				}
       
  1972 		TInt iStart;
       
  1973 		TInt iEnd;
       
  1974 		TUint16 iFlags;
       
  1975 		/* Reserved for future use */
       
  1976 		TAny* iReserved1;
       
  1977 		TAny* iReserved2;
       
  1978 		TAny* iReserved3;
       
  1979 		TAny* iReserved4;
       
  1980 		};
       
  1981 public:
       
  1982 	/** Gets a pointer to the graphics context's graphics device.
       
  1983 	
       
  1984 	@return A pointer to the graphics device. */
       
  1985 	virtual CGraphicsDevice* Device() const=0;
       
  1986 
       
  1987 	/** Sets the position of the co-ordinate origin.
       
  1988 	
       
  1989 	All subsequent drawing operations are done relative to this origin.
       
  1990 	
       
  1991 	@param aPos The origin. The default origin is TPoint(0,0) the top left 
       
  1992 	corner of the screen. */
       
  1993 	virtual void SetOrigin(const TPoint& aPos=TPoint(0,0))=0;
       
  1994 
       
  1995 	/** Sets the drawing mode. 
       
  1996 	
       
  1997 	The way that the pen and brush draw depends on the drawing mode. The drawing 
       
  1998 	mode affects the colour that is actually drawn, because it defines the way 
       
  1999 	that the current screen colour logically combines with the current pen colour 
       
  2000 	and brush colour. There are many drawing modes, each giving different logical 
       
  2001 	combinations of pen, brush and screen colours. Each mode is produced by ORing 
       
  2002 	together different combinations of seven drawing mode components.
       
  2003 	
       
  2004 	The three most important modes are TDrawMode::EDrawModePEN, TDrawMode::EDrawModeNOTSCREEN 
       
  2005 	and TDrawMode::EDrawModeXOR. The default drawing mode is TDrawMode::EDrawModePEN.
       
  2006 	
       
  2007 	The drawing mode is over-ridden for line and shape drawing functions when 
       
  2008 	a wide pen line has been selected. It is forced to TDrawMode::EDrawModePEN. 
       
  2009 	This is to prevent undesired effects at line joins (vertexes).
       
  2010 	
       
  2011 	Notes:
       
  2012 	
       
  2013 	TDrawMode::EDrawModeAND gives a "colour filter" effect. For example:
       
  2014 	
       
  2015 	- ANDing with white gives the original colour
       
  2016 	- ANDing with black gives black
       
  2017 	
       
  2018 	TDrawMode::EDrawModeOR gives a "colour boost" effect. For example:
       
  2019 	
       
  2020 	- ORing with black gives the original colour
       
  2021 	- ORing with white gives white
       
  2022 	
       
  2023 	TDrawMode::EDrawModeXOR gives an "Exclusive OR" effect. For example:
       
  2024 	
       
  2025 	- white XOR black gives white
       
  2026 	- white XOR white gives black
       
  2027 	- black XOR black gives black
       
  2028 	
       
  2029 	TDrawMode::EDrawModeWriteAlpha should not normally need to be used by client code. 
       
  2030 	The following are exceptions:-
       
  2031 
       
  2032 	- When a client side EColor16MA bitmap needs to have a transparent background 
       
  2033 	(because you are intending to blend it onto something else), then you need to set 
       
  2034 	EDrawModeWriteAlpha to Clear() it.
       
  2035 	- When you want to BitBlt() with an EColor16MA source bitmap that is opaque everywhere, 
       
  2036 	then using EDrawModeWriteAlpha is more efficient than EDrawModePEN, because the bitmap 
       
  2037 	does not need to be blended. 
       
  2038 
       
  2039 	Note that if you have a transparent brush or source bitmap and you are drawing to a window, 
       
  2040 	then it is a defect to use EDrawModeWriteAlpha.
       
  2041 
       
  2042 	@param aDrawingMode The drawing mode.
       
  2043 	@see CGraphicsContext::TDrawMode
       
  2044 	@see CGraphicsContext::TDrawModeComponents */
       
  2045 	virtual void SetDrawMode(TDrawMode aDrawingMode)=0;
       
  2046 
       
  2047 	/** Sets the clipping rectangle.	 
       
  2048 	
       
  2049 	The area of visible drawing depends on the clipping rectangle, any items 
       
  2050 	that fall outside the extent of the clipping rectangle will not be drawn. 
       
  2051 	The default clipping rectangle is the full device area.
       
  2052 	
       
  2053 	Note that clipping is additive. If a clipping region has been set using SetClippingRegion() 
       
  2054 	then clipping will be to the intersection of that region and this rectangle.
       
  2055 		
       
  2056 	@param aRect The rectangle to be used as the clipping rectangle. Note that 
       
  2057 	this rectangle is tranformed by the current co-ordinate origin before it is used. 
       
  2058 	The co-ordinate origin is set using SetOrigin().
       
  2059 	
       
  2060 	@see CGraphicsContext::SetClippingRegion() 
       
  2061 	@see CGraphicsContext::SetOrigin() */
       
  2062 	virtual void SetClippingRect(const TRect& aRect)=0;
       
  2063 
       
  2064 	/** Cancels any clipping rectangle.
       
  2065 	
       
  2066 	Clipping thus reverts to the full device area, the default.
       
  2067 	
       
  2068 	@see SetClippingRect() */
       
  2069 	virtual void CancelClippingRect()=0;
       
  2070 
       
  2071 	/** Resets the graphics context to its default settings:
       
  2072 	
       
  2073 	the drawing mode is TDrawMode::EDrawModePen (pen and brush colours used as 
       
  2074 	they are)
       
  2075 	
       
  2076 	there is no clipping rectangle
       
  2077 	
       
  2078 	the pen settings are: black, solid, single pixel size
       
  2079 	
       
  2080 	the brush style is null
       
  2081 	
       
  2082 	no text font is selected */
       
  2083 	virtual void Reset()=0;
       
  2084 
       
  2085    /** Sets the device font to be used for text drawing.
       
  2086 	
       
  2087 	If the font is already in memory, then that copy is shared.
       
  2088 	
       
  2089 	Notes:
       
  2090 	
       
  2091 	The CFont* argument must have been previously initialised by calling 
       
  2092 	MGraphicsDeviceMap::GetNearestFontInTwips() with the required 
       
  2093 	font-specification. If the CFont* has not been initialised 
       
  2094 	correctly, and therefore does not point to an available font-bitmap, 
       
  2095 	then a panic is raised.
       
  2096 	
       
  2097 	When the font is no longer required, use DiscardFont() to free up the 
       
  2098 	memory used. If UseFont() is used again without using DiscardFont() then 
       
  2099 	the previous font is discarded automatically.
       
  2100 	
       
  2101 	If no font has been selected, and an attempt is made to draw text with 
       
  2102 	DrawText(), then a panic is raised.
       
  2103 	
       
  2104 	@param aFont A device font 
       
  2105 	@see MGraphicsDeviceMap::GetNearestFontInTwips() */
       
  2106 	virtual void UseFont(const CFont* aFont)=0;
       
  2107 
       
  2108 	/** Discards a font.
       
  2109 	
       
  2110 	This frees up the memory used, if the font is not being shared.
       
  2111 	
       
  2112 	The function can be called when no font is in use. */
       
  2113 	virtual void DiscardFont()=0;
       
  2114 
       
  2115 	/** Sets the underline style.
       
  2116 	
       
  2117 	This is applied to all subsequently drawn text.
       
  2118 	
       
  2119 	@param aUnderlineStyle The underline style on or off. */
       
  2120 	virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle)=0;
       
  2121 
       
  2122 	/** Sets the strikethrough style.
       
  2123 	
       
  2124 	This is applied to all subsequently drawn text.
       
  2125 	
       
  2126 	@param aStrikethroughStyle The strikethrough style on or off. */
       
  2127 	virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)=0;
       
  2128 	IMPORT_C static TInt JustificationInPixels(TInt aExcessPixels,TInt aTotalUnits,TInt aFirstUnit,TInt aNumUnits);
       
  2129 	IMPORT_C static TInt JustificationInPixels(TInt& aExcessPixels,TInt& aTotalUnits);
       
  2130 
       
  2131 	/** Adjusts the spaces between words to stretch or squeeze to a certain 
       
  2132 	width.
       
  2133 	
       
  2134 	The function is required by the Text Views API, and is not intended for 
       
  2135 	regular use by developers.
       
  2136 	
       
  2137 	The text line that is to be justified has a certain number of gaps (spaces) 
       
  2138 	between the words. It also has a distance (in pixels) between the end of 
       
  2139 	the last word and the actual end of the line (right hand margin, usually). 
       
  2140 	These excess width pixels are distributed amongst the gaps between the words 
       
  2141 	to achieve full justification of the text line. Spaces become fat spaces to 
       
  2142 	keep underlining/strikethrough consistent. Pixels are distributed to the 
       
  2143 	inter-word gaps starting from the left end of the string. The spacing 
       
  2144 	between characters in each word remains unchanged.
       
  2145 	
       
  2146 	After a call to SetWordJustification(), subsequent calls to either of the 
       
  2147 	two DrawText() functions are affected until the number of spaces specified 
       
  2148 	by aNumSpaces is used up.
       
  2149 	
       
  2150 	The easiest way to find out the excess width and number of spaces is to call 
       
  2151 	CFont::MeasureText(). This function can also perform counting, which is 
       
  2152 	finding how much of some text will fit into a given width.
       
  2153 	
       
  2154 	Use CFont::TextCount() to return the excess width.
       
  2155 	
       
  2156 	For example, in the string "To be, or not to be", there are five inter-word 
       
  2157 	gaps. If there are six excess pixels they will be distributed in the 
       
  2158 	proportion 	2, 1, 1, 1, 1 between the words. If there are nine excess pixels 
       
  2159 	they will be distributed in the proportion 2, 2, 2, 2, 1 between the words.
       
  2160 	
       
  2161 	Notes:
       
  2162 	
       
  2163 	If the excess width is zero, then calling SetWordJustification() has no 
       
  2164 	effect.
       
  2165 	
       
  2166 	At first sight it may appear that SetWordJustification() is not required 
       
  2167 	because you can simply call DrawText() for each word. However, underlined 
       
  2168 	justified text does not work using this strategy  you get a non-underlined 
       
  2169 	gap between the space and the beginning of the next word.
       
  2170 	
       
  2171 	@param aExcessWidth The width (in pixels) to be distributed between the 
       
  2172 	specified number of spaces. 
       
  2173 	@param aNumGaps The number of word spaces (characters with the code U+0020) 
       
  2174 	over which the change in width is distributed. */
       
  2175 	virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps)=0;
       
  2176 
       
  2177 	/** Sets character justification.
       
  2178 	
       
  2179 	This function is required by the Text Views API, and is not intended for 
       
  2180 	regular use by developers.
       
  2181 	
       
  2182 	It affects the strings of text used in the calls to DrawText() that follow, 
       
  2183 	until the number of characters drawn equals aNumChars.
       
  2184 	
       
  2185 	The text line that is to be justified has a certain number of characters
       
  2186 	this includes the spaces between the words. It also has a distance (in 
       
  2187 	pixels) between the end of the last word and the actual end of the line 
       
  2188 	(right hand margin, usually). These excess width pixels are distributed 
       
  2189 	amongst all the characters, increasing the gaps between them, to achieve 
       
  2190 	full justification of the text line.
       
  2191 	
       
  2192 	Use CFont::TextCount() to return the excess width.
       
  2193 	
       
  2194 	Notes:
       
  2195 	
       
  2196 	This function is provided to allow simulation of printer fonts on screen. 
       
  2197 	Due to the fact that fully-scalable fonts are not used before v5, large 
       
  2198 	printer fonts can be simulated by using the nearest smaller font and 
       
  2199 	widening it slightly.
       
  2200 	
       
  2201 	If the excess width is zero, then calling SetCharJustification() has no 
       
  2202 	effect.
       
  2203 	
       
  2204 	SetCharJustification() is required for WYSIWYG where the layout uses 
       
  2205 	printer font metrics but screen fonts have to be drawn on the screen. 
       
  2206 	Because continuously scalable typefaces (c.f. TrueType) are not used 
       
  2207 	before v5 and because screen fonts are coarser and less numerous in 
       
  2208 	their variety than the printer fonts, the best matching smaller screen 
       
  2209 	font must be used with character justification to simulate the printer 
       
  2210 	font on the screen.
       
  2211 	
       
  2212 	There is also a situation where the gaps between characters on screen have 
       
  2213 	to be reduced with character clipping. The screen font that best matches 
       
  2214 	the printer font may have the required height, but has characters that are 
       
  2215 	too wide. A line of text that works on the printer will then be too long 
       
  2216 	on the screen, unless it is squashed horizontally. The number of pixels 
       
  2217 	that overlap the end of the screen line must now be removed from the gaps 
       
  2218 	between the characters, i.e. there is a negative excess width. This 
       
  2219 	situation is especially important where adding a TAB on screen gives 
       
  2220 	perfectly acceptable printout, but would push the last character of the 
       
  2221 	line off the right hand side of the screen.
       
  2222 	
       
  2223 	In practice what you do in printer layout mode is:
       
  2224 	
       
  2225 	Calculate where the line breaks will come on the printer. To do this you 
       
  2226 	use a printer font (which in practice means a table of character widths 
       
  2227 	of the font that the printer will use).
       
  2228 	
       
  2229 	Now change to use a screen font that is the closest font which is no taller 
       
  2230 	that the printer font. In practice it will often be fatter maybe only for 
       
  2231 	certain characters such as 'i'.
       
  2232 	
       
  2233 	You have to recalculate the width of the characters using the screen fonts. 
       
  2234 	You can do this using CFont::TextWidth() as you have already determined how 
       
  2235 	many characters will fit on the line.
       
  2236 	
       
  2237 	If, in the screen font, the characters are not as wide as the line then you 
       
  2238 	can just use word justification to expand the line. You would only do this 
       
  2239 	if the text is to be justified.
       
  2240 	
       
  2241 	If, however, the characters are wider than the line then you would use 
       
  2242 	character justification to clip each character. You would need to do this 
       
  2243 	even if the line is not justified.
       
  2244 	
       
  2245 	Thus, in practice, character justification will only very rarely be used to 
       
  2246 	expand a line of characters.
       
  2247 	
       
  2248 	@param aExcessWidth The excess width (in pixels) to be distributed between 
       
  2249 	the specified number of characters. It may be positive, in which case the text is 
       
  2250 	stretched, or negative, in which case it is shrunk.
       
  2251 	@param aNumChars The number of characters involved. */
       
  2252 	virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars)=0;
       
  2253 
       
  2254 	/** Sets the pen colour.
       
  2255 	
       
  2256 	The effective pen colour depends on the drawing mode. The default pen colour 
       
  2257 	is black.
       
  2258 	
       
  2259 	Note:
       
  2260 	
       
  2261 	The pen is used to draw lines, the outlines of filled shapes, and text. The 
       
  2262 	class provides member functions to set the colour of the pen, the style of 
       
  2263 	line and the line size drawn.
       
  2264 	
       
  2265 	@param aColor An RGB colour for the pen. 
       
  2266 	@see CGraphicsContext::SetDrawMode() */
       
  2267 	virtual void SetPenColor(const TRgb& aColor)=0;
       
  2268 
       
  2269 	/** Sets the line drawing style for the pen. 
       
  2270 	
       
  2271 	There are 6 pen styles. If no pen style is set, then the default is 
       
  2272 	TPenStyle::ESolidPen. To use a pen style, its full context must be given, 
       
  2273 	e.g. for a null pen:
       
  2274 	
       
  2275 	CGraphicsContext::TPenStyle::ENullPen
       
  2276 	Notes:
       
  2277 	
       
  2278 	The pen is used to draw lines, the outlines of filled shapes, and text. 
       
  2279 	CGraphicsContext member functions are provided to set the colour of the 
       
  2280 	pen, the style of line and the line size drawn.
       
  2281 	
       
  2282 	The TPenStyle::ENullPen style should be used if a border is not required 
       
  2283 	around a filled shape.
       
  2284 	
       
  2285 	Dotted and dashed pen styles have a device dependant implementation, always 
       
  2286 	give single-pixel size lines on the screen whatever the pen size set 
       
  2287 	by SetPenSize() and can only be used for straight lines, polylines, 
       
  2288 	non-rounded rectangles and polygons.
       
  2289 	
       
  2290 	The dotted/dashed pattern is continued, without re-starting, for all 
       
  2291 	consecutively drawn straight lines, i.e.
       
  2292 	
       
  2293 	the outlines of rectangles the pattern starts in the top left corner. 
       
  2294 	It is reset at the end of the function call.
       
  2295 	
       
  2296 	the outlines of polygons the pattern starts at the first point. It is 
       
  2297 	reset at the end of the function call.
       
  2298 	
       
  2299 	polylines and straight lines the pattern starts at the first point 
       
  2300 	initially. Consecutive calls to DrawLine() and/or DrawPolyLine(), whether 
       
  2301 	the lines are concatenated or not, continue the pattern. It can be reset 
       
  2302 	by a further call to SetPenStyle() using the same dotted/dashed style 
       
  2303 	parameter.
       
  2304 	
       
  2305 	@param aPenStyle A pen style. 
       
  2306 	@see CGraphicsContext::TPenStyle */
       
  2307 	virtual void SetPenStyle(TPenStyle aPenStyle)=0;
       
  2308 
       
  2309 	/** Sets the line drawing size for the pen.
       
  2310 	
       
  2311 	Lines of size greater than one pixel:
       
  2312 	
       
  2313 	are drawn with rounded ends that extend beyond the end points, (as if the 
       
  2314 	line is drawn using a circular pen tip of the specified size).
       
  2315 	
       
  2316 	are always drawn in TDrawMode::EDrawModePEN mode, overriding whatever mode 
       
  2317 	has been set using SetDrawMode().
       
  2318 	
       
  2319 	Notes:
       
  2320 	
       
  2321 	The pen is used to draw lines, the outlines of filled shapes, and text. The 
       
  2322 	class provides member functions to set the colour of the pen, the style of 
       
  2323 	line and the line size drawn.
       
  2324 	
       
  2325 	Wide straight lines and arcs have rounded ends so that concatenated wide 
       
  2326 	lines have smoothly rounded corners at the vertexes.
       
  2327 	
       
  2328 	When lines are made wide, the extra strips of pixels are added equally to 
       
  2329 	both sides of the line. This works precisely for lines of odd pixel size 
       
  2330 	(3, 5, 7, etc.). Wide lines of even pixel size, (2, 4, 6, etc.), 
       
  2331 	have the extra strip of pixels added to the right and/or below the line.
       
  2332 	
       
  2333 	Wide outlines of ellipses and wide line arcs are drawn with the pixels 
       
  2334 	distributed either side of a thin (single pixel wide) true ellipse 
       
  2335 	constructed in the normal manner. Wide ellipses and arcs of even pixel 
       
  2336 	size have the extra strip of pixels added to the right and/or below the 
       
  2337 	curved line. This gives a slight asymmetry to ellipses.
       
  2338 	
       
  2339 	If the pen style is dotted or dashed, the size specification is ignored: a 
       
  2340 	single-pixel wide primitive is drawn, (this is device dependant).
       
  2341 	
       
  2342 	A line size of zero is handled as if the pen style had been set to 
       
  2343 	TPenStyle::ENullPen.
       
  2344 	
       
  2345 	@param aSize A line size. The default is 1 pixel. */
       
  2346 	virtual void SetPenSize(const TSize& aSize)=0;
       
  2347 
       
  2348 	/** Sets the brush colour.
       
  2349 	
       
  2350 	The effective brush colour depends on the drawing mode.
       
  2351 	
       
  2352 	Notes:
       
  2353 	
       
  2354 	The brush is used for filling shapes and the background of text boxes. The 
       
  2355 	brush has colour, style, pattern and pattern origin parameters.
       
  2356 	
       
  2357 	If no brush colour has been set, it defaults to white. However the default 
       
  2358 	brush style is null, so when drawing to a window the default appears to be 
       
  2359 	the window's background colour.
       
  2360 	
       
  2361 	@param aColor An RGB colour for the brush. 
       
  2362 	@see SetDrawMode() */
       
  2363 	virtual void SetBrushColor(const TRgb& aColor)=0;
       
  2364 
       
  2365 	/**	Sets the brush style.
       
  2366 
       
  2367 	Ten brush styles are provided, including six built-in hatching patterns.
       
  2368 	Note: The brush is used for filling shapes and the background of text boxes.
       
  2369 	The brush has colour, style, pattern and pattern origin parameters.
       
  2370 	Note: Use TBrushStyle::ENullBrush to draw the outline of a fillable
       
  2371 	shape on its own, without filling.
       
  2372 	Note: If the TBrushStyle::EPatternedBrush style is set, but no bitmap 
       
  2373 	pattern has been selected using UseBrushPattern(), then the function panics.
       
  2374 	Note: Hatching lines are done in the current pen colour, set using SetPenColor(). 
       
  2375 	The hatching pattern starts at the brush origin, set using SetBrushOrigin().
       
  2376 	@see TBrushStyle::ENullBrush
       
  2377 	@see TBrushStyle::EPatternedBrush
       
  2378 	@see UseBrushPattern()
       
  2379 	@see SetPenColor()
       
  2380 	@see SetBrushOrigin()
       
  2381 	@publishedAll
       
  2382 	@released
       
  2383 	@param aBrushStyle A brush style. */
       
  2384 	virtual void SetBrushStyle(TBrushStyle aBrushStyle)=0;
       
  2385 
       
  2386 	/** Sets the brush pattern origin.
       
  2387 	
       
  2388 	This specifies the top left-hand corner position for the pattern tile around 
       
  2389 	which copies of the pattern are tiled.
       
  2390 	
       
  2391 	The brush pattern may be a built-in style, or a bitmap. To use a bitmap, the 
       
  2392 	brush must have a pattern set and the brush style must be set to 
       
  2393 	TBrushStyle::EPatternedBrush.
       
  2394 	
       
  2395 	Notes
       
  2396 	
       
  2397 	The brush is used for filling shapes and the background of text boxes. The 
       
  2398 	brush has colour, style, pattern and pattern origin parameters.
       
  2399 	
       
  2400 	If SetBrushOrigin() is not used, then the origin defaults to (0,0).
       
  2401 	
       
  2402 	This brush origin remains in effect for all fillable shapes drawn 
       
  2403 	subsequently, until a new brush origin is set. Shapes can thus be 
       
  2404 	considered as windows onto a continuous pattern field (covering the whole 
       
  2405 	clipping region of a screen device, or the whole device area of a printer).
       
  2406 	
       
  2407 	@param aOrigin An origin point for the brush. The coordinates are relative 
       
  2408 	to the rectangle to fill, i.e. specify 0,0 to align the pattern flush with 
       
  2409 	the top and left hand sides of the rectangle.
       
  2410 	@see SetBrushStyle()
       
  2411 	@see UseBrushPattern() */
       
  2412 	virtual void SetBrushOrigin(const TPoint& aOrigin)=0;
       
  2413 
       
  2414 	/** Sets the brush pattern to the specified bitmap.
       
  2415 	
       
  2416 	For the brush to actually use the bitmap, TBrushStyle::EPatternedBrush must 
       
  2417 	be used to set the brush style.
       
  2418 	
       
  2419 	When the brush pattern is no longer required, use DiscardBrushPattern() to 
       
  2420 	free up the memory used, if the bitmap is not being shared. 
       
  2421 	If UseBrushPattern() is used again without using DiscardBrushPattern() 
       
  2422 	then the previous pattern is discarded automatically.
       
  2423 	
       
  2424 	Notes:
       
  2425 	
       
  2426 	The brush is used for filling shapes and the background of text boxes. The 
       
  2427 	brush has colour, style, pattern and pattern origin parameters.
       
  2428 	
       
  2429 	When loading a bitmap, the bitmap is checked to see if it is already in 
       
  2430 	memory. If the bitmap is already there, then that copy is shared.
       
  2431 	
       
  2432 	The brush does not need to have a pattern set at all. There are several 
       
  2433 	built-in hatching patterns which can be selected using SetBrushStyle().
       
  2434 	
       
  2435 	@param aBitmap A bitmap pattern for the brush. 
       
  2436 	@see SetBrushStyle() */
       
  2437 	virtual void UseBrushPattern(const CFbsBitmap* aBitmap)=0;
       
  2438 
       
  2439 	/** Discards a non-built-in brush pattern.
       
  2440 	
       
  2441 	This frees up the memory used by the bitmap, if it is not being shared by 
       
  2442 	another process.
       
  2443 	
       
  2444 	Notes:
       
  2445 	
       
  2446 	The brush is used for filling shapes and the background of text boxes. The 
       
  2447 	brush has colour, style, pattern and pattern origin parameters.
       
  2448 	
       
  2449 	If DiscardBrushPattern() is used, with no brush pattern set, then there is 
       
  2450 	no effect. */
       
  2451 	virtual void DiscardBrushPattern()=0;
       
  2452 
       
  2453 
       
  2454 	/** Sets the drawing point relative to the co-ordinate origin. 
       
  2455 	
       
  2456 	A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing 
       
  2457 	point as the start point for the line drawn.
       
  2458 	
       
  2459 	Notes
       
  2460 	
       
  2461 	The operations DrawLine(), DrawLineTo(), DrawLineBy() and DrawPolyline() 
       
  2462 	also change the internal drawing position to the last point of the drawn 
       
  2463 	line(s). 
       
  2464 	
       
  2465 	The internal drawing position is set to the co-ordinate origin if no drawing 
       
  2466 	or moving operations have yet taken place.
       
  2467 	
       
  2468 	@param aPoint The new internal drawing position. */
       
  2469 	virtual void MoveTo(const TPoint& aPoint)=0;
       
  2470 
       
  2471 	/** Sets the drawing point relative to the current co-ordinates.
       
  2472 	
       
  2473 	A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing point 
       
  2474 	as the start point for the line drawn.
       
  2475 	
       
  2476 	Notes
       
  2477 	
       
  2478 	The operations DrawLine(), DrawLineTo(), DrawLineBy() and DrawPolyline() 
       
  2479 	also change the internal drawing position to the last point of the drawn 
       
  2480 	line(s). 
       
  2481 	
       
  2482 	The internal drawing position is set to the co-ordinate origin if no drawing 
       
  2483 	or moving operations have yet taken place.
       
  2484 	
       
  2485 	@param aVector The amount by which the internal drawing position is to move. */
       
  2486 	virtual void MoveBy(const TPoint& aVector)=0;
       
  2487 
       
  2488 	/** Draws a single point. The point is drawn with the current pen settings 
       
  2489 	using the current drawing mode.
       
  2490 	
       
  2491 	Note:
       
  2492 	
       
  2493 	If the pen size is greater than one pixel, a filled circle of the current 
       
  2494 	pen colour is drawn, with the pen size as the diameter and the plotted point 
       
  2495 	as the centre. If the pen size is an even number of pixels, the extra pixels 
       
  2496 	are drawn below and to the right of the centre.
       
  2497 	
       
  2498 	@param aPoint The point to be drawn.
       
  2499 	@see SetPenSize() */
       
  2500 	virtual void Plot(const TPoint& aPoint)=0;
       
  2501 
       
  2502 	/** Draws an arc.
       
  2503 	
       
  2504 	The arc is considered a portion of an ellipse. The ellipse is defined by the 
       
  2505 	TRect argument.
       
  2506 	
       
  2507 	The pixels at both the start point and the end point are drawn.
       
  2508 	
       
  2509 	The arc itself is the segment of the ellipse drawn in an anti-clockwise 
       
  2510 	direction from the start point to the end point.
       
  2511 	
       
  2512 	Notes:
       
  2513 	
       
  2514 	A rectangle is used in the construction of the ellipse of which the arc is 
       
  2515 	a segment. This rectangle is passed as an argument of type TRect.
       
  2516 	
       
  2517 	A wide line arc is drawn with the pixels distributed either side of a true 
       
  2518 	ellipse, in such a way that the outer edge of the line would touch the edge 
       
  2519 	of the construction rectangle. In other words, the ellipse used to 
       
  2520 	construct it is slightly smaller than that for a single pixel line size.
       
  2521 	
       
  2522 	If the specified start or end point is at the centre of the ellipse, then 
       
  2523 	the line that defines the start or end of the arc defaults to one extending 
       
  2524 	vertically above the centre point.
       
  2525 	
       
  2526 	If the start and end point are the same point or are points on the same line 
       
  2527 	through the ellipse centre then a complete unfilled ellipse is drawn.
       
  2528 	
       
  2529 	@param aRect A rectangle in which to draw the ellipse, of which the arc is 
       
  2530 	a segment. 
       
  2531 	@param aStart The point defining the start of the arc. It defines one end of 
       
  2532 	a line from the geometric centre of the ellipse. The point of intersection 
       
  2533 	between this line and the ellipse defines the start point of the arc.
       
  2534 	@param aEnd The point defining the end of the arc. It defines one end of a 
       
  2535 	second line from the geometric centre of the ellipse. The point of 
       
  2536 	intersection between this line and the ellipse defines the end point of the 
       
  2537 	arc.
       
  2538 	@see DrawEllipse() */
       
  2539 	virtual void DrawArc(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;
       
  2540 
       
  2541 	/** Draws a straight line between two points.
       
  2542 	
       
  2543 	@param aPoint1 The point at the start of the line. 
       
  2544 	@param aPoint2 The point at the end of the line. */
       
  2545 	virtual void DrawLine(const TPoint& aPoint1,const TPoint& aPoint2)=0;
       
  2546 
       
  2547 	/** Draws a straight line from the current drawing point to a specified 
       
  2548 	point.
       
  2549 	
       
  2550 	@param aPoint The point at the end of the line. 
       
  2551 	@see MoveTo()
       
  2552 	@see MoveBy() */
       
  2553 	virtual void DrawLineTo(const TPoint& aPoint)=0;
       
  2554 
       
  2555 	/** Draws a straight line relative to the current drawing point, using a 
       
  2556 	vector.
       
  2557 	
       
  2558 	The start point of the line is the current drawing point. The specified 
       
  2559 	vector 
       
  2560 	is added to the drawing point to give the end point of the line
       
  2561 	
       
  2562 	@param aVector The vector to add to the current internal drawing position, 
       
  2563 	giving the end point of the line. 
       
  2564 	@see MoveTo()
       
  2565 	@see MoveBy() */
       
  2566 	virtual void DrawLineBy(const TPoint& aVector)=0;
       
  2567 
       
  2568 	/** Draws a polyline from a set of points in an array.
       
  2569 	
       
  2570 	A polyline is a series of concatenated straight lines joining a set of 
       
  2571 	points.
       
  2572 	
       
  2573 	@param aPointList An array containing the points on the polyline. */
       
  2574 	virtual void DrawPolyLine(const CArrayFix<TPoint>* aPointList)=0;
       
  2575 
       
  2576 	/** Draws a polyline from a set of points in a list.
       
  2577 	
       
  2578 	A polyline is a series of concatenated straight lines joining a set of 
       
  2579 	points.
       
  2580 	
       
  2581 	@param aPointList Pointer to a set of points on the polyline.
       
  2582 	@param aNumPoints Number of points in the list. */
       
  2583 	virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)=0;
       
  2584 
       
  2585 	/** Draws and fills a pie slice.
       
  2586 	
       
  2587 	The pie slice is an area bounded by:
       
  2588 	
       
  2589 	the arc of an ellipse drawn in an anticlockwise direction from the start 
       
  2590 	point to the end point
       
  2591 	
       
  2592 	the straight line drawn to the start point from the geometric centre of the 
       
  2593 	ellipse.
       
  2594 	
       
  2595 	the straight line to the end point from the geometric centre of the ellipse.
       
  2596 	
       
  2597 	Notes:
       
  2598 	
       
  2599 	A rectangle is used in the construction of the pie slice. This rectangle is 
       
  2600 	passed as an argument of type TRect. The curved edge of the pie slice is an 
       
  2601 	arc of an ellipse constructed within the rectangle.
       
  2602 	
       
  2603 	The line drawn by the pen goes inside the specified rectangle.
       
  2604 	
       
  2605 	The pixels at the end point of the arc are not drawn.
       
  2606 	
       
  2607 	A wide line edged pie slice has the arc drawn with the pixels distributed 
       
  2608 	either side of a true ellipse. This is done in such a way that the outer 
       
  2609 	edge of the line touches the edge of the construction rectangle. In other 
       
  2610 	words, the ellipse used to construct it is slightly smaller than that for 
       
  2611 	a single pixel line size.
       
  2612 	
       
  2613 	If the specified start or end point is at the centre of the ellipse, then 
       
  2614 	the line that defines the start or end of the arc defaults to one extending 
       
  2615 	vertically above the centre point.
       
  2616 	
       
  2617 	If the start and end point are the same point or are points on the same line 
       
  2618 	through the ellipse centre then a complete filled ellipse is drawn. A line 
       
  2619 	is also drawn from the edge to the ellipse centre.
       
  2620 	
       
  2621 	@param aRect A rectangle in which to draw the ellipse bounding the pie slice. 
       
  2622 	@param aStart A point defining the start of the arc bounding the pie slice. 
       
  2623 	It defines one end of a line from the geometrical centre of the ellipse. The 
       
  2624 	point of intersection between this line and the ellipse defines the start 
       
  2625 	point of the arc.
       
  2626 	@param aEnd A point to define the end of the arc bounding the pie slice. It 
       
  2627 	defines one end of a second line from the geometrical centre of the ellipse. 
       
  2628 	The point of intersection between this line and the ellipse defines the end 
       
  2629 	point of the arc. */
       
  2630 	virtual void DrawPie(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;
       
  2631 
       
  2632 	/** Draws and fills an ellipse.
       
  2633 	
       
  2634 	The ellipse is drawn inside the rectangle defined by the TRect argument. Any 
       
  2635 	rectangle that has odd pixel dimensions, has the bottom right corner trimmed 
       
  2636 	to give even pixel dimensions before the ellipse is constructed.
       
  2637 	
       
  2638 	Note:
       
  2639 	
       
  2640 	A wide outline ellipse is drawn with the pixels distributed either side of 
       
  2641 	a true ellipse, in such a way that the outer edge of the line touches the 
       
  2642 	edge of the construction rectangle. In other words, the ellipse used to 
       
  2643 	construct it is smaller than that for a single pixel line size.
       
  2644 	
       
  2645 	@param aRect The rectangle in which the ellipse is drawn. */
       
  2646 	virtual void DrawEllipse(const TRect& aRect)=0;
       
  2647 
       
  2648 	/** Draws and fills a rectangle.
       
  2649 	
       
  2650 	@param aRect The rectangle to be drawn. */
       
  2651 	virtual void DrawRect(const TRect& aRect)=0;
       
  2652 
       
  2653 	/** Draws and fills a rectangle with rounded corners.
       
  2654 	
       
  2655 	The rounded corners are each constructed as an arc of an ellipse.
       
  2656 	
       
  2657 	The line drawn by the pen, if any, goes inside the specified rectangle.
       
  2658 	
       
  2659 	Notes:
       
  2660 	
       
  2661 	Dotted and dashed pen styles cannot be used for the outline of a rounded 
       
  2662 	rectangle.
       
  2663 	
       
  2664 	If either corner size dimension is greater than half the corresponding 
       
  2665 	rectangle length, the corner size dimension is reduced to half the 
       
  2666 	rectangle size.
       
  2667 	
       
  2668 	@param aRect The rectangle to be drawn. 
       
  2669 	@param aCornerSize The dimensions of each corner. 
       
  2670 	@see DrawArc() */
       
  2671 	virtual void DrawRoundRect(const TRect& aRect,const TSize& aCornerSize)=0;
       
  2672 
       
  2673 	/** Draws and fills a polygon defined using an array of points.
       
  2674 	
       
  2675 	The first point in the array defines the start of the first side of the 
       
  2676 	polygon. The second point defines the second vertex (the end point of the 
       
  2677 	first side and the start point of the second side).
       
  2678 	
       
  2679 	The final side of the polygon is drawn using the last point from the array, 
       
  2680 	and the line is drawn to the start point of the first side.
       
  2681 	
       
  2682 	Self-crossing polygons are filled according to the specified fill rule.
       
  2683 	
       
  2684 	@param aPointList An array of points, specifying the vertices of the polygon.
       
  2685 	@param aFillRule The fill rule. By default, this is TFillRule::EAlternate. 
       
  2686 	@return KErrNone, if successful; otherwise, another of the system-wide error 
       
  2687 	codes. */
       
  2688 	virtual TInt DrawPolygon(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule=EAlternate)=0;
       
  2689 
       
  2690 	/** Draws and fills a polygon defined using a list of points.
       
  2691 	
       
  2692 	The first point in the list defines the start of the first side of the 
       
  2693 	polygon. The second point defines the second vertex (the end point of the 
       
  2694 	first side and the start point of the second side).
       
  2695 	
       
  2696 	The final side of the polygon is drawn using the last point from the list, 
       
  2697 	and the line is drawn to the start point of the first side.
       
  2698 	
       
  2699 	Self-crossing polygons are filled according to the specified fill rule.
       
  2700 	
       
  2701 	@param aPointList Pointer to list of points, specifying the vertices of the 
       
  2702 	polygon.
       
  2703 	@param aNumPoints The number of points in the list.
       
  2704 	@param aFillRule The fill rule. By default this is TFillRule::EAlternate. 
       
  2705 	@return KErrNone, if successful; otherwise, another of the system-wide error 
       
  2706 	codes. */
       
  2707 	virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate)=0;
       
  2708 
       
  2709 	/** Draws a bitmap at the specified point.
       
  2710 	
       
  2711 	The point specifies the top left hand corner of the bitmap. The bitmap is 
       
  2712 	compressed or stretched based on its internally stored size in twips.
       
  2713 	
       
  2714 	Notes:
       
  2715 	
       
  2716 	This member function uses the bitmap's size in twips and does a 
       
  2717 	stretch/compress blit using a linear DDA.
       
  2718 	
       
  2719 	As this function scales the bitmap, it is unavoidably slow. Therefore, where 
       
  2720 	possible, use CBitmapContext::BitBlt() instead. If the bitmap has to be 
       
  2721 	scaled, consider creating another bitmap along with an CFbsBitmapDevice etc, 
       
  2722 	doing DrawBitmap() once and using BitBlt() subsequently.
       
  2723 	
       
  2724 	Note that all bitmaps are clipped to the device boundaries.
       
  2725 	
       
  2726 	@param aTopLeft The point where the top left pixel of the bitmap is to be 
       
  2727 	drawn 
       
  2728 	@param aSource A source bitmap 
       
  2729 	@see TLinearDDA */
       
  2730 	virtual void DrawBitmap(const TPoint& aTopLeft,const CFbsBitmap* aSource)=0;
       
  2731 
       
  2732 	/** Draws a bitmap to fit a given rectangle. 
       
  2733 	
       
  2734 	The bitmap is compressed or stretched based on its internally stored size 
       
  2735 	in pixels.
       
  2736 	
       
  2737 	Notes:
       
  2738 	
       
  2739 	This member function uses the bitmap's size in pixels and does a 
       
  2740 	stretch/compress blit using a linear DDA.
       
  2741 	
       
  2742 	As this function scales the bitmap, it is unavoidably slow. Therefore, 
       
  2743 	where possible, use CBitmapContext::BitBlt() instead. If the bitmap has 
       
  2744 	to be scaled, consider creating another bitmap along with an 
       
  2745 	CFbsBitmapDevice etc., doing DrawBitmap() once and using BitBlt() 
       
  2746 	subsequently.
       
  2747 	
       
  2748 	Note that all bitmaps are clipped to the device boundaries.
       
  2749 	
       
  2750 	@param aDestRect The rectangle within which the bitmap is to be drawn. 
       
  2751 	@param aSource A source bitmap. 
       
  2752 	@see TLinearDDA */
       
  2753 	virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource)=0;
       
  2754 
       
  2755 	/** Draws a specified rectangle of a source bitmap to fit into a given 
       
  2756 	destination rectangle.
       
  2757 	
       
  2758 	Notes:
       
  2759 	
       
  2760 	This member function uses rectangle sizes in pixels and does a 
       
  2761 	stretch/compress blit using a linear DDA.
       
  2762 	
       
  2763 	As this function scales the bitmap, it is unavoidably slow. Therefore, 
       
  2764 	where possible, use CBitmapContext::BitBlt() instead. If the bitmap has 
       
  2765 	to be scaled, consider creating another bitmap along with an 
       
  2766 	CFbsBitmapDevice etc., doing DrawBitmap() once and using BitBlt() 
       
  2767 	subsequently.
       
  2768 	
       
  2769 	Note that all bitmaps are clipped to the device boundaries.
       
  2770 	
       
  2771 	@param aDestRect The rectangle within which the bitmap is to be drawn. 
       
  2772 	@param aSource A source bitmap. 
       
  2773 	@param aSourceRect The rectangle in the source bitmap that is copied to the 
       
  2774 	destination rectangle. 
       
  2775 	@see TLinearDDA */
       
  2776 	virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource,const TRect& aSourceRect)=0;
       
  2777 
       
  2778 	/** Draws a specified rectangle of a source bitmap to fit into a given rectangle using a given mask.
       
  2779 
       
  2780 	Notes:
       
  2781 	
       
  2782 	  This member function uses rectangle sizes in pixels and does a 
       
  2783 	stretch/compress blit using a linear DDA.
       
  2784 	
       
  2785 	
       
  2786 	@param aDestRect The rectangle within which the bitmap is to be drawn. 
       
  2787 	@param aBitmap The source bitmap
       
  2788 	@param aSourceRect The rectangle in the source bitmap that is to be drawn
       
  2789 	@param aMaskBitmap The mask to be applied to the source bitmap while drawing
       
  2790 	@param aInvertMask Flag to indicate if the mask should be inverted.
       
  2791 	*/
       
  2792 	virtual void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)=0;
       
  2793 
       
  2794 	/** Draws a specified rectangle from a wserv bitmap and its mask into 
       
  2795 	another rectangle.
       
  2796 
       
  2797 	The function compresses/stretches the specified rectangle from the bitmap 
       
  2798 	to fit the destination rectangle. 
       
  2799 	The mask bitmap can be used as either a positive or negative mask. Masked 
       
  2800 	pixels are not mapped to the destination rectangle.
       
  2801 
       
  2802 	A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black 
       
  2803 	pixels in the mask bitmap stop corresponding pixels in the source bitmap from 
       
  2804 	being transferred to the destination rectangle. With aInvertMask=ETrue, white 
       
  2805 	pixels in the mask bitmap stop corresponding pixels in the source bitmap from 
       
  2806 	being transferred to the destination rectangle.
       
  2807 
       
  2808 	Note: this member function uses rectangle sizes in pixels and does a stretch/compress 
       
  2809 	blit using a linear DDA.
       
  2810 
       
  2811 	@param aDestRect The rectangle within which the masked bitmap is to be drawn. 
       
  2812 	@param aBitmap A source wserv bitmap. 
       
  2813 	@param aSourceRect The rectangle in the source bitmap that is copied to the 
       
  2814 	destination rectangle.
       
  2815 	@param aMaskBitmap A mask wserv bitmap. 
       
  2816 	@param aInvertMask If false, a source pixel that is masked by a black pixel 
       
  2817 	is not transferred to the destination rectangle. If true, then a source pixel 
       
  2818 	that is masked by a white pixel is not transferred to the destination rectangle. */
       
  2819 	virtual void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask)=0;
       
  2820 
       
  2821 	/** Draws text without a surrounding box. 
       
  2822 	
       
  2823 	The text baseline is aligned with the y co-ordinate of the specified point, 
       
  2824 	and the left end of the text is aligned with the x co-ordinate of the 
       
  2825 	specified point.
       
  2826 	
       
  2827 	Note:
       
  2828 	
       
  2829 	Text drawing is done with the pen, and is subject to the pen colour. The 
       
  2830 	effective text colour also depends on the drawing mode. The size and style 
       
  2831 	of the text depends on the font used. The layout of the text depends on the 
       
  2832 	justification mode set.
       
  2833 	
       
  2834 	@param aText The text string to be drawn. 
       
  2835 	@param aPosition A point specifying the position of the left end of the text. */
       
  2836 	virtual void DrawText(const TDesC& aText,const TPoint& aPosition) = 0;
       
  2837 
       
  2838 	/** Draws text inside a box.
       
  2839 	
       
  2840 	The surrounding box is filled with the current brush colour (not a pattern) 
       
  2841 	and is drawn without any outline. The effective box colour depends on the 
       
  2842 	drawing mode - if a brush colour has not been set then the brush defaults 
       
  2843 	to white. The brush may be set to TBrushStyle::ENullBrush if text 
       
  2844 	positioning relative to a box is required, but the box should not be filled.
       
  2845 	
       
  2846 	The font used is that set by UseFont(). If no font is in use then a panic 
       
  2847 	occurs.
       
  2848 	
       
  2849 	The alignment of the text within the box can be specified.
       
  2850 	
       
  2851 	Text drawn within a box is also clipped to that box. Unless you intend to 
       
  2852 	clip the top off the text, aBaselineOffset should be greater than or equal 
       
  2853 	to the ascent of the current font.
       
  2854 	
       
  2855 	Offsets:
       
  2856 	
       
  2857 	If the offset is negative, zero, or less than font height this is handled 
       
  2858 	as would be expected, i.e. no text will be seen in the box in the first two 
       
  2859 	instances, and the top of the text will be clipped in the latter case.
       
  2860 	
       
  2861 	Margins:
       
  2862 	
       
  2863 	For the drawing of right-aligned text, aLeftMargin indicates the margin from 
       
  2864 	the right of aBox - where a positive value results in a leftwards offset. 
       
  2865 	
       
  2866 	Negative margins can be used to display portions of the text string clipped 
       
  2867 	by the box. A negative margin for left aligned text would clip the start of 
       
  2868 	the text string. Similarly, a negative margin for right aligned text would 
       
  2869 	clip the end of the text string.
       
  2870 	
       
  2871 	If the margin is greater than the width of the box then no text will be 
       
  2872 	visible.
       
  2873 	
       
  2874 	The margin is still honoured for centred text - centred text will not be 
       
  2875 	centred in the box, unless the margin is zero.
       
  2876 	
       
  2877 	Note:
       
  2878 	
       
  2879 	Text drawing is done with the pen, and is thus subject to the pen colour. 
       
  2880 	The effective text colour also depends on the drawing mode. The size and 
       
  2881 	style of the text depends on the used font. The layout of the text depends 
       
  2882 	on the justification mode set.
       
  2883 	
       
  2884 	@param aText The text string to be drawn. 
       
  2885 	@param aBox The box to draw the text in. 
       
  2886 	@param aBaselineOffset An offset from the top of the box to the text 
       
  2887 	baseline. 
       
  2888 	@param aAlignment The text alignment mode default is left aligned. 
       
  2889 	@param aLeftMargin The left margin for left-aligned text, or the right 
       
  2890 	margin 
       
  2891 	for right-aligned text default is zero. */
       
  2892 	virtual void DrawText(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TTextAlign aAlignment = ELeft,
       
  2893 		TInt aLeftMargin = 0) = 0;
       
  2894 	IMPORT_C virtual void DrawText(const TDesC& aText,const TPoint& aPosition,const TDrawTextParam& aParam);
       
  2895 	IMPORT_C virtual void Reserved();
       
  2896 	IMPORT_C TInt DrawTextExtended(const TDesC& aText,const TPoint& aPosition,const TDrawTextExtendedParam& aParam);
       
  2897 							
       
  2898 	/** Maps pixels in the specified rectangle.
       
  2899 	The function tries to match the colour of a pixel with one of the RGB values 
       
  2900 	in an array of RGB pairs. If there is a match, the colour is changed to the 
       
  2901 	value specified in the other RGB in the RGB pair.
       
  2902 	@param aRect The rectangle in which pixels are to be mapped.
       
  2903 	@param aColors A pointer to a set of RGB pairs. 
       
  2904 	@param aNumPairs The number of pairs 
       
  2905 	@param aMapForwards ETrue, mapping is done from the first RGB to the second 
       
  2906 	RGB in the pair; EFalse, mapping is done from the second RGB to the first 
       
  2907 	RGB in the pair. */	
       
  2908 	virtual void MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards) = 0;
       
  2909 	
       
  2910 	/** Sets the clipping region, any items that fall outside the extent of the clipping 
       
  2911 	region will not be drawn.
       
  2912 	
       
  2913 	Note that clipping is additive. If a clipping rectangle has been set using SetClippingRect() 
       
  2914 	then clipping will be to the intersection of that rectangle and this region.
       
  2915 	
       
  2916 	@param aRegion The new clipping region. Note that clipping region co-ordinates are
       
  2917 	used as absolute co-ordinates, they are not transformed by the current co-ordinate 
       
  2918 	origin before use (as occurs in SetClippingRect()).
       
  2919 	 
       
  2920 	@return KErrNone if successful; KErrArgument if the TRegion is not valid; KErrNoMemory if there is insufficient memory.
       
  2921 	
       
  2922 	@see CGraphicsContext::CancelClippingRegion() 
       
  2923 	@see CGraphicsContext::SetClippingRect() */		
       
  2924 	virtual TInt SetClippingRegion(const TRegion &aRegion) = 0;
       
  2925 	
       
  2926 	/** Cancels the current clipping region. 
       
  2927 	@see CGraphicsContext::SetClippingRegion()*/
       
  2928 	virtual void CancelClippingRegion() = 0;
       
  2929 	
       
  2930 	/** Draws vertical text in the specified direction.
       
  2931 	@param aText The text to be drawn. 
       
  2932 	@param aPos Point of origin of the text baseline. 
       
  2933 	@param aUp Direction. ETrue for up, EFalse for down. */
       
  2934 	virtual void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp) = 0;
       
  2935 	
       
  2936 	/** Draws text vertically in the specified direction, within a box of the specified size.
       
  2937 	@param aText The text to be drawn. 
       
  2938 	@param aBox The bounding box within which the text should be drawn, and which it is clipped to.
       
  2939 	@param aBaselineOffset The height of the top of the characters from their text baseline. 
       
  2940 	@param aUp The direction. ETrue for up, EFalse for down.
       
  2941 	@param aVert The text alignment. 
       
  2942 	@param aMargin The margin. */	
       
  2943 	virtual void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
       
  2944 	
       
  2945 	IMPORT_C TInt GetUnderlineMetrics(TInt& aTop,TInt& aBottom);
       
  2946 
       
  2947 	/** Set the font's shadow colour
       
  2948 	@param aShadowColor Shadow colour to be set.
       
  2949 	@return KErrNone, if successful; otherwise, another of the system-wide errors. */
       
  2950 	IMPORT_C TInt SetShadowColor(const TRgb& aShadowColor);
       
  2951 
       
  2952 	/** Get the font's shadow colour
       
  2953 	@param aShadowColor Shadow colour of the font returned by the funtion.
       
  2954 	@return KErrNone, if successful; otherwise, another of the system-wide errors. */
       
  2955 	IMPORT_C TInt GetShadowColor(TRgb& aShadowColor);
       
  2956 
       
  2957 	/** Determine if the Gc is a CFbsBitGc
       
  2958 	@return ETrue, if the Gc is a CFbsBitGc, EFalse otherwise 
       
  2959 	@publishedAll
       
  2960 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases.
       
  2961 	*/
       
  2962 	IMPORT_C TBool IsFbsBitGc() const;
       
  2963 
       
  2964 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition);
       
  2965 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
       
  2966 	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextParam& aParam);
       
  2967 
       
  2968 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPos,TBool aUp);
       
  2969 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
       
  2970 	
       
  2971 	IMPORT_C TInt DrawTextExtended(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextExtendedParam& aParam);
       
  2972 	
       
  2973 protected:
       
  2974 
       
  2975 	/**
       
  2976 	An APIExtension method to allow the addition of new APIs to retain compatibility 
       
  2977 	with previous versions of gdi.dll
       
  2978 	@param aOutput is for output
       
  2979 	@param aInput is for input
       
  2980 	@see CGraphicsContext
       
  2981 	@publishedAll
       
  2982 	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases.
       
  2983 	*/
       
  2984 	IMPORT_C virtual TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);	
       
  2985 	
       
  2986 	/**
       
  2987 	A reserved virtual function for future use.
       
  2988 	*/
       
  2989 	IMPORT_C virtual void Reserved_CGraphicsContext_2();		
       
  2990 	};
       
  2991 
       
  2992 
       
  2993 /** An abstract, device-independent, interface to bitmapped graphics contexts.
       
  2994 
       
  2995 This holds the setting used to draw to a CBitmapDevice.
       
  2996 
       
  2997 The default settings of a CBitmapContext object immediately after construction 
       
  2998 are:
       
  2999 
       
  3000 drawing mode is EDrawModePen (pen and brush colours used as they are)
       
  3001 
       
  3002 no clipping rectangle
       
  3003 
       
  3004 pen settings are: black, solid, single pixel width
       
  3005 
       
  3006 brush style is null
       
  3007 
       
  3008 no text font selected
       
  3009 
       
  3010 The classes CFbsBitGc and CWindowGc are derived from this class.
       
  3011 
       
  3012 @see CFbsBitGc 
       
  3013 @publishedAll
       
  3014 @released
       
  3015 */
       
  3016 class CBitmapContext : public CGraphicsContext
       
  3017 	{
       
  3018 public:
       
  3019 	/** Clears the whole bitmap.
       
  3020 	
       
  3021 	The cleared area is filled with the current brush colour.
       
  3022 	
       
  3023 	This pure virtual function is implemented in derived classes. */
       
  3024 	virtual void Clear()=0;
       
  3025 
       
  3026 	/** Clears a rectangular area of a bitmap.
       
  3027 	
       
  3028 	The cleared area is filled with the current brush colour.
       
  3029 	
       
  3030 	This pure virtual function is implemented in derived classes.
       
  3031 	
       
  3032 	@param aRect The rectangle to clear. */
       
  3033 	virtual void Clear(const TRect& aRect)=0;
       
  3034 
       
  3035 	/** Copies a rectangle.
       
  3036 	
       
  3037 	This pure virtual function is implemented in derived classes.
       
  3038 	
       
  3039 	@param aOffset The offset from the top left corner of the rectangle to be 
       
  3040 	copied to the top left corner of the copy.
       
  3041 	@param aRect The rectangular area to be copied. */
       
  3042 	virtual void CopyRect(const TPoint& aOffset,const TRect& aRect)=0;
       
  3043 
       
  3044 	/** Performs a bitmap block transfer.
       
  3045 	
       
  3046 	This pure virtual function is implemented in derived classes.
       
  3047 	
       
  3048 	@param aPoint The destination for the top left corner of the transferred bitmap. 
       
  3049 	It is relative to the top left corner of the destination bitmap, which may be the screen.
       
  3050 	@param aBitmap A memory-resident bitmap. */
       
  3051 	virtual void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap)=0;
       
  3052 
       
  3053 	/** Performs a bitmap block transfer of a rectangular piece of a bitmap.
       
  3054 	
       
  3055 	If the specified rectangle is larger than the bitmap then the bitmap is 
       
  3056 	padded with white.
       
  3057 	
       
  3058 	This pure virtual function is implemented in derived classes.
       
  3059 	
       
  3060 	@param aPoint The destination for the top left corner of the transferred bitmap.
       
  3061 	It is relative to the top left corner of the destination bitmap, which may be the screen.
       
  3062 	
       
  3063 	@param aBitmap A memory-resident bitmap 
       
  3064 	@param aRect A rectangle defining the portion of the bitmap to transfer. 
       
  3065 	Its coordinates are relative to the top left corner of the source bitmap.   */
       
  3066 	virtual void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aRect)=0;
       
  3067 
       
  3068 	/** Performs a masked bitmap block transfer.
       
  3069 	
       
  3070 	The mask bitmap can be used as either a positive or negative mask. Masked 
       
  3071 	pixels are not mapped to the destination rectangle.
       
  3072 	
       
  3073 	This function uses either a black and white (binary) mask bitmap, or if 
       
  3074 	aMaskBitmap's display mode is EGray256, alpha blending is used. Use of 
       
  3075 	any other mode may result in unpredictable results
       
  3076 	
       
  3077 	With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding 
       
  3078 	pixels in the source bitmap from being transferred to the destination rectangle. 
       
  3079 	With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding 
       
  3080 	pixels in the source bitmap from being transferred to the destination 
       
  3081 	rectangle.
       
  3082 	
       
  3083 	Note that if the mask bitmap is smaller than the source bitmap, then it is 
       
  3084 	tiled across the bitmap. Note that the mask is applied before the piece of 
       
  3085 	the bitmap is defined - the mask is tiled relative to the top left of the 
       
  3086 	original source bitmap rather than the top left of the bitmap piece.
       
  3087 	
       
  3088 	This pure virtual function is implemented in derived classes.
       
  3089 	
       
  3090 	@param aPoint The destination for the top left corner of the transferred bitmap. 
       
  3091 	It is relative to the top left corner of the destination bitmap, which may be the screen. 
       
  3092 	@param aBitmap A memory-resident source bitmap. 
       
  3093 	@param aSourceRect A rectangle defining the piece of the bitmap to be drawn, 
       
  3094 	with co-ordinates relative to the top left corner of the bitmap. 
       
  3095 	@param aMaskBitmap A mask bitmap 
       
  3096 	@param aInvertMask If  EFalse, a source pixel that is masked by a black pixel 
       
  3097 	is not transferred to the destination rectangle. If ETrue, then a source 
       
  3098 	pixel that is masked by a white pixel is not transferred to the destination 
       
  3099 	rectangle. */
       
  3100 	virtual void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)=0;
       
  3101 
       
  3102 	/** Sets whether the graphics context is faded.
       
  3103 	
       
  3104 	@param aFaded ETrue to fade the GC; EFalse to unfade it. */
       
  3105 	virtual void SetFaded(TBool aFaded)=0;
       
  3106 
       
  3107 	/** Sets the fading parameters.
       
  3108 	
       
  3109 	This function allows you to override the map used when drawing with a faded 
       
  3110 	graphics context (GC). However if you draw to a faded window with a faded 
       
  3111 	GC, then fading on the GC is ignored and the fading of the window is used.
       
  3112 	
       
  3113 	Fading is used to change the colour of a window to make other windows stand 
       
  3114 	out. Fading can either make a faded window closer to white or closer to 
       
  3115 	black.
       
  3116 	
       
  3117 	Fading re-maps colours in the faded GC to fall between the specified black 
       
  3118 	and white map values. If aBlackMap=0 and aWhiteMap=255 then the colours are 
       
  3119 	mapped unchanged. As the values converge the colours are mapped to a smaller 
       
  3120 	range - so the differences between colours in the faded GC decrease. If 
       
  3121 	the values are reversed then the colours are inverted (i.e. where the GC 
       
  3122 	would be black, it is now white). 
       
  3123 	
       
  3124 	@param aBlackMap Black map fading parameter. Unfaded this is 0. 
       
  3125 	@param aWhiteMap White map fading parameter. Unfaded this is 255. */
       
  3126 	virtual void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap)=0;
       
  3127 
       
  3128 	/**
       
  3129 	Performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using
       
  3130 	the data from aAlphaBmp as an alpha blending factor.
       
  3131 	The formula used is:
       
  3132 	(S * A + W * (255 - A)) / 255, where:
       
  3133 	- S - a pixel from aSrcBmp;
       
  3134 	- W - a pixel from the window;
       
  3135 	- A - a pixel from aAlphaBmp;
       
  3136 	The contents of source and alpha bitmap are preserved.
       
  3137 	The calculated alpha blended pixels are written to the destination CBitmapContext.
       
  3138 	@param aDestPt Position in the target the result should be drawn to.
       
  3139 	@param aSrcBmp A pointer to the source bitmap.
       
  3140 	@param aSrcRect The part of the source bitmap that should be used.
       
  3141 	@param aAlphaBmp A pointer to the bitmap used as an alpha blending factor.
       
  3142 	@param aAlphaPt Position of the first pixel in the alpha bitmap that should be used as a source 
       
  3143 	                for the alpha blending. The size of the area is the same as the 
       
  3144 	                source bitmap area - aSrcRect parameter.*/	
       
  3145 	
       
  3146 	virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0;	
       
  3147 	
       
  3148 	/**
       
  3149 	The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using
       
  3150 	the data from aAlphaBmp as an alpha blending factor.
       
  3151 	For information on how this function works, see the other overload.
       
  3152 	@param aDestPt Position in the target the result should be drawn to.
       
  3153 	@param aSrcBmp A pointer to the source bitmap.
       
  3154 	@param aSrcRect The part of the source bitmap that should be used.
       
  3155 	@param aAlphaBmp A pointer to the bitmap used as an alpha blending factor.
       
  3156 	@param aAlphaPt Position of the first pixel in the alpha bitmap that should be used as a source 
       
  3157 	                for the alpha blending. The size of the area is the same as the 
       
  3158 	                source bitmap area - aSrcRect parameter.*/
       
  3159 	virtual	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,	const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0;
       
  3160 	
       
  3161 protected:
       
  3162 
       
  3163 	/*
       
  3164 	Implementations from CGraphicsContext
       
  3165 	@see CGraphicsContext::APIExtension(TUid, TAny*&, TAny*)
       
  3166 	*/
       
  3167 	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);	
       
  3168 	/*
       
  3169 	Implementations from CGraphicsContext
       
  3170 	@see CGraphicsContext::Reserved_CGraphicsContext_2()
       
  3171 	*/
       
  3172 	IMPORT_C void Reserved_CGraphicsContext_2();
       
  3173 
       
  3174 	IMPORT_C virtual void Reserved_CBitmapContext_1();
       
  3175 	IMPORT_C virtual void Reserved_CBitmapContext_2();
       
  3176 	IMPORT_C virtual void Reserved_CBitmapContext_3();
       
  3177 	};
       
  3178 
       
  3179 /** Defines an abstract interface for the capabilities and attributes of a 
       
  3180 bitmapped graphics device.
       
  3181 
       
  3182 The class specialises the graphics device interface CGraphicsDevice for bitmaps 
       
  3183 graphics. The Window Server Client-Side API provides one implementation of 
       
  3184 the interface, CWsScreenDevice, for screen drawing. Another implementation, 
       
  3185 CFbsBitmapDevice, is used for drawing to in-memory bitmaps. A third, 
       
  3186 CFbsScreenDevice, is used (rarely) to access the screen directly, without the 
       
  3187 mediation of the window server. 
       
  3188 @publishedAll
       
  3189 @released
       
  3190 */
       
  3191 class CBitmapDevice : public CGraphicsDevice
       
  3192 	{
       
  3193 public:
       
  3194 	/** Gets the RGB colour of an individual pixel on a bitmapped graphics 
       
  3195 	device. 
       
  3196 	
       
  3197 	This pure virtual function is implemented in derived classes.
       
  3198 	
       
  3199 	@param aColor On return, should contain the RGB colour of the pixel. 
       
  3200 	@param aPixel The (x,y) co-ordinates of the pixel. The top left pixel is 
       
  3201 	(0,0). */
       
  3202 	virtual void GetPixel(TRgb& aColor,const TPoint& aPixel) const=0;
       
  3203 
       
  3204 	/** Copies a scanline into a buffer.
       
  3205 	
       
  3206 	The pixels are converted from the display mode format on the bitmapped 
       
  3207 	graphics device to the format of the specified device display mode.
       
  3208 	
       
  3209 	By specifying the start pixel and the number of pixels, either the whole or 
       
  3210 	a portion of a bitmapped graphics device pixel row may be copied.
       
  3211 	
       
  3212 	This pure virtual function is implemented in derived classes.
       
  3213 	
       
  3214 	@param aBuf An 8 bit modifiable descriptor buffer into which pixels are 
       
  3215 	copied; it must be sufficiently large to store all the scanline pixels. 
       
  3216 	@param aStartPixel The (x,y) co-ordinates of the first pixel of the bitmap 
       
  3217 	scanline to be put into the buffer. 
       
  3218 	@param aLength The number of pixels to put into the buffer. 
       
  3219 	@param aDispMode The display mode into which to convert the pixels. */
       
  3220 	virtual void GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,TInt aLength,TDisplayMode aDispMode) const=0;
       
  3221 
       
  3222 	/** Adds a font file to the device's typeface store. The specified font
       
  3223 	file must be accessible to any process, i.e. not located inside an
       
  3224 	application's private directory.
       
  3225 	
       
  3226 	This pure virtual function is implemented in derived classes.
       
  3227 	
       
  3228 	@param aName The name of the font file. 
       
  3229 	@param aId On return, contains an ID for the font file. 
       
  3230 	@return KErrNone, if successful; otherwise, another of the system-wide error 
       
  3231 	codes. */
       
  3232 	virtual TInt AddFile(const TDesC& aName,TInt& aId)=0;
       
  3233 
       
  3234 	/** Removes a font file from the font store.
       
  3235 	
       
  3236 	This pure virtual function is implemented in derived classes.
       
  3237 	
       
  3238 	@param aId The ID of the font file to be removed. The default is 0. */
       
  3239 	virtual void RemoveFile(TInt aId=0)=0;
       
  3240 
       
  3241 	/**
       
  3242 	Gets the font which is the nearest to the given font specification.
       
  3243 	
       
  3244 	When the font is no longer needed, call @c ReleaseFont().
       
  3245 	
       
  3246 	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInPixels() 
       
  3247 	yielding (virtually) the same result. However clients are strongly encouraged to use the new
       
  3248 	@c GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every 
       
  3249 	character within any given text string will fit within the given amount of pixels, whereas the design 
       
  3250 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
  3251 	may result in cropped characters.
       
  3252 	
       
  3253 	@param aFont On return, contains a pointer to the nearest font.
       
  3254 	@param aFontSpec The specification of the font to be matched.
       
  3255 	@return KErrNone if successful; a system-wide error code otherwise.
       
  3256 	@publishedAll
       
  3257 	@deprecated Use GetNearestFontToDesignHeightInPixels
       
  3258 	*/
       
  3259 	virtual TInt GetNearestFontInPixels(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
       
  3260 
       
  3261 	/**
       
  3262 	Gets the font which is the nearest to the given font specification.
       
  3263 	
       
  3264 	When the font is no longer needed, call @c ReleaseFont().
       
  3265 	
       
  3266 	This new function replaces the deprecated @c GetNearestFontInPixels() yielding (virtually) the 
       
  3267 	same result. However clients are strongly encouraged to use the new
       
  3268 	@c GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every 
       
  3269 	character within any given text string will fit within the given amount of pixels, whereas the design 
       
  3270 	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
       
  3271 	may result in cropped characters.
       
  3272 
       
  3273 	@param aFont On return, contains a pointer to the nearest font.
       
  3274 	@param aFontSpec The specification of the font to be matched.
       
  3275 	@return KErrNone if successful; a system-wide error code otherwise.
       
  3276 	@publishedAll
       
  3277 	@released
       
  3278 	*/
       
  3279 	virtual TInt GetNearestFontToDesignHeightInPixels(
       
  3280 		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/) { return KErrNotSupported; }
       
  3281 
       
  3282 	/**
       
  3283 	Gets the font which is the nearest to the given font specification.
       
  3284 	
       
  3285 	When the font is no longer needed, call @c ReleaseFont().
       
  3286 	
       
  3287 	The font and bitmap server returns a pointer to the nearest matching font 
       
  3288 	from those available. Matches to max height of font - this does its best 
       
  3289 	to return a font that will fit within the maximum height specified (but 
       
  3290 	note that variations due to hinting algorithms may rarely result in this 
       
  3291 	height being exceeded by up to one pixel). Problems can also be 
       
  3292 	encountered with bitmap fonts where the typeface exists but doesn't have 
       
  3293 	a font small enough.
       
  3294 
       
  3295 	@param aFont On return, contains a pointer to the nearest font.
       
  3296 	@param aFontSpec The specification of the font to be matched.
       
  3297 	@param aMaxHeight The maximum height within which the font must fit.
       
  3298 	This overrides the height specified in aFontSpec.
       
  3299 	@return KErrNone if successful; a system-wide error code otherwise.
       
  3300 	@publishedAll
       
  3301 	@released
       
  3302 	*/
       
  3303 	virtual TInt GetNearestFontToMaxHeightInPixels(
       
  3304 		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/, TInt /*aMaxHeight*/) { return KErrNotSupported; }
       
  3305 
       
  3306 	/** Gets the height, in pixels, of the specified typeface at one of its 
       
  3307 	defined heights.
       
  3308 	
       
  3309 	The typeface is identified by by an index. For a given typeface, there are 
       
  3310 	a discrete number of heights; the specific height is also identified by an 
       
  3311 	index.
       
  3312 	
       
  3313 	The value returned is rounded up or down to the nearest font height in 
       
  3314 	pixels.
       
  3315 	
       
  3316 	This pure virtual function is implemented in derived classes.
       
  3317 	
       
  3318 	@param aTypefaceIndex A typeface index number, in the range: 0 to 
       
  3319 	(NumTypefaces() - 1). 
       
  3320 	@param aHeightIndex A font height index number, in the range: 0 to 
       
  3321 	(iNumHeights - 1) where iNumHeights is a public data member of the 
       
  3322 	TTypefaceSupport object returned by TypefaceSupport(). 
       
  3323 	@return The height of the font, in pixels.
       
  3324 	@see TTypefaceSupport
       
  3325 	@see CGraphicsDevice::NumTypefaces()
       
  3326 	@see CGraphicsDevice::TypefaceSupport() */
       
  3327 	virtual TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
       
  3328     inline TInt CreateBitmapContext(CBitmapContext*& aGC);
       
  3329 	};
       
  3330 
       
  3331 /** A set of margins used for cropping a picture. 
       
  3332 
       
  3333 Margins are specified in twips or pixels. 
       
  3334 @publishedAll
       
  3335 @released
       
  3336 */
       
  3337 class TMargins
       
  3338     {
       
  3339 public:
       
  3340 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
  3341 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
  3342 	IMPORT_C TBool operator==(const TMargins& aMargins) const;
       
  3343 	IMPORT_C TBool operator!=(const TMargins& aMargins) const;
       
  3344 public:
       
  3345 	/** Left margin, (in twips or pixels). */
       
  3346 	TInt iLeft;
       
  3347 	/** Right margin, (in twips or pixels). */
       
  3348 	TInt iRight;
       
  3349 	/** Top margin, (in twips or pixels). */
       
  3350     TInt iTop;
       
  3351 	/** Bottom margin, (in twips or pixels). */
       
  3352 	TInt iBottom;
       
  3353 	};
       
  3354 
       
  3355 /** Picture capabilities.
       
  3356 
       
  3357 These include the types of scaling that can be applied to a picture, and whether 
       
  3358 or not it is croppable. 
       
  3359 @publishedAll
       
  3360 @released
       
  3361 */
       
  3362 class TPictureCapability
       
  3363 	{
       
  3364 public:
       
  3365 	/** Scaling types. */
       
  3366 	enum TScalingType
       
  3367 		{
       
  3368 		/** The picture is not scalable. */
       
  3369 		ENotScaleable,
       
  3370 		/** The picture is fully scalable. */
       
  3371 		EFullyScaleable,
       
  3372 		/** The picture is scalable to any size, as long as its aspect ratio 
       
  3373 		(the ratio of its height to its width) remains constant. */
       
  3374 		EScaleableMaintainingAspectRatio
       
  3375 		};
       
  3376 public:
       
  3377 	inline TPictureCapability(TScalingType aScalingType,TBool aCroppable);
       
  3378 public:
       
  3379 	/** Whether or not the picture is croppable. */
       
  3380 	TScalingType iScalingType;
       
  3381 	/** Scaling type. */
       
  3382 	TBool iIsCroppable;
       
  3383 	};
       
  3384 
       
  3385 /** Abstract base class for: drawing a picture to a graphics context, storing 
       
  3386 and restoring the picture. 
       
  3387 
       
  3388 The class defines the protocol for a number of concrete picture classes. Its 
       
  3389 main role is to support glass doors used in object embedding.
       
  3390 
       
  3391 The class provides a protocol for the provision of scaling and cropping 
       
  3392 functions by derived classes, together with default implementations.
       
  3393 
       
  3394 Its main function is Draw(), which draws the picture onto the graphics context 
       
  3395 at a particular point. It also has two important pure virtual functions: 
       
  3396 ExternalizeL() and GetOriginalSizeInTwips().
       
  3397 
       
  3398 A picture has both an original representation and an on-screen representation. 
       
  3399 The original representation has a size in twips, and can somehow be drawn. 
       
  3400 The on-screen representation is assumed to be drawn under the control of an 
       
  3401 application which may wish to re-size or scale the original in some way, to 
       
  3402 crop it at the edges, and/or to ensure it fits within a particular defined 
       
  3403 area on the screen.
       
  3404 
       
  3405 The class provides several functions that allow an application to set scaling 
       
  3406 and cropping before invoking the Draw() function to draw the picture on-screen. 
       
  3407 It is up to the internal workings of the function to determine the order of 
       
  3408 application cropping and scaling. 
       
  3409 @publishedAll
       
  3410 @released
       
  3411 */
       
  3412 class CPicture : public CBase
       
  3413     {
       
  3414 public:
       
  3415 	/** Options for detaching pictures from stores. Used by DetachFromStoreL(). */
       
  3416 	enum TDetach
       
  3417 		{
       
  3418 		/** Internalise all data that is required to fully store the picture 
       
  3419 		later; null any references to containing stores. */
       
  3420 		EDetachFull,
       
  3421 		/** Internalise enough information to draw the picture (and no more); 
       
  3422 		null any references to containing stores. */
       
  3423 		EDetachDraw
       
  3424 		};
       
  3425 public:
       
  3426 	IMPORT_C virtual ~CPicture();
       
  3427 	/** Draws a picture.
       
  3428 	
       
  3429 	@param aGc The graphics context. 
       
  3430 	@param aTopLeft The co-ordinates where the top left corner pixel of the 
       
  3431 	picture should be placed. Note that whether this is actually drawn depends 
       
  3432 	on the clipping area defined.
       
  3433 	@param aClipRect A clipping rectangle that defines the area to which the 
       
  3434 	function should draw. An implementation should never draw outside this 
       
  3435 	rectangle. Note that the graphics context may also have a clipping rectangle 
       
  3436 	set on it. 
       
  3437 	@param aMap The device map for the graphics device. The implementation 
       
  3438 	should use this to find the scaling to apply to the picture. */
       
  3439 	virtual void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const=0;
       
  3440 	IMPORT_C virtual TStreamId StoreL(CStreamStore& aStore) const; // assumes no sub streams
       
  3441 	virtual void DetachFromStoreL(TDetach /*aDegree*/=EDetachFull) {}
       
  3442 
       
  3443 	/** Externalises the picture to a stream.
       
  3444 	
       
  3445 	The presence of this function means that the standard templated stream 
       
  3446 	operator<<() is available to externalise objects of this class.
       
  3447 	
       
  3448 	A derived class must supply an implementation of this function.
       
  3449 	
       
  3450 	@param aStream The write stream. */
       
  3451 	virtual void ExternalizeL(RWriteStream& aStream) const =0;
       
  3452 
       
  3453 	/** Gets the pictur's original size, in twips.
       
  3454 	
       
  3455 	@param aSize The size of the picture, in twips */
       
  3456 	virtual void GetOriginalSizeInTwips(TSize& aSize) const =0;
       
  3457 	IMPORT_C virtual void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); // does nothing
       
  3458 	IMPORT_C virtual void SetCropInTwips(const TMargins& aMargins); // does nothing
       
  3459 	IMPORT_C virtual TPictureCapability Capability() const; // no scale, no crop
       
  3460 	IMPORT_C virtual void GetCropInTwips(TMargins& aMargins) const; // returns no crop
       
  3461 	IMPORT_C virtual TInt ScaleFactorWidth() const; // returns no scaling
       
  3462 	IMPORT_C virtual TInt ScaleFactorHeight() const; // returns no scaling
       
  3463 	IMPORT_C virtual TBool LineBreakPossible(TUint aClass,TBool aBeforePicture,TBool aHaveSpaces) const;
       
  3464 	IMPORT_C virtual TBool NativePixelSize(TSize& aPixelSize);
       
  3465 
       
  3466 	IMPORT_C void GetSizeInPixels(MGraphicsDeviceMap* aMap, TSize& aSize) const;
       
  3467 	IMPORT_C void SetSizeInPixels(MGraphicsDeviceMap* aMap, const TSize& aSize);
       
  3468 	IMPORT_C void AddCropInPixels(MGraphicsDeviceMap* aMap, const TMargins& aMargins);
       
  3469 	IMPORT_C void GetSizeInTwips(TSize& aSize) const;
       
  3470 	IMPORT_C void SetSizeInTwips(const TSize& aSize);
       
  3471 	IMPORT_C void ResetToOriginal();
       
  3472 protected:
       
  3473 	IMPORT_C CPicture();
       
  3474 	};
       
  3475 
       
  3476 
       
  3477 /** Picture header providing an interface to a stored picture. The header holds:
       
  3478 
       
  3479 the picture's type, encoded as a UID, which ensures that it will be restored 
       
  3480 to the correct picture type
       
  3481 
       
  3482 the picture's size, which facilitates deferred loading
       
  3483 
       
  3484 the stream ID of the picture body, which is replaced by a pointer to the picture 
       
  3485 object when it has been restored. 
       
  3486 @publishedAll
       
  3487 @released
       
  3488 */
       
  3489 class TPictureHeader
       
  3490 	{
       
  3491 public:
       
  3492 	IMPORT_C TPictureHeader();
       
  3493 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
  3494 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
  3495 	IMPORT_C void DeletePicture();
       
  3496 public:
       
  3497 	/** A swizzle storing either the ID of the stream in which the picture is 
       
  3498 	stored, or a pointer to the internalised picture. */
       
  3499 	TSwizzle<CPicture> iPicture;
       
  3500 	/** A UID specifying the type of the picture. */
       
  3501 	TUid iPictureType;
       
  3502 	/** The original size of the picture. */
       
  3503 	TSize iSize;
       
  3504 	};
       
  3505 
       
  3506 
       
  3507 /** Abstract interface for instantiating and restoring new CPicture derived 
       
  3508 objects.
       
  3509 
       
  3510 A concrete derived class creates pictures of one or more specific types. The 
       
  3511 class has no member data and just one function, NewPictureL, that needs to 
       
  3512 be provided by derived classes. 
       
  3513 @publishedAll
       
  3514 @released
       
  3515 */
       
  3516 class MPictureFactory
       
  3517 	{
       
  3518 public:
       
  3519 	/** Interface to the picture restoration process that ensures that a 
       
  3520 	picture of the correct type is restored.
       
  3521 	
       
  3522 	The class of the object to be restored is determined by the UID of the 
       
  3523 	stored picture, contained in the specified picture header.
       
  3524 	
       
  3525 	The function can allow the restoration of:
       
  3526 	
       
  3527 	just one CPicture-derived class, returning an error if the UID indicates 
       
  3528 	that the stored picture is not of the required type
       
  3529 	
       
  3530 	many different CPicture-derived classes, using the UID to choose which of 
       
  3531 	the possible CPicture-derived classes should be instantiated
       
  3532 	
       
  3533 	@param aHeader The picture header that should be restored. 
       
  3534 	@param aDeferredPictureStore The store in which both the header and picture 
       
  3535 	reside. */
       
  3536 	virtual void NewPictureL(TPictureHeader& aHeader,const CStreamStore& aDeferredPictureStore)const=0;
       
  3537 	};
       
  3538 
       
  3539 // printing classes
       
  3540 
       
  3541 /**
       
  3542 The maximum length of a printer model name.
       
  3543 @see TPrinterModelName 
       
  3544 @publishedAll
       
  3545 @released
       
  3546 */
       
  3547 const TInt KMaxPrinterModelNameLength=0x20;
       
  3548 
       
  3549 /**
       
  3550 Defines a modifiable buffer descriptor that can contain the name of a
       
  3551 printer model. The maximum length of the buffer is 32.
       
  3552 @since 5.0 
       
  3553 @publishedAll
       
  3554 @released
       
  3555 */
       
  3556 typedef TBuf<KMaxPrinterModelNameLength> TPrinterModelName;
       
  3557 
       
  3558 /** Page specification for a print operation.
       
  3559 
       
  3560   The page specification consists of the page orientation and the page
       
  3561 size in twips or pixels. By default, the page orientation is portrait.
       
  3562 When using landscape orientation, the left hand side of the page
       
  3563 becomes the top. 
       
  3564 "gdi.lib"
       
  3565 @since 5.0
       
  3566 @publishedAll
       
  3567 @released
       
  3568 */	
       
  3569 class TPageSpec
       
  3570 	{
       
  3571 public:
       
  3572 	/**The available page orientations. */
       
  3573 	enum TPageOrientation
       
  3574 		{
       
  3575 		/** Portrait page orientation */
       
  3576 		EPortrait,
       
  3577 		/** Landscape page orientation */
       
  3578 		ELandscape
       
  3579 		};
       
  3580 public:
       
  3581 	IMPORT_C TPageSpec();
       
  3582 	IMPORT_C TPageSpec(TPageOrientation aOrientation,const TSize& aSize);
       
  3583 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
  3584 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
  3585 	IMPORT_C TSize OrientedPageSize() const;
       
  3586 	IMPORT_C TBool operator==(const TPageSpec& aPageSpec) const;
       
  3587 	IMPORT_C TBool operator!=(const TPageSpec& aPageSpec) const;
       
  3588 public:
       
  3589 	/** The width and height of the page in portrait orientation in twips or 
       
  3590 	pixels.
       
  3591 	
       
  3592 	Note that OrientedPageSize() returns the width and height in reverse order 
       
  3593 	for a landscape portrait. */
       
  3594 	TSize iPortraitPageSize;
       
  3595 	/** The page orientation. */
       
  3596 	TPageOrientation iOrientation;
       
  3597 	};
       
  3598 
       
  3599 
       
  3600 /**  Controls the attributes of the band to be printed.
       
  3601 
       
  3602 An object of this type is passed as a parameter to functions.
       
  3603 MPageRegionPrinter::PrintBandL() and CPrinterControl::QueueGetBand().
       
  3604 @see MPageRegionPrinter::PrintBandL()
       
  3605 @see CPrinterControl::QueueGetBand() 
       
  3606 @since 5.0
       
  3607 @publishedAll
       
  3608 @released
       
  3609 */	
       
  3610 class TBandAttributes
       
  3611     {
       
  3612 public:
       
  3613 	/** The width and height of the band in twips or pixels. */
       
  3614 	TRect iRect;
       
  3615 	/** ETrue to draw no text to the band; EFalse to draw text. */
       
  3616 	TBool iTextIsIgnored; // any text drawing to this band is ignored
       
  3617 	/** ETrue to draw no graphics to the band; EFalse to draw graphics. */
       
  3618 	TBool iGraphicsIsIgnored; // any graphics drawing to this band is ignored
       
  3619 	/** ETrue if band is the first band on the page; EFalse if not. */
       
  3620 	TBool iFirstBandOnPage;
       
  3621 	};
       
  3622 
       
  3623 /**  Printer port interface.
       
  3624 
       
  3625 This interface is used as the base class for the various types of
       
  3626 printer port. New printer port classes should be derived from this
       
  3627 class.After allocation and construction, a pointer to a concrete
       
  3628 printer port should be passed to
       
  3629 CPrintSetup::StartPrintL().
       
  3630 @see CPrintSetup::StartPrintL() 
       
  3631 @since 5.0
       
  3632 @publishedAll
       
  3633 @released
       
  3634 */
       
  3635 class CPrinterPort : public CBase
       
  3636 	{
       
  3637 public:
       
  3638 	/** Writes data asynchronously to the printer port.
       
  3639 	
       
  3640 	@param aBuf Data to be written to the port 
       
  3641 	@param aRequestStatus A reference to the request status object. If the 
       
  3642 	request is cancelled, this should be set to KErrCancel; if the request 
       
  3643 	completes normally, this should be set to KErrNone. */
       
  3644 	virtual void WriteRequest(const TDesC8& aBuf,TRequestStatus& aRequestStatus)=0;
       
  3645  
       
  3646 	/** Cancels an outstanding WriteRequest() operation. */
       
  3647 	virtual void Cancel()=0;
       
  3648 	};
       
  3649 
       
  3650 
       
  3651 /** Detailed information about a printer model. 
       
  3652 "gdi.lib" 
       
  3653 @since 5.0
       
  3654 @publishedAll
       
  3655 @released
       
  3656 */
       
  3657 class TPrinterModelEntry
       
  3658   	{
       
  3659 public:
       
  3660 	/** The name of the printer model. */
       
  3661 	TPrinterModelName iModelName;
       
  3662 	/** If ETrue, then a printer port is required. */
       
  3663 	TBool iRequiresPrinterPort;
       
  3664 	/** The UID associated with this printer model. */
       
  3665 	TUid iUid;
       
  3666 public:
       
  3667 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
  3668 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
  3669 	};
       
  3670 
       
  3671 
       
  3672 /** Information about a printer model.
       
  3673 
       
  3674 An instance of this class consists of a TPrinterModelEntry and a stream ID, 
       
  3675 and is passed to CPrinterDevice::SetModel().
       
  3676 
       
  3677 @see CPrinterDevice 
       
  3678 @publishedAll
       
  3679 @released
       
  3680 */
       
  3681 class TPrinterModelHeader
       
  3682     {
       
  3683 public:
       
  3684 	/** The printer model. */
       
  3685 	TPrinterModelEntry iEntry;
       
  3686 	/** The stream ID for model data. */
       
  3687 	TStreamId iModelDataStreamId;
       
  3688 public:
       
  3689 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
  3690 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
  3691 	};
       
  3692 
       
  3693 
       
  3694 /** Printer control interface.
       
  3695 
       
  3696 This abstract base class acts as the interface between a CPrinterDevice object 
       
  3697 and the printer. It creates the context for, and controls the progress and 
       
  3698 termination of the print job.
       
  3699 
       
  3700 Only those who need to add new printer drivers should write derived classes. 
       
  3701 After instantiation of such a class, using CPrinterDevice::CreateControlL(), 
       
  3702 the object can be accessed via the iControl member of CPrinterDevice.
       
  3703 
       
  3704 @see CPrinterDevice 
       
  3705 @publishedAll
       
  3706 @released
       
  3707 */
       
  3708 class CPrinterControl : public CBase
       
  3709     {
       
  3710 public:
       
  3711 	/** Flags indicating whether there is more on the page to print. */
       
  3712 	enum TMoreOnPage
       
  3713 		{
       
  3714 		/** Indicates there is more to print on the current page. */
       
  3715 		EMoreOnPage,
       
  3716 		/** Indicates there is no more to print on the current page. */
       
  3717 		ENoMoreOnPage
       
  3718 		};
       
  3719 public:
       
  3720 	IMPORT_C ~CPrinterControl();
       
  3721 
       
  3722 	/** Gets the number of bands per page.
       
  3723  
       
  3724  	@return The number of bands on each page. */
       
  3725 	virtual TInt BandsPerPage()=0;
       
  3726 
       
  3727 	/**  Prints the next band on the page.
       
  3728  
       
  3729  	This is an asynchronous function.
       
  3730  	@param  aStatus Request status object. On successful completion
       
  3731     contains KErrNone, otherwise another of the system-wide 
       
  3732     error codes.
       
  3733  	@param aBand  On return, indicates the attributes of the band, including 
       
  3734  	its height and width and whether or not the device will ignore one or 
       
  3735  	other of graphics or text output. This information may be used by 
       
  3736  	applications to draw more efficiently, or may be ignored
       
  3737  	@return EMoreOnPage, if any unprinted bands remain on the 
       
  3738  	current page. ENoMoreOnPage, if the current band is last on 
       
  3739  	page. */
       
  3740 	virtual TMoreOnPage QueueGetBand(TRequestStatus& aStatus, TBandAttributes& aBand)=0; // returns affirmative if more to print on current page
       
  3741 
       
  3742 	/** Terminates the print process.
       
  3743 
       
  3744 	This is an asynchronous function and is called when no more bands in
       
  3745 	the document remain to be printed.Note that all bands have been
       
  3746 	printed when no more pages or copies remain to be printed, and
       
  3747 	QueueGetBand() returns ENoMoreToPrint.
       
  3748 
       
  3749 	@param aStatus Request status object. On successful completion contains 
       
  3750 	KErrNone, otherwise another of the system-wide error codes. */
       
  3751 	virtual void QueueEndPrint(TRequestStatus& aStatus)=0; 
       
  3752 
       
  3753 	/** Aborts the print process before it has completed.
       
  3754 	
       
  3755 	This function should be called if QueueGetBand() reports an error. */
       
  3756 	virtual void AbortPrint()=0; // tidy up synchronously in a short time, return success code
       
  3757 protected:
       
  3758 	IMPORT_C CPrinterControl(CPrinterPort* aPrinterPort);
       
  3759 protected:
       
  3760 	/** State flags. */
       
  3761 	enum TState 
       
  3762 		{
       
  3763 		/** Not printing. */
       
  3764 		ENotPrinting, 
       
  3765 		/** Printing. */
       
  3766 		EPrinting
       
  3767 		};
       
  3768 	/** Printing state. */
       
  3769 	TState iState;
       
  3770 	/** Printer port. */
       
  3771 	CPrinterPort* iPrinterPort;
       
  3772 	};
       
  3773 
       
  3774 class CDictionaryStore;
       
  3775 class RFs;
       
  3776 
       
  3777 /** Printer graphics device interface.
       
  3778 
       
  3779 This abstract class represents a physical graphics device that is used for 
       
  3780 printing.
       
  3781 
       
  3782 This class is used to:
       
  3783 
       
  3784 set and get the page specification
       
  3785 
       
  3786 map between the co-ordinates of the printed page (in twips) and the co-ordinates 
       
  3787 of the image device (in pixels)
       
  3788 
       
  3789 get and set the printer model entry
       
  3790 
       
  3791 create and delete a printer control.
       
  3792 
       
  3793 A printer driver is defined in terms of a printer device and a printer control. 
       
  3794 A printer device can own either a single or no printer control. The control 
       
  3795 determines the progress and termination of the print job and is responsible 
       
  3796 for producing output.
       
  3797 
       
  3798 @see CPrinterControl 
       
  3799 @publishedAll
       
  3800 @released
       
  3801 */
       
  3802 class CPrinterDevice : public CGraphicsDevice
       
  3803 	{
       
  3804 public:
       
  3805 	IMPORT_C ~CPrinterDevice();
       
  3806 
       
  3807 	/** Gets the current page specification in twips.
       
  3808 	
       
  3809 	@return The current page specification, in twips. */
       
  3810 	inline TPageSpec CurrentPageSpecInTwips() const {return(iCurrentPageSpecInTwips);}
       
  3811 
       
  3812 	/** Sets the page specification in twips.
       
  3813 	
       
  3814 	@param aPageSpec The page specification in twips. */
       
  3815 	IMPORT_C virtual void SelectPageSpecInTwips(const TPageSpec& aPageSpec);
       
  3816 	IMPORT_C virtual TRect PrintablePageInPixels() const;
       
  3817 
       
  3818 	/** Gets the printer model entry.
       
  3819 	
       
  3820 	@return The printer model entry. */
       
  3821 	virtual TPrinterModelEntry Model()const =0;
       
  3822 
       
  3823 	/** Sets the printer model header and the store.
       
  3824 	
       
  3825 	@param aModel The printer model header.
       
  3826 	@param aStore  The store.
       
  3827 	@return KErrNone if successful; otherwise, another of the system-wide 
       
  3828 	error codes.*/
       
  3829 	virtual TInt SetModel(const TPrinterModelHeader& aModel,CStreamStore& aStore)=0;
       
  3830 
       
  3831 	/** Creates a printer control.
       
  3832 	
       
  3833 	The printer control is an instance of a CPrinterControl derived class; it 
       
  3834 	is assigned to this printer device's iControl member.
       
  3835 	
       
  3836 	Note that this function is called by CPrintSetup::StartPrintL().
       
  3837 	
       
  3838 	@param aPrinterPort Pointer to an instance of a printer port. */
       
  3839 	virtual void CreateControlL(CPrinterPort* aPrinterPort)=0;
       
  3840 	IMPORT_C virtual void DeleteControl();
       
  3841 
       
  3842 	/**  Externalizes printer properties to the store.
       
  3843 
       
  3844 	The default implementation is empty.
       
  3845 
       
  3846 	@param  aStream  The read stream. */
       
  3847 	virtual void InternalizePropertiesL(RReadStream& /*aStream*/) {}
       
  3848 
       
  3849 	/**  Externalizes printer properties to the store.
       
  3850 	
       
  3851 	The default implementation is empty.
       
  3852 	
       
  3853 	@param  aStream  The write stream. */
       
  3854 	virtual void ExternalizePropertiesL(RWriteStream& /*aStream*/) const {}
       
  3855 	IMPORT_C void RestorePropertiesL();
       
  3856 	IMPORT_C void StorePropertiesL() const;
       
  3857 protected:
       
  3858 	IMPORT_C CPrinterDevice();
       
  3859 public:
       
  3860 	/** The printer control.
       
  3861 	
       
  3862 	This may be NULL. If implemented, it provides control over the print 
       
  3863 	operation. */
       
  3864 	CPrinterControl* iControl;
       
  3865 protected:
       
  3866 	/** Current page specification in twips. */
       
  3867 	TPageSpec iCurrentPageSpecInTwips;
       
  3868 	};
       
  3869 
       
  3870 
       
  3871 /** Printer model list interface.
       
  3872 
       
  3873 Functions provided by this abstract base class can be used to extract printer 
       
  3874 model information from the list of printer models. This class would typically 
       
  3875 be used to implement printer selection in a dialog box.
       
  3876 
       
  3877 @see CPdrModelList 
       
  3878 @publishedAll
       
  3879 @released
       
  3880 */
       
  3881 class CPrinterModelList : public CBase
       
  3882      {
       
  3883 public:
       
  3884 	/** Gets the number of printer models in the printer model list.
       
  3885  
       
  3886  	@return The number of printer models. */
       
  3887     virtual TInt ModelCount() const=0;
       
  3888 
       
  3889 	/**Gets printer model name.
       
  3890  
       
  3891 	This is the name of the printer model at the specified index within
       
  3892 	the list of printer models.
       
  3893  
       
  3894 	@param  anIndex The index of the printer model within the array of
       
  3895     printer models. Note that this number must be between zero and 
       
  3896     ModelCount().
       
  3897     @return Name of printer model, up to 32 characters long */
       
  3898     virtual const TPrinterModelEntry operator[](TInt anIndex)=0;
       
  3899 
       
  3900 	/** Gets a printer models index within the model list from its UID.
       
  3901 
       
  3902 	@param aModelUid The UID of the printer model.
       
  3903 	@return  The index of the printer model within the array of printer models.*/
       
  3904 	virtual TInt UidToNum(TUid aModelUid) const=0;
       
  3905     };
       
  3906 
       
  3907 
       
  3908 /** Interface for printing in bands.
       
  3909 
       
  3910 This class provides a single PrintBandL() function that prints 
       
  3911 the body of each page band by band. Classes derived from this interface must 
       
  3912 provide an implementation of the PrintBandL() function. 
       
  3913 @since 5.0 
       
  3914 @publishedAll
       
  3915 @released
       
  3916 */
       
  3917 class MPageRegionPrinter
       
  3918 	{
       
  3919 public:
       
  3920 	/** Prints a band.
       
  3921 	
       
  3922 	Implementations should set up a graphics context to which all drawing should 
       
  3923 	take place using CGraphicsDevice::CreateContext(). All co-ordinate 
       
  3924 	calculations should be done in twips, and converted into pixels before 
       
  3925 	starting the print job.
       
  3926 	
       
  3927 	@param aDevice Pointer to the graphics device representing the printer.
       
  3928 	@param aPageNo The number of the page containing the band to be printed.
       
  3929 	@param aBandInPixels Attributes of the band to be printed. */
       
  3930 	virtual void PrintBandL(CGraphicsDevice* aDevice,TInt aPageNo,const TBandAttributes& aBandInPixels)=0;
       
  3931 	};
       
  3932 
       
  3933 /**
       
  3934 The UID value of a printer specification data store. 
       
  3935 @publishedAll
       
  3936 @released
       
  3937 */
       
  3938 const TInt KPdrStoreFileUidVal=268435514;
       
  3939 
       
  3940 const TInt KPdlUidVal=268450588;
       
  3941 const TInt KUdlUidVal=268450589;
       
  3942 
       
  3943 
       
  3944 /** Printer specific user interface.
       
  3945 
       
  3946 The class is used to implement a printer specific setup dialog. A concrete 
       
  3947 implementation of the class is supplied in a UDL (i.e. a UI DLL).
       
  3948 
       
  3949 CPrinterDriver::CreatePrinterDriverUIL() is used to construct a CPrinterDriverUI 
       
  3950 object for a specific printer. (This function calls the ordinal 1 exported 
       
  3951 function of the UDL that performs the construction of the CPrinterDriverUI 
       
  3952 object).
       
  3953 
       
  3954 @see CPrinterDriver::CreatePrinterDriverUIL() 
       
  3955 @publishedAll
       
  3956 @released
       
  3957 */
       
  3958 class CPrinterDriverUI : public CBase
       
  3959     {
       
  3960 protected:
       
  3961 	IMPORT_C CPrinterDriverUI();
       
  3962 public:
       
  3963 	IMPORT_C virtual TBool BeforePrintL();
       
  3964 	IMPORT_C virtual void AfterPrintL();
       
  3965 	IMPORT_C virtual void SetPropertiesL();
       
  3966 	IMPORT_C virtual TBool CanSetProperties();
       
  3967 
       
  3968 	/** Sets the printer device.
       
  3969 	
       
  3970 	@param aPrinterDevice The printer device. */
       
  3971 	virtual TInt SetPrinterDevice(CPrinterDevice* aPrinterDevice)=0;
       
  3972 	};
       
  3973 								   
       
  3974 class CFileStore;
       
  3975 
       
  3976 
       
  3977 /** Provides access to a store containing printer specification data.
       
  3978 
       
  3979 Printer specification data is held as a direct file store, and usually has 
       
  3980 a .pdr file type.
       
  3981 
       
  3982 A printer driver is implemented as two files: a PDR file containing the printer 
       
  3983 specification data and a PDL file containing the code to link the printer 
       
  3984 with the graphics printing system.
       
  3985 
       
  3986 The printer specification data is generated by compiling a text file (a .pd 
       
  3987 file type) using the pdrtran tool. Printer specification data defines:
       
  3988 
       
  3989 the name of the associated PDL
       
  3990 
       
  3991 a list of one or more models supported by this driver, identified by name 
       
  3992 and UID
       
  3993 
       
  3994 device information such as the size of the device, typeface information for 
       
  3995 each model, including which typefaces are supported, the heights available 
       
  3996 in each typeface and the width of each character in a font.
       
  3997 
       
  3998 @see CPrinterDriverUI 
       
  3999 @publishedAll
       
  4000 @released
       
  4001 */
       
  4002 class CPrinterDriver : public CBase
       
  4003      {
       
  4004 public:
       
  4005 	IMPORT_C static CPrinterDriver* NewL();
       
  4006 	IMPORT_C ~CPrinterDriver();
       
  4007 	IMPORT_C void OpenPdrL(const TDesC &aName);
       
  4008 	IMPORT_C void Close();
       
  4009 	IMPORT_C TInt NumModels() const;
       
  4010 	IMPORT_C TPrinterModelEntry Model(TInt aNum) const;
       
  4011 
       
  4012 	/** Gets the associated graphics printer device.
       
  4013 	
       
  4014 	@return The physical graphics device used for printing. */
       
  4015 	inline CPrinterDevice* PrinterDevice() {return iPrinterDevice;}
       
  4016 	IMPORT_C CPrinterDevice* CreatePrinterDeviceL(TUid aModelUid);
       
  4017 	IMPORT_C CPrinterDriverUI* CreatePrinterDriverUIL();
       
  4018 private:
       
  4019 	CPrinterDriver();
       
  4020 	void DeletePrinterDevice();
       
  4021 	void DoOpenPdrL(const TDesC &aName);
       
  4022 	void DoCreatePrinterDeviceL(TUid aModelUid);
       
  4023 	void LoadLibraryL(RLibrary& aLibrary,const TDesC& aExt,TUid aUid2);
       
  4024 private:
       
  4025 	RFs iFs;
       
  4026 	CFileStore *iPdrStore;
       
  4027 	TInt iNumModels;
       
  4028 	TPrinterModelHeader* iModelList;
       
  4029 	TFileName iPdlName;
       
  4030 	TUid iPdlUid;
       
  4031 	RLibrary iPdlLibrary;
       
  4032 	CPrinterDevice* iPrinterDevice;
       
  4033 	RLibrary iUdlLibrary;
       
  4034 	};
       
  4035 
       
  4036 class RResourceFile;
       
  4037 
       
  4038 
       
  4039 /** Implements a printer model list interface for a collection of PDR files. 
       
  4040 @publishedAll
       
  4041 @released
       
  4042 */
       
  4043 class CPdrModelList : public CPrinterModelList
       
  4044     {
       
  4045 public:
       
  4046 	IMPORT_C static CPdrModelList* NewL();
       
  4047 	IMPORT_C virtual ~CPdrModelList();
       
  4048     IMPORT_C TInt ModelCount() const;
       
  4049     IMPORT_C const TPrinterModelEntry operator [] (TInt anIndex);
       
  4050 	IMPORT_C TInt UidToNum(TUid aModelUid) const;  // returns KErrNotFound the model uid is not matched
       
  4051 	IMPORT_C void AddDirectoryL(const TDesC& aDir);
       
  4052 	IMPORT_C CPrinterModelList* ScanForModelsL();
       
  4053 	IMPORT_C CPrinterDriver* CreatePrinterDriverL(TInt anIndex);
       
  4054 private:
       
  4055 	CPdrModelList();
       
  4056 	void ConstructL();
       
  4057 private:
       
  4058 	class TFileEntry
       
  4059 		{
       
  4060 	public:
       
  4061 		TFileName iFileName;
       
  4062 		TDesC* iDirectory;
       
  4063 		};
       
  4064 	class TModelEntry
       
  4065 		{
       
  4066 	public:
       
  4067 		TPrinterModelEntry iEntry;
       
  4068 		TFileEntry* iFile; 
       
  4069 		};
       
  4070 private:
       
  4071 	void ScanDirectoryL(TInt aDirIndex);
       
  4072 	void ListModelsL(TInt aFileIndex, TParse& aParser, TFileName& aNameOfLoadedResourceFile, TFileName& aTempFileName, RResourceFile& aResourceFile, HBufC8*& aResource);
       
  4073 	HBufC* NewPathBufL(const TFileEntry& aFileEntry);
       
  4074 private:
       
  4075 	CArrayFixSeg<TModelEntry>* iModelArray;
       
  4076 	CArrayFixFlat<TFileEntry>* iFileArray;
       
  4077 	CArrayFixFlat<HBufC*>* iDirectoryArray;
       
  4078 	RFs iFileServer;
       
  4079 	};
       
  4080 
       
  4081  
       
  4082 /** The interface for mapping between twips and device-specific units enriched 
       
  4083 with facilities to allow zooming. 
       
  4084 
       
  4085 The class is recursive, because a TZoomFactor object can have a 
       
  4086 MGraphicsDeviceMap (which could itself be a TZoomFactor) in its member data. 
       
  4087 This allows a zoom factor object to contain another zoom factor object, and 
       
  4088 is used to allow objects with different zoom factors to be embedded in each 
       
  4089 other to an arbitrary depth by the application architecture. 
       
  4090 @publishedAll
       
  4091 @released
       
  4092 */
       
  4093 class TZoomFactor : public MGraphicsDeviceMap
       
  4094 	{
       
  4095 public:
       
  4096 	IMPORT_C TZoomFactor();
       
  4097 	IMPORT_C ~TZoomFactor();
       
  4098 	inline TZoomFactor(const MGraphicsDeviceMap* aDevice);
       
  4099 	inline TZoomFactor(const TZoomFactor* aDevice);
       
  4100 	IMPORT_C TInt ZoomFactor() const;
       
  4101 	IMPORT_C void SetZoomFactor(TInt aZoomFactor);
       
  4102 	inline void SetGraphicsDeviceMap(const MGraphicsDeviceMap* aDevice);
       
  4103 	inline const MGraphicsDeviceMap* GraphicsDeviceMap() const;
       
  4104 	IMPORT_C void SetTwipToPixelMapping(const TSize& aSizeInPixels,const TSize& aSizeInTwips);
       
  4105 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwipWidth) const;
       
  4106 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwipHeight) const;
       
  4107 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixelWidth) const;
       
  4108 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixelHeight) const;
       
  4109 	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
  4110 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
  4111 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
       
  4112 	IMPORT_C void ReleaseFont(CFont* aFont);
       
  4113 public:
       
  4114 
       
  4115 	/**  One to one zoom factor.  */
       
  4116 	enum {EZoomOneToOne=1000};
       
  4117 private:
       
  4118 	TInt iZoomFactor;
       
  4119 	const MGraphicsDeviceMap* iDevice;
       
  4120 	};
       
  4121 
       
  4122 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS	
       
  4123 #include <graphics/gdi/gdistructs.h>
       
  4124 #include <graphics/gdi/gdiinline.inl>
       
  4125 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS	
       
  4126 
       
  4127 #include <gdi.inl>
       
  4128 
       
  4129 #endif // __GDI_H__