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