1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
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 |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
121 const TSize KCom_10PaperSizeInTwips(5940,13680); |
124 const TSize KCom_10PaperSizeInTwips(5940,13680); |
122 const TSize KMonarchPaperSizeInTwips(5580,10800); |
125 const TSize KMonarchPaperSizeInTwips(5580,10800); |
123 const TSize KDLPaperSizeInTwips(6236,12472); |
126 const TSize KDLPaperSizeInTwips(6236,12472); |
124 const TSize KC5PaperSizeInTwips(9184,12983); |
127 const TSize KC5PaperSizeInTwips(9184,12983); |
125 #endif |
128 #endif |
126 |
129 |
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 |
130 |
138 /** |
131 /** |
139 This enumeration holds the possible panic codes that may be raised |
132 This enumeration holds the possible panic codes that may be raised |
140 by the GDI API on detecting an unrecoverable error. */ |
133 by the GDI API on detecting an unrecoverable error. */ |
141 enum TGdiPanic |
134 enum TGdiPanic |
147 /** Insufficient text for successful completion of the method */ |
140 /** Insufficient text for successful completion of the method */ |
148 EGdiPanic_OutOfText = 2, |
141 EGdiPanic_OutOfText = 2, |
149 /** Internal failure. */ |
142 /** Internal failure. */ |
150 EGdiPanic_Invariant = 3 |
143 EGdiPanic_Invariant = 3 |
151 }; |
144 }; |
|
145 |
152 |
146 |
153 /** 24-bit RGB colour value with 8 bits each for red, green and blue. |
147 /** 24-bit RGB colour value with 8 bits each for red, green and blue. |
154 |
148 |
155 All Graphics drawing functions are specified in terms of a 32-bit TRgb colour |
149 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 |
150 containing the three colour values plus 8 bits for alpha channel. For hardware which |
286 #define KRgbBlue TRgb(0xff0000) |
281 #define KRgbBlue TRgb(0xff0000) |
287 #define KRgbMagenta TRgb(0xff00ff) |
282 #define KRgbMagenta TRgb(0xff00ff) |
288 #define KRgbCyan TRgb(0xffff00) |
283 #define KRgbCyan TRgb(0xffff00) |
289 #define KRgbGray TRgb(0xaaaaaa) |
284 #define KRgbGray TRgb(0xaaaaaa) |
290 #define KRgbWhite TRgb(0xffffff) |
285 #define KRgbWhite TRgb(0xffffff) |
291 |
286 #define KRgbTransparent TRgb(0x000000,0x00) |
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 |
287 |
336 /** A set of static utility functions to get information about a display mode. |
288 /** A set of static utility functions to get information about a display mode. |
337 @publishedAll |
289 @publishedAll |
338 @released |
290 @released |
339 */ |
291 */ |
344 IMPORT_C static TBool IsDisplayModeValid(TDisplayMode aDispMode); |
296 IMPORT_C static TBool IsDisplayModeValid(TDisplayMode aDispMode); |
345 IMPORT_C static TInt NumDisplayModeColors(TDisplayMode aDispMode); |
297 IMPORT_C static TInt NumDisplayModeColors(TDisplayMode aDispMode); |
346 IMPORT_C static TInt NumDisplayModeBitsPerPixel(TDisplayMode aDispMode); |
298 IMPORT_C static TInt NumDisplayModeBitsPerPixel(TDisplayMode aDispMode); |
347 }; |
299 }; |
348 |
300 |
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. |
301 /** Provides user-definable palette support to the GDI. |
357 |
302 |
358 A palette is a user-defined set of colours, which is a subset of the full |
303 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 |
304 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 |
305 bpp colour mode whilst being able to specify the colours available in that |
649 /** The format used when outline and shadow font rendering is used. |
595 /** The format used when outline and shadow font rendering is used. |
650 |
596 |
651 If the raterizer supports the outline and shadow fonts, it will set the bitmaptype as |
597 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 |
598 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. |
599 when any of the EDropShadow or EOutline effect is on. Only rasterizer providers can use this enum. |
654 |
|
655 @publishedPartner |
|
656 */ |
600 */ |
657 EFourColourBlendGlyphBitmap, |
601 EFourColourBlendGlyphBitmap, |
|
602 /** |
|
603 This is used for glyphs, and not fonts, and is needed to inform the font drawing routines |
|
604 that the character should be drawn using the overall font setting. |
|
605 For Internal Use Only. |
|
606 */ |
|
607 EGlyphBitmapTypeNotDefined, |
|
608 /** |
|
609 This is used to inform the rasterizer that the best match should be |
|
610 found for the bitmap type based upon its knowledge. |
|
611 For Internal Use Only. |
|
612 */ |
|
613 EAntiAliasedOrMonochromeGlyphBitmap, |
658 }; |
614 }; |
659 |
|
660 |
615 |
661 /** |
616 /** |
662 Defines a set of font effects flags. |
617 Defines a set of font effects flags. |
663 |
618 |
664 @publishedPartner For use by system/UI software. |
619 @publishedAll |
665 @released |
620 @released |
|
621 WARNING: This Class is for use by system/UI software ONLY. |
666 */ |
622 */ |
667 NONSHARABLE_CLASS(FontEffect) |
623 NONSHARABLE_CLASS(FontEffect) |
668 { |
624 { |
669 public: |
625 public: |
670 enum TEffect |
626 enum TEffect |
933 IMPORT_C void ConstructL(); |
886 IMPORT_C void ConstructL(); |
934 IMPORT_C void AddFontL(CFont* aFont); |
887 IMPORT_C void AddFontL(CFont* aFont); |
935 IMPORT_C TBool IncrementFontCount(const CFont* aFont); |
888 IMPORT_C TBool IncrementFontCount(const CFont* aFont); |
936 private: |
889 private: |
937 TBool FindFont(const CFont* aFont, TInt& aIdx) const; |
890 TBool FindFont(const CFont* aFont, TInt& aIdx) const; |
938 |
|
939 NONSHARABLE_CLASS(TFontAccess) |
891 NONSHARABLE_CLASS(TFontAccess) |
940 /** |
892 /** |
941 Pairs a font with a count of how many clients of the typeface store |
893 Pairs a font with a count of how many clients of the typeface store |
942 are accessing that font. |
894 are accessing that font. |
943 @internalTechnology |
|
944 */ |
895 */ |
945 { |
896 { |
946 public: |
897 public: |
947 /** A device specific font. */ |
898 /** A device specific font. */ |
948 CFont* iFont; |
899 CFont* iFont; |
1224 palette. */ |
1175 palette. */ |
1225 virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const=0; |
1176 virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const=0; |
1226 |
1177 |
1227 /** Sets the device's palette. |
1178 /** Sets the device's palette. |
1228 |
1179 |
|
1180 Setting the palette is only possible if the device has a modifiable palette, |
|
1181 which can be determined by calling PaletteAttributes(). |
|
1182 |
1229 @param aPalette The new palette for the device. */ |
1183 @param aPalette The new palette for the device. */ |
1230 virtual void SetPalette(CPalette* aPalette)=0; |
1184 virtual void SetPalette(CPalette* aPalette)=0; |
1231 |
1185 |
1232 /** Gets the device's current palette. |
1186 /** Gets the device's current palette. |
|
1187 |
|
1188 This function is only supported if the device has a modifiable palette, |
|
1189 which can be determined by calling PaletteAttributes(). |
1233 |
1190 |
1234 @param aPalette On return, holds the device's current palette. |
1191 @param aPalette On return, holds the device's current palette. |
1235 @return KErrNone, if successful; otherwise, another of the system-wide error |
1192 @return KErrNone, if successful; otherwise, another of the system-wide error |
1236 codes. */ |
1193 codes. */ |
1237 virtual TInt GetPalette(CPalette*& aPalette) const=0; |
1194 virtual TInt GetPalette(CPalette*& aPalette) const=0; |
1514 private: |
1471 private: |
1515 // virtual functions have been made protected and public non-virtual ones |
1472 // 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 |
1473 // 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 |
1474 // 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 |
1475 // same place in the class, and therefore in the same place in the vtable |
1519 |
|
1520 /** |
1476 /** |
1521 This member is internal and not intended for use. Please see derived class for implementation |
1477 @publishedAll |
1522 @internalTechnology |
1478 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1523 */ |
1479 */ |
1524 virtual TUid DoTypeUid() const=0; |
1480 virtual TUid DoTypeUid() const=0; |
1525 /** |
1481 /** |
1526 This member is internal and not intended for use. Please see derived class for implementation |
1482 @publishedAll |
1527 @internalTechnology |
1483 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1528 */ |
1484 */ |
1529 virtual TInt DoHeightInPixels() const=0; |
1485 virtual TInt DoHeightInPixels() const=0; |
1530 /** |
1486 /** |
1531 This member is internal and not intended for use. Please see derived class for implementation |
1487 @publishedAll |
1532 @internalTechnology |
1488 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1533 */ |
1489 */ |
1534 virtual TInt DoAscentInPixels() const=0; |
1490 virtual TInt DoAscentInPixels() const=0; |
1535 IMPORT_C virtual TInt DoDescentInPixels() const; |
1491 IMPORT_C virtual TInt DoDescentInPixels() const; |
1536 /** |
1492 /** |
1537 This member is internal and not intended for use. Please see derived class for implementation |
1493 @publishedAll |
1538 @internalTechnology |
1494 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1539 */ |
1495 */ |
1540 virtual TInt DoCharWidthInPixels(TChar aChar) const=0; |
1496 virtual TInt DoCharWidthInPixels(TChar aChar) const=0; |
1541 /** |
1497 /** |
1542 This member is internal and not intended for use. Please see derived class for implementation |
1498 @publishedAll |
1543 @internalTechnology |
1499 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1544 */ |
1500 */ |
1545 virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0; |
1501 virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0; |
1546 /** |
1502 /** |
1547 This member is internal and not intended for use. Please see derived class for implementation |
1503 @publishedAll |
1548 @internalTechnology |
1504 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1549 */ |
1505 */ |
1550 virtual TInt DoBaselineOffsetInPixels() const=0; |
1506 virtual TInt DoBaselineOffsetInPixels() const=0; |
1551 /** |
1507 /** |
1552 This member is internal and not intended for use. Please see derived class for implementation |
1508 @publishedAll |
1553 @internalTechnology |
1509 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1554 */ |
1510 */ |
1555 virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0; |
1511 virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0; |
1556 /** |
1512 /** |
1557 This member is internal and not intended for use. Please see derived class for implementation |
1513 @publishedAll |
1558 @internalTechnology |
1514 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1559 */ |
1515 */ |
1560 virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0; |
1516 virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0; |
1561 /** |
1517 /** |
1562 This member is internal and not intended for use. Please see derived class for implementation |
1518 @publishedAll |
1563 @internalTechnology |
1519 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1564 */ |
1520 */ |
1565 virtual TInt DoMaxCharWidthInPixels() const=0; |
1521 virtual TInt DoMaxCharWidthInPixels() const=0; |
1566 /** |
1522 /** |
1567 This member is internal and not intended for use. Please see derived class for implementation |
1523 @publishedAll |
1568 @internalTechnology |
1524 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1569 */ |
1525 */ |
1570 virtual TInt DoMaxNormalCharWidthInPixels() const=0; |
1526 virtual TInt DoMaxNormalCharWidthInPixels() const=0; |
1571 /** |
1527 /** |
1572 This member is internal and not intended for use. Please see derived class for implementation |
1528 @publishedAll |
1573 @internalTechnology |
1529 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation. |
1574 */ |
1530 */ |
1575 virtual TFontSpec DoFontSpecInTwips() const=0; |
1531 virtual TFontSpec DoFontSpecInTwips() const=0; |
1576 |
1532 |
1577 protected: |
1533 protected: |
1578 IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const; |
1534 IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const; |
1609 @deprecated */ |
1565 @deprecated */ |
1610 IMPORT_C TInt HeightInPixels() const; |
1566 IMPORT_C TInt HeightInPixels() const; |
1611 |
1567 |
1612 /** Gets the font ascent in pixels. |
1568 /** Gets the font ascent in pixels. |
1613 Note that this deprecated function is replaced by the new @c FontMaxAscent() |
1569 Note that this deprecated function is replaced by the new @c FontMaxAscent() |
1614 or in some cases @c FontCapitalAscent(). |
1570 or in some cases @c FontCapitalAscent(). |
1615 |
1571 |
1616 @return The font ascent in pixels. |
1572 @return The font ascent in pixels. |
1617 @see FontCapitalAscent() |
1573 @see FontCapitalAscent() |
1618 @see FontMaxAscent() |
1574 @see FontMaxAscent() |
1619 @deprecated */ |
1575 @deprecated */ |
1620 IMPORT_C TInt AscentInPixels() const; |
1576 IMPORT_C TInt AscentInPixels() const; |
1621 |
1577 |
1622 /** Gets the font descent in pixels. |
1578 /** Gets the font descent in pixels. |
1623 Note that this deprecated function is replaced by the new @c FontMaxDescent() |
1579 Note that this deprecated function is replaced by the new @c FontMaxDescent() |
1624 or in some cases @c FontStandardDescent(). |
1580 or in some cases @c FontStandardDescent(). |
1625 |
1581 |
1626 @return The font descent in pixels. |
1582 @return The font descent in pixels. |
1627 @see FontStandardDescent() |
1583 @see FontStandardDescent() |
1628 @see FontMaxDescent() |
1584 @see FontMaxDescent() |
1629 @deprecated */ |
1585 @deprecated */ |
1707 IMPORT_C TInt WidthZeroInPixels() const; |
1663 IMPORT_C TInt WidthZeroInPixels() const; |
1708 IMPORT_C TInt MeasureText(const TDesC& aText, const TMeasureTextInput* aInput = NULL, TMeasureTextOutput* aOutput = NULL) const; |
1664 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); |
1665 IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter); |
1710 IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const; |
1666 IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const; |
1711 IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const; |
1667 IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const; |
|
1668 |
|
1669 /** Gets the width in pixels of the specified descriptor when displayed in this |
|
1670 font. |
|
1671 |
|
1672 @param aText The descriptor whose width should be determined. |
|
1673 @param aParam Parameter block that controls how much of aText is measured |
|
1674 @return The width of the specified descriptor when displayed in this font, |
|
1675 in pixels. */ |
|
1676 IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const; |
1712 }; |
1677 }; |
1713 |
1678 |
1714 class CFbsBitmap; |
1679 class CFbsBitmap; |
1715 class CWsBitmap; |
1680 class CWsBitmap; |
1716 /** Abstract base class for all graphics contexts. |
1681 /** Abstract base class for all graphics contexts. |
1847 B=(~b)^s */ |
1812 B=(~b)^s */ |
1848 EDrawModeNOTXOR=EInvertScreen|EXor, |
1813 EDrawModeNOTXOR=EInvertScreen|EXor, |
1849 /** Inverts the colour of each pixel that is drawn over, (pen and |
1814 /** Inverts the colour of each pixel that is drawn over, (pen and |
1850 brush attributes are ignored). P=~s, B=~s */ |
1815 brush attributes are ignored). P=~s, B=~s */ |
1851 EDrawModeNOTSCREEN=EInvertScreen, |
1816 EDrawModeNOTSCREEN=EInvertScreen, |
1852 /** Inverts the pen and brush colours before ORing. P=(~p)|s, |
1817 /** Inverts the screen colour before ORing. P=p|(~s), |
1853 B=(~b)|s */ |
1818 B=b|(~s) */ |
1854 EDrawModeNOTOR=EInvertScreen|EOr, |
1819 EDrawModeNOTOR=EInvertScreen|EOr, |
1855 /** Inverts the pen and brush colours. P=~p, B=~b */ |
1820 /** Inverts the pen and brush colours. P=~p, B=~b */ |
1856 EDrawModeNOTPEN=EInvertPen|EPenmode, |
1821 EDrawModeNOTPEN=EInvertPen|EPenmode, |
1857 /** Inverts the screen, pen and brush colours before ORing. P=p|(~s), |
1822 /** Inverts the pen and brush colours before ORing. P=(~p)|s, |
1858 B=b|(~s) */ |
1823 B=(~b)|s */ |
1859 EDrawModeORNOT=EOr|EInvertPen, |
1824 EDrawModeORNOT=EOr|EInvertPen, |
1860 /** NOT OR NOT mode. P=(~p)|(~s), B=(~b)|(~s) */ |
1825 /** Inverts the screen and pen and brush colours before ORing. |
|
1826 P=(~p)|(~s), B=(~b)|(~s) */ |
1861 EDrawModeNOTORNOT=EInvertScreen|EOr|EInvertPen, |
1827 EDrawModeNOTORNOT=EInvertScreen|EOr|EInvertPen, |
1862 /** Writes alpha information in the source directly into the destination, rather than blending. */ |
1828 /** Writes alpha information in the source directly into the destination, rather than blending. */ |
1863 EDrawModeWriteAlpha=EWriteAlpha, |
1829 EDrawModeWriteAlpha=EWriteAlpha, |
1864 }; |
1830 }; |
1865 |
1831 |
1986 public: |
1952 public: |
1987 /** ETrue if the text direction is right-to-left (for scripts like |
1953 /** ETrue if the text direction is right-to-left (for scripts like |
1988 Arabic and Hebrew). EFalse if left-to-right. */ |
1954 Arabic and Hebrew). EFalse if left-to-right. */ |
1989 TBool iParRightToLeft; |
1955 TBool iParRightToLeft; |
1990 }; |
1956 }; |
|
1957 |
|
1958 /** |
|
1959 Parameters used in drawing text within supplied context. |
|
1960 It is used by CGraphicsContext::DrawText() and CGraphicsContext::DrawTextVertical() family of API's |
|
1961 to draw text from iStart to iEnd withing the supplied text descriptor. |
|
1962 */ |
|
1963 class TTextParameters |
|
1964 { |
|
1965 public: |
|
1966 TTextParameters(): |
|
1967 iStart(0), |
|
1968 iEnd(KMaxTInt), |
|
1969 iFlags(0) |
|
1970 { |
|
1971 } |
|
1972 TInt iStart; |
|
1973 TInt iEnd; |
|
1974 TUint16 iFlags; |
|
1975 /* Reserved for future use */ |
|
1976 TAny* iReserved1; |
|
1977 TAny* iReserved2; |
|
1978 TAny* iReserved3; |
|
1979 TAny* iReserved4; |
|
1980 }; |
1991 public: |
1981 public: |
1992 /** Gets a pointer to the graphics context's graphics device. |
1982 /** Gets a pointer to the graphics context's graphics device. |
1993 |
1983 |
1994 @return A pointer to the graphics device. */ |
1984 @return A pointer to the graphics device. */ |
1995 virtual CGraphicsDevice* Device() const=0; |
1985 virtual CGraphicsDevice* Device() const=0; |
2052 @param aDrawingMode The drawing mode. |
2042 @param aDrawingMode The drawing mode. |
2053 @see CGraphicsContext::TDrawMode |
2043 @see CGraphicsContext::TDrawMode |
2054 @see CGraphicsContext::TDrawModeComponents */ |
2044 @see CGraphicsContext::TDrawModeComponents */ |
2055 virtual void SetDrawMode(TDrawMode aDrawingMode)=0; |
2045 virtual void SetDrawMode(TDrawMode aDrawingMode)=0; |
2056 |
2046 |
2057 /** Sets the clipping rectangle. |
2047 /** Sets the clipping rectangle. |
2058 |
2048 |
2059 The area of visible drawing depends on the clipping region. The default |
2049 The area of visible drawing depends on the clipping rectangle, any items |
2060 clipping rectangle is the full device area. |
2050 that fall outside the extent of the clipping rectangle will not be drawn. |
2061 |
2051 The default clipping rectangle is the full device area. |
2062 @param aRect The clipping rectangle. */ |
2052 |
|
2053 Note that clipping is additive. If a clipping region has been set using SetClippingRegion() |
|
2054 then clipping will be to the intersection of that region and this rectangle. |
|
2055 |
|
2056 @param aRect The rectangle to be used as the clipping rectangle. Note that |
|
2057 this rectangle is tranformed by the current co-ordinate origin before it is used. |
|
2058 The co-ordinate origin is set using SetOrigin(). |
|
2059 |
|
2060 @see CGraphicsContext::SetClippingRegion() |
|
2061 @see CGraphicsContext::SetOrigin() */ |
2063 virtual void SetClippingRect(const TRect& aRect)=0; |
2062 virtual void SetClippingRect(const TRect& aRect)=0; |
2064 |
2063 |
2065 /** Cancels any clipping rectangle. |
2064 /** Cancels any clipping rectangle. |
2066 |
2065 |
2067 Clipping thus reverts to the full device area, the default. |
2066 Clipping thus reverts to the full device area, the default. |
2168 because you can simply call DrawText() for each word. However, underlined |
2167 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 |
2168 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. |
2169 gap between the space and the beginning of the next word. |
2171 |
2170 |
2172 @param aExcessWidth The width (in pixels) to be distributed between the |
2171 @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 |
2172 specified number of spaces. |
2174 stretched, or negative, in which case it is shrunk. |
|
2175 @param aNumGaps The number of word spaces (characters with the code U+0020) |
2173 @param aNumGaps The number of word spaces (characters with the code U+0020) |
2176 over which the change in width is distributed. */ |
2174 over which the change in width is distributed. */ |
2177 virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps)=0; |
2175 virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps)=0; |
2178 |
2176 |
2179 /** Sets character justification. |
2177 /** Sets character justification. |
2246 |
2244 |
2247 Thus, in practice, character justification will only very rarely be used to |
2245 Thus, in practice, character justification will only very rarely be used to |
2248 expand a line of characters. |
2246 expand a line of characters. |
2249 |
2247 |
2250 @param aExcessWidth The excess width (in pixels) to be distributed between |
2248 @param aExcessWidth The excess width (in pixels) to be distributed between |
2251 the specified number of characters. |
2249 the specified number of characters. It may be positive, in which case the text is |
|
2250 stretched, or negative, in which case it is shrunk. |
2252 @param aNumChars The number of characters involved. */ |
2251 @param aNumChars The number of characters involved. */ |
2253 virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars)=0; |
2252 virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars)=0; |
2254 |
2253 |
2255 /** Sets the pen colour. |
2254 /** Sets the pen colour. |
2256 |
2255 |
2906 @param aMapForwards ETrue, mapping is done from the first RGB to the second |
2905 @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 |
2906 RGB in the pair; EFalse, mapping is done from the second RGB to the first |
2908 RGB in the pair. */ |
2907 RGB in the pair. */ |
2909 virtual void MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards) = 0; |
2908 virtual void MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards) = 0; |
2910 |
2909 |
2911 /** Sets the clipping region. |
2910 /** Sets the clipping region, any items that fall outside the extent of the clipping |
2912 @param aClippingRegion The new clipping region. |
2911 region will not be drawn. |
|
2912 |
|
2913 Note that clipping is additive. If a clipping rectangle has been set using SetClippingRect() |
|
2914 then clipping will be to the intersection of that rectangle and this region. |
|
2915 |
|
2916 @param aRegion The new clipping region. Note that clipping region co-ordinates are |
|
2917 used as absolute co-ordinates, they are not transformed by the current co-ordinate |
|
2918 origin before use (as occurs in SetClippingRect()). |
|
2919 |
2913 @return KErrNone if successful; KErrArgument if the TRegion is not valid; KErrNoMemory if there is insufficient memory. |
2920 @return KErrNone if successful; KErrArgument if the TRegion is not valid; KErrNoMemory if there is insufficient memory. |
2914 @see CGraphicsContext::CancelClippingRegion()*/ |
2921 |
|
2922 @see CGraphicsContext::CancelClippingRegion() |
|
2923 @see CGraphicsContext::SetClippingRect() */ |
2915 virtual TInt SetClippingRegion(const TRegion &aRegion) = 0; |
2924 virtual TInt SetClippingRegion(const TRegion &aRegion) = 0; |
2916 |
2925 |
2917 /** Cancels the current clipping region. |
2926 /** Cancels the current clipping region. |
2918 @see CGraphicsContext::SetClippingRegion()*/ |
2927 @see CGraphicsContext::SetClippingRegion()*/ |
2919 virtual void CancelClippingRegion() = 0; |
2928 virtual void CancelClippingRegion() = 0; |
2942 |
2951 |
2943 /** Get the font's shadow colour |
2952 /** Get the font's shadow colour |
2944 @param aShadowColor Shadow colour of the font returned by the funtion. |
2953 @param aShadowColor Shadow colour of the font returned by the funtion. |
2945 @return KErrNone, if successful; otherwise, another of the system-wide errors. */ |
2954 @return KErrNone, if successful; otherwise, another of the system-wide errors. */ |
2946 IMPORT_C TInt GetShadowColor(TRgb& aShadowColor); |
2955 IMPORT_C TInt GetShadowColor(TRgb& aShadowColor); |
2947 |
2956 |
2948 /** Determine if the Gc is a CFbsBitGc |
2957 /** Determine if the Gc is a CFbsBitGc |
2949 @return ETrue, if the Gc is a CFbsBitGc, EFalse otherwise |
2958 @return ETrue, if the Gc is a CFbsBitGc, EFalse otherwise |
2950 @internalComponent |
2959 @publishedAll |
|
2960 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
2951 */ |
2961 */ |
2952 IMPORT_C TBool IsFbsBitGc() const; |
2962 IMPORT_C TBool IsFbsBitGc() const; |
|
2963 |
|
2964 IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition); |
|
2965 IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0); |
|
2966 IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextParam& aParam); |
|
2967 |
|
2968 IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPos,TBool aUp); |
|
2969 IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0); |
|
2970 |
|
2971 IMPORT_C TInt DrawTextExtended(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextExtendedParam& aParam); |
2953 |
2972 |
2954 protected: |
2973 protected: |
2955 |
2974 |
2956 /** |
2975 /** |
2957 An APIExtension method to allow the addition of new APIs to retain compatibility |
2976 An APIExtension method to allow the addition of new APIs to retain compatibility |
2958 with previous versions of gdi.dll |
2977 with previous versions of gdi.dll |
2959 @param aOutput is for output |
2978 @param aOutput is for output |
2960 @param aInput is for input |
2979 @param aInput is for input |
2961 @see CGraphicsContext |
2980 @see CGraphicsContext |
2962 @internalComponent |
2981 @publishedAll |
|
2982 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
2963 */ |
2983 */ |
2964 IMPORT_C virtual TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput); |
2984 IMPORT_C virtual TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput); |
2965 |
2985 |
2966 /** |
2986 /** |
2967 A reserved virtual function for future use. |
2987 A reserved virtual function for future use. |
3119 @param aSrcBmp A pointer to the source bitmap. |
3139 @param aSrcBmp A pointer to the source bitmap. |
3120 @param aSrcRect The part of the source bitmap that should be used. |
3140 @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. |
3141 @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 |
3142 @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 |
3143 for the alpha blending. The size of the area is the same as the |
3124 source bitmap area - aSrcRect parameter. |
3144 source bitmap area - aSrcRect parameter.*/ |
3125 @return KErrNone, if successful; otherwise, another of the system-wide error codes.*/ |
|
3126 |
3145 |
3127 virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0; |
3146 virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0; |
3128 |
3147 |
3129 /** |
3148 /** |
3130 The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using |
3149 The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using |
3134 @param aSrcBmp A pointer to the source bitmap. |
3153 @param aSrcBmp A pointer to the source bitmap. |
3135 @param aSrcRect The part of the source bitmap that should be used. |
3154 @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. |
3155 @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 |
3156 @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 |
3157 for the alpha blending. The size of the area is the same as the |
3139 source bitmap area - aSrcRect parameter. |
3158 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; |
3159 virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0; |
3142 |
3160 |
3143 protected: |
3161 protected: |
3144 |
3162 |
3145 /* |
3163 /* |
4099 private: |
4117 private: |
4100 TInt iZoomFactor; |
4118 TInt iZoomFactor; |
4101 const MGraphicsDeviceMap* iDevice; |
4119 const MGraphicsDeviceMap* iDevice; |
4102 }; |
4120 }; |
4103 |
4121 |
4104 /** |
4122 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
4105 Provides methods to map a TLanguage type to some pre-defined glyph samples. |
4123 #include <graphics/gdi/gdistructs.h> |
4106 Samples are defined per writing script, e.g. specifying ELangFrench or |
4124 #include <graphics/gdi/gdiinline.inl> |
4107 ELangGerman will return the same set of samples. |
4125 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
4108 These samples are typically the tallest and 'deep'est characters w.r.t |
4126 |
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> |
4127 #include <gdi.inl> |
|
4128 |
4152 #endif // __GDI_H__ |
4129 #endif // __GDI_H__ |