1.1 --- a/epoc32/include/gdi.inl Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/gdi.inl Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,9 +1,9 @@
1.4 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 // All rights reserved.
1.6 // This component and the accompanying materials are made available
1.7 -// 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
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 // which accompanies this distribution, and is available
1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.12 //
1.13 // Initial Contributors:
1.14 // Nokia Corporation - initial contribution.
1.15 @@ -21,21 +21,27 @@
1.16 /** Constructs a TRgb initialised to KRgbWhite.*/
1.17 {}
1.18
1.19 -
1.20 +
1.21 inline TRgb::TRgb(TUint32 aValue):
1.22 iValue(((aValue & 0xff0000) >> 16) | (aValue & 0x00ff00) | ((aValue & 0x0000ff) << 16) | (0xff000000 - (aValue & 0xff000000)))
1.23 /** Constructs a TRgb directly from a single 32-bit integer.
1.24
1.25 -The integer is of the form 0xaabbggrr, where bb is the hex number of blue,
1.26 -gg is the hex number for green, and rr is the hex number for red, aa is the hex number of
1.27 -alpha (0 means opaque, 255 means transparent).
1.28 +The integer is of the form 0xaabbggrr, where bb is the hex number for blue,
1.29 +gg is the hex number for green, rr is the hex number for red, and aa is the hex number for
1.30 +"transparency" alpha (0 means opaque, 255 means transparent).
1.31
1.32 -For example, TRgb(2,4,8) using the 3 colour constructor is equal to TRgb(0x00080402) using
1.33 -this constructor.
1.34 +This constructor is deprecated. The byte order of Red ,Green and Blue
1.35 +does not match other constructors and methods in this class,
1.36 +and the meaning of alpha is reversed compared to current convention.
1.37
1.38 -The constructor is deprecated. Use others constructor or SetInternal() instead.
1.39 +For example, TRgb(0x00080402) using this constructor
1.40 +can be replaced with the 3 colour constructor TRgb(2,4,8).
1.41 +The equivalent explicit alpha constructors are TRgb(0x020408,0xff) and TRgb(2,4,8,255).
1.42 +The equivalent call to SetInternal is SetInternal(0xff020408).
1.43
1.44 -@param aValue Integer representing colour value. Takes form 0x00bbggrr.
1.45 +This constructor is deprecated. Use other constructors or SetInternal() instead.
1.46 +
1.47 +@param aValue Integer representing colour value. Takes form 0x00bbggrr.
1.48 @deprecated */
1.49 {}
1.50
1.51 @@ -43,15 +49,16 @@
1.52 iValue((aInternalValue & 0x00ffffff) | (aAlpha << 24))
1.53 /** Constructs a TRgb from a 32-bit integer (which corresponds to a colour) and from an alpha value.
1.54
1.55 -The first parameter is of the form 0x00rrggbb, where rr is the hex number for red,
1.56 -gg is the hex number for green, and bb is the hex number of blue.
1.57 +The first parameter is of the form 0x00rrggbb, where rr is the hex number for red,
1.58 +gg is the hex number for green, and bb is the hex number for blue.
1.59
1.60 The second parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
1.61
1.62 -For example, TRgb(2,4,8,255) using the 3 colour constructor is equal to TRgb(0x00020408, 255) using
1.63 +For example, TRgb(2,4,8,255) using the 3 colour+alpha constructor is equal to TRgb(0x00020408, 255) using
1.64 this constructor.
1.65
1.66 -The constructor is a replacement for TRgb(TUint32 aValue).
1.67 +This constructor, which implements alpha in the conventional way,
1.68 +replaces TRgb( TUint32 aValue ) which is deprecated.
1.69
1.70 @param aInternalValue Integer representing a colour value, which takes the form 0x00rrggbb.
1.71 @param aAlpha Alpha component of the colour (0 - 255).*/
1.72 @@ -63,9 +70,10 @@
1.73 /** Constructs a TRgb from its three component colours.
1.74
1.75 Each colour has a value between 0 and 255.
1.76 +The alpha component is always set to opaque (255)
1.77
1.78 -@param aRed Red component of the colour (0 - 255).
1.79 -@param aGreen Green component of the colour (0 - 255).
1.80 +@param aRed Red component of the colour (0 - 255).
1.81 +@param aGreen Green component of the colour (0 - 255).
1.82 @param aBlue Blue component of the colour (0 - 255). */
1.83 {}
1.84
1.85 @@ -74,6 +82,9 @@
1.86 Each component has a value between 0 and 255.
1.87 The fourth parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
1.88
1.89 +This constructor, which implements alpha in the conventional way,
1.90 +replaces TRgb( TUint32 aValue ) which is deprecated.
1.91 +
1.92 @param aRed Red component of the colour (0 - 255).
1.93 @param aGreen Green component of the colour (0 - 255).
1.94 @param aBlue Blue component of the colour (0 - 255).
1.95 @@ -173,30 +184,33 @@
1.96 @return First operand contains result of logical Exclusive OR. */
1.97 {iValue^=aColor.iValue;iValue^=0xff000000; return(*this);}
1.98
1.99 -
1.100 +
1.101 inline TUint32 TRgb::Value() const
1.102 -/** Gets the 32-bit value of the TRgb as an integer.
1.103 +/** Gets the 32-bit value of the TRgb as an integer.
1.104 This function is deprecated. Use Internal() instead.
1.105 +Note: the order of Red, Green and Blue components returned by this method
1.106 +is reversed compared to all other methods. The alpha value is also reversed in meaning
1.107 +compared to current convention, such that 0 represents opaque and 0xff represents transparent.
1.108
1.109 -@return The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number of blue,
1.110 -gg is the hex number for green, rr is the hex number for red and aa is the hex number of
1.111 -alpha (0 means opaque, 255 means transparent).
1.112 -@deprecated */
1.113 +@return The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number for blue,
1.114 +gg is the hex number for green, rr is the hex number for red, and aa is the hex number for
1.115 +"transparency" alpha (0 means opaque, 255 means transparent).
1.116 +@deprecated */
1.117 // rr gg bb aa
1.118 {return (((iValue & 0xff0000) >> 16) | (iValue & 0x00ff00) | ((iValue & 0x0000ff) << 16) | (0xff000000 - (iValue & 0xff000000)));}
1.119
1.120 inline TUint32 TRgb::Internal() const
1.121 -/** Gets the 32-bit value of the TRgb as an integer.
1.122 +/** Gets the 32-bit value of the TRgb as an integer.
1.123
1.124 @return The 32 bit value of the TRgb. Has the form 0xaarrggbb. */
1.125 {return (iValue);}
1.126
1.127 inline void TRgb::SetInternal(TUint32 aInternal)
1.128 /** Sets the 32-bit value of the TRgb as a 32-bit integer.
1.129 -@param aInternal Colour internal representation. Has the form 0xaarrggbb.
1.130 +@param aInternal Colour internal representation. Has the form 0xaarrggbb.
1.131 */
1.132 {iValue = aInternal;}
1.133 -
1.134 +
1.135 inline TRgb TRgb::operator~() const
1.136 /** Bitwise logical inversion operator.
1.137
1.138 @@ -638,81 +652,4 @@
1.139 {
1.140 return FontMaxAscent() + FontMaxDescent();
1.141 }
1.142 -
1.143 -/** Utility function to check if a display mode has Alpha channel information
1.144 -@param aDisplayMode - the display mode being queried
1.145 -@return ETrue if display mode contains Alpha information.
1.146 -@internalTechnology
1.147 -@released
1.148 -*/
1.149 -inline TBool IsAlphaChannel(TDisplayMode aDisplayMode)
1.150 - {
1.151 - if(aDisplayMode == EColor16MAP || aDisplayMode == EColor16MA)
1.152 - return ETrue;
1.153 - else
1.154 - return EFalse;
1.155 - }
1.156
1.157 -/**
1.158 -@internalTechnology
1.159 -@released
1.160 -*/
1.161 -inline TUint QuoteOrBracketPair(TUint code)
1.162 - {
1.163 - // given the opening/closing quote or bracket, return the corresponding closing/opening quote or bracket
1.164 - switch(code)
1.165 - {
1.166 - case 0x0022: return 0x0022; // "..."
1.167 - case 0x0027: return 0x0027; // '...'
1.168 - case 0x0028: return 0x0029; // (...)
1.169 - case 0x003c: return 0x003e; // <...>
1.170 - case 0x005b: return 0x005d; // [...]
1.171 - case 0x007b: return 0x007d; // {...}
1.172 - case 0x2018: return 0x2019; // Single quotation marks
1.173 - case 0x201b: return 0x2019; // Single high-reversed-9 quotation mark
1.174 - case 0x201c: return 0x201d; // Double quotation marks
1.175 - case 0x201f: return 0x201d; // Double high-reversed-9 quotation mark
1.176 - case 0x2035: return 0x2032; // Single primes
1.177 - case 0x2036: return 0x2033; // Double primes
1.178 - case 0x2037: return 0x2034; // Triple primes
1.179 - case 0x2039: return 0x203a; // Single left/right-pointing angle quotation marks
1.180 - case 0x2045: return 0x2046; // Square brackets with quill
1.181 -
1.182 - case 0x0029: return 0x0028; // (...)
1.183 - case 0x003e: return 0x003c; // <...>
1.184 - case 0x005d: return 0x005b; // [...]
1.185 - case 0x007d: return 0x007b; // {...}
1.186 - case 0x2019: return 0x2018; // Single quotation marks
1.187 - case 0x201d: return 0x201c; // Double quotation marks
1.188 - case 0x2032: return 0x2035; // Single primes
1.189 - case 0x2033: return 0x2036; // Double primes
1.190 - case 0x2034: return 0x2037; // Triple primes
1.191 - case 0x203a: return 0x2039; // Single left/right-pointing angle quotation marks
1.192 - case 0x2046: return 0x2045; // Square brackets with quill
1.193 -
1.194 - default: return 0;
1.195 - }
1.196 - }
1.197 -
1.198 -/**
1.199 -@internalTechnology
1.200 -@released
1.201 -*/
1.202 -inline TBool IsIgnoredCharacterForLocalisedProcFunc(TChar aCode)
1.203 - {
1.204 - // All Devanagari characters should be ignored until DrawTextWithContext is implemented
1.205 - // The current GDI only implementation for localised punctuation only works for some
1.206 - // Devanagari characters. Hence this function 'blocks' all Devanagari characters, for now.
1.207 - if (aCode >= 0x0900 && aCode <= 0x0965)
1.208 - return ETrue;
1.209 -
1.210 - TChar::TBdCategory cat = aCode.GetBdCategory();
1.211 -
1.212 - if ((cat == TChar::ELeftToRight ||
1.213 - cat == TChar::ERightToLeft ||
1.214 - cat == TChar::ERightToLeftArabic))
1.215 - return EFalse;
1.216 -
1.217 - return ETrue;
1.218 -
1.219 - }