1.1 --- a/epoc32/include/gdi.inl Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/gdi.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,718 @@
1.4 -gdi.inl
1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// TRgb
1.19 +//
1.20 +//
1.21 +
1.22 +
1.23 +inline TRgb::TRgb():
1.24 + iValue(0xffffffff)
1.25 + /** Constructs a TRgb initialised to KRgbWhite.*/
1.26 + {}
1.27 +
1.28 +
1.29 +inline TRgb::TRgb(TUint32 aValue):
1.30 + iValue(((aValue & 0xff0000) >> 16) | (aValue & 0x00ff00) | ((aValue & 0x0000ff) << 16) | (0xff000000 - (aValue & 0xff000000)))
1.31 +/** Constructs a TRgb directly from a single 32-bit integer.
1.32 +
1.33 +The integer is of the form 0xaabbggrr, where bb is the hex number of blue,
1.34 +gg is the hex number for green, and rr is the hex number for red, aa is the hex number of
1.35 +alpha (0 means opaque, 255 means transparent).
1.36 +
1.37 +For example, TRgb(2,4,8) using the 3 colour constructor is equal to TRgb(0x00080402) using
1.38 +this constructor.
1.39 +
1.40 +The constructor is deprecated. Use others constructor or SetInternal() instead.
1.41 +
1.42 +@param aValue Integer representing colour value. Takes form 0x00bbggrr.
1.43 +@deprecated */
1.44 + {}
1.45 +
1.46 +inline TRgb::TRgb(TUint32 aInternalValue, TInt aAlpha) :
1.47 + iValue((aInternalValue & 0x00ffffff) | (aAlpha << 24))
1.48 +/** Constructs a TRgb from a 32-bit integer (which corresponds to a colour) and from an alpha value.
1.49 +
1.50 +The first parameter is of the form 0x00rrggbb, where rr is the hex number for red,
1.51 +gg is the hex number for green, and bb is the hex number of blue.
1.52 +
1.53 +The second parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
1.54 +
1.55 +For example, TRgb(2,4,8,255) using the 3 colour constructor is equal to TRgb(0x00020408, 255) using
1.56 +this constructor.
1.57 +
1.58 +The constructor is a replacement for TRgb(TUint32 aValue).
1.59 +
1.60 +@param aInternalValue Integer representing a colour value, which takes the form 0x00rrggbb.
1.61 +@param aAlpha Alpha component of the colour (0 - 255).*/
1.62 + {
1.63 + }
1.64 +
1.65 +inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue):
1.66 + iValue(aRed<<16|aGreen<<8|aBlue|0xff000000)
1.67 +/** Constructs a TRgb from its three component colours.
1.68 +
1.69 +Each colour has a value between 0 and 255.
1.70 +
1.71 +@param aRed Red component of the colour (0 - 255).
1.72 +@param aGreen Green component of the colour (0 - 255).
1.73 +@param aBlue Blue component of the colour (0 - 255). */
1.74 + {}
1.75 +
1.76 +/** Constructs a TRgb from its three colour components and alpha component.
1.77 +
1.78 +Each component has a value between 0 and 255.
1.79 +The fourth parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
1.80 +
1.81 +@param aRed Red component of the colour (0 - 255).
1.82 +@param aGreen Green component of the colour (0 - 255).
1.83 +@param aBlue Blue component of the colour (0 - 255).
1.84 +@param aAlpha Alpha component of the colour (0 - 255).*/
1.85 +inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue, TInt aAlpha):
1.86 + iValue(aRed<<16|aGreen<<8|aBlue|aAlpha<<24)
1.87 + {}
1.88 +
1.89 +
1.90 +inline TInt TRgb::Red() const
1.91 +/** Gets the red component.
1.92 +
1.93 +@return The red component (0 - 255). */
1.94 + {return((iValue&0xff0000)>>16);}
1.95 +
1.96 +
1.97 +inline TInt TRgb::Green() const
1.98 +/** Gets the green component.
1.99 +
1.100 +@return The green component (0 - 255). */
1.101 + {return((iValue&0xff00)>>8);}
1.102 +
1.103 +
1.104 +inline TInt TRgb::Blue() const
1.105 +/** Gets the blue component.
1.106 +
1.107 +@return The blue component (0 - 255). */
1.108 + {return(iValue&0xff);}
1.109 +
1.110 +
1.111 +inline TBool TRgb::operator==(const TRgb& aColor) const
1.112 +/** Compares this colour with the specified colour for equality.
1.113 +
1.114 +For two colours to be equal, their red, green and blue components must all
1.115 +be equal.
1.116 +
1.117 +@param aColor Colour to be compared.
1.118 +@return ETrue. if the colours are equal; EFalse, otherwise. */
1.119 +
1.120 + {return(iValue==aColor.iValue);}
1.121 +
1.122 +
1.123 +inline TBool TRgb::operator!=(const TRgb& aColor) const
1.124 +/** Compares this colour with the specified colour for inequality.
1.125 +
1.126 +Two colours are unequal if one at least one of their red, green and blue components
1.127 +are unequal.
1.128 +
1.129 +@param aColor Colour to be compared.
1.130 +@return ETrue, if the colours are not equal; EFalse, otherwise.
1.131 + */
1.132 + {return(!(*this==aColor));}
1.133 +
1.134 +inline TRgb& TRgb::operator&=(const TRgb& aColor)
1.135 +/** Logical AND assignment operator.
1.136 +
1.137 +The operator ANDs the first operand with the second and then assigns the result
1.138 +back to the first operand.
1.139 +
1.140 +Note:
1.141 +
1.142 +This operates in the TRgb domain. Graphics defines logical operations for
1.143 +drawing primitives which operate in the device colour domain.
1.144 +
1.145 +@param aColor Colour to be compared.
1.146 +@return First operand-contains result of logical AND. */
1.147 + {iValue&=aColor.iValue;return(*this);}
1.148 +
1.149 +inline TRgb& TRgb::operator|=(const TRgb& aColor)
1.150 +/** Logical OR assignment operator.
1.151 +
1.152 +The operator ORs the first operand with the second and then assigns the result
1.153 +back to the first operand.
1.154 +
1.155 +Note:
1.156 +
1.157 +This operates in the TRgb domain. Graphics defines logical operations for
1.158 +drawing primitives which operate in the device colour domain.
1.159 +
1.160 +@param aColor Colour to be compared.
1.161 +@return First operand- contains result of logical OR. */
1.162 + {iValue|=aColor.iValue;return(*this);}
1.163 +
1.164 +
1.165 +inline TRgb& TRgb::operator^=(const TRgb& aColor)
1.166 +/** Logical EXCLUSIVE OR assignment operator.
1.167 +
1.168 +The operator Exclusive ORs the first operand with the second and then assigns
1.169 +the result back to the first operand.
1.170 +
1.171 +Note:
1.172 +
1.173 +This operates in the TRgb domain. Graphics defines logical operations for
1.174 +drawing primitives which operate in the device colour domain.
1.175 +
1.176 +@param aColor Colour to be compared.
1.177 +@return First operand contains result of logical Exclusive OR. */
1.178 + {iValue^=aColor.iValue;iValue^=0xff000000; return(*this);}
1.179 +
1.180 +
1.181 +inline TUint32 TRgb::Value() const
1.182 +/** Gets the 32-bit value of the TRgb as an integer.
1.183 +This function is deprecated. Use Internal() instead.
1.184 +
1.185 +@return The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number of blue,
1.186 +gg is the hex number for green, rr is the hex number for red and aa is the hex number of
1.187 +alpha (0 means opaque, 255 means transparent).
1.188 +@deprecated */
1.189 + // rr gg bb aa
1.190 + {return (((iValue & 0xff0000) >> 16) | (iValue & 0x00ff00) | ((iValue & 0x0000ff) << 16) | (0xff000000 - (iValue & 0xff000000)));}
1.191 +
1.192 +inline TUint32 TRgb::Internal() const
1.193 +/** Gets the 32-bit value of the TRgb as an integer.
1.194 +
1.195 +@return The 32 bit value of the TRgb. Has the form 0xaarrggbb. */
1.196 + {return (iValue);}
1.197 +
1.198 +inline void TRgb::SetInternal(TUint32 aInternal)
1.199 +/** Sets the 32-bit value of the TRgb as a 32-bit integer.
1.200 +@param aInternal Colour internal representation. Has the form 0xaarrggbb.
1.201 +*/
1.202 + {iValue = aInternal;}
1.203 +
1.204 +inline TRgb TRgb::operator~() const
1.205 +/** Bitwise logical inversion operator.
1.206 +
1.207 +@return Contains results of logical inversion. */
1.208 + {TRgb rgb; rgb.SetInternal(iValue^0x00ffffff); return rgb;}
1.209 +
1.210 +
1.211 +inline TRgb TRgb::operator&(const TRgb& aColor)
1.212 +/** Bitwise logical AND operator.
1.213 +
1.214 +@param aColor Colour to be compared.
1.215 +@return Contains results of logical AND. */
1.216 + {TRgb rgb; rgb.SetInternal(iValue&aColor.iValue); return rgb;}
1.217 +
1.218 +
1.219 +inline TRgb TRgb::operator|(const TRgb& aColor)
1.220 +/** Bitwise logical OR operator.
1.221 +
1.222 +@param aColor Colour to be compared.
1.223 +@return Contains results of logical OR. */
1.224 + {TRgb rgb; rgb.SetInternal(iValue|aColor.iValue); return rgb;}
1.225 +
1.226 +
1.227 +inline TRgb TRgb::operator^(const TRgb& aColor)
1.228 +/** Bitwise EXCLUSIVE OR operator
1.229 +
1.230 +@param aColor Colour to be compared.
1.231 +@return Contains results of logical EXCLUSIVE OR. */
1.232 + {TRgb rgb; rgb.SetInternal(iValue^aColor.iValue); return rgb;}
1.233 +
1.234 +
1.235 +/** Gets TRgb from 2 level grayscale.
1.236 +
1.237 +The function takes a grayscale argument and return a TRgb whose red, green
1.238 +and blue values are set to an appropriate level.
1.239 +
1.240 +@param aGray2 Grayscale value to be converted.
1.241 +@return Equivalent 24 bit colour. Gray2 has only 2 levels (black and white),
1.242 +the function returns r=g=b=0 or r=g=b=255. */
1.243 +inline TRgb TRgb::_Gray2(TInt aGray2)
1.244 + {
1.245 + if(aGray2) return(TRgb(0xffffff, 0xff));
1.246 + return(TRgb(0, 0xff));
1.247 + }
1.248 +
1.249 +/** Gets TRgb from 4 level grayscale.
1.250 +
1.251 +The function takes a grayscale argument and return a TRgb whose red, green
1.252 +and blue values are set to an appropriate level.
1.253 +
1.254 +@param aGray4 Grayscale value to be converted.
1.255 +@return Equivalent 24 bit colour. Gray4 has 4 levels- the function returns
1.256 +r=g=b=85*c, where c=0,1,2, or 3. */
1.257 +inline TRgb TRgb::_Gray4(TInt aGray4)
1.258 + {
1.259 + aGray4&=3;
1.260 + aGray4|=aGray4<<2;
1.261 + aGray4|=aGray4<<4;
1.262 + return(TRgb(aGray4,aGray4,aGray4));
1.263 + }
1.264 +
1.265 +/** Gets TRgb from 16 level grayscale.
1.266 +
1.267 +The function takes a grayscale argument and return a TRgb whose red, green
1.268 +and blue values are set to an appropriate level.
1.269 +
1.270 +@param aGray16 Grayscale value to be converted.
1.271 +@return Equivalent 24 bit colour. Gray16 has 16 levels - the function returns
1.272 +r=g=b=17*c, where c=0, 1, ... 15. */
1.273 +inline TRgb TRgb::_Gray16(TInt aGray16)
1.274 + {
1.275 + aGray16&=0xf;
1.276 + aGray16|=aGray16<<4;
1.277 + return(TRgb(aGray16,aGray16,aGray16));
1.278 + }
1.279 +
1.280 +/** Gets TRgb from 256 level grayscale.
1.281 +
1.282 +The function takes a grayscale argument and return a TRgb whose red, green
1.283 +and blue values are set to an appropriate level.
1.284 +
1.285 +@param aGray256 Grayscale value to be converted.
1.286 +@return Equivalent 24 bit colour. Gray256 has 256 levels- the function
1.287 +returns r=g=b=c, where c=0, 1, ... 255. */
1.288 +inline TRgb TRgb::_Gray256(TInt aGray256)
1.289 + {
1.290 + aGray256&=0xff;
1.291 + return(TRgb(aGray256,aGray256,aGray256));
1.292 + }
1.293 +
1.294 +/** Gets TRgb from 4K colour index.
1.295 +
1.296 +The function takes a 12 bit index into a colour palette and returns a TRgb
1.297 +whose red, green and blue values are set to an appropriate level.
1.298 +
1.299 +@param aColor4K 12 bit index into a colour palette
1.300 +@return Equivalent 24 bit colour. */
1.301 +inline TRgb TRgb::_Color4K(TInt aColor4K)
1.302 + {
1.303 + TUint32 value = (aColor4K & 0xf00) << 8;
1.304 + value |= (aColor4K & 0x0f0) << 4;
1.305 + value |= (aColor4K & 0x00f);
1.306 + return TRgb(value | (value << 4), 0xff);
1.307 + }
1.308 +
1.309 +/** Gets TRgb from 64K colour index.
1.310 +
1.311 +The function takes a 16 bit index into a colour palette and returns a TRgb
1.312 +whose red, green and blue values are set to an appropriate level.
1.313 +
1.314 +@param aColor64K 16 bit index into a colour palette
1.315 +@return Equivalent 24 bit colour. */
1.316 +inline TRgb TRgb::_Color64K(TInt aColor64K)
1.317 + {
1.318 + TInt red = (aColor64K&0xF800)>>8;
1.319 + red += red>>5;
1.320 + TInt green = (aColor64K&0x07E0)>>3;
1.321 + green += green>>6;
1.322 + TInt blue = (aColor64K&0x001F)<<3;
1.323 + blue += blue>>5;
1.324 + return TRgb(red,green,blue);
1.325 + }
1.326 +
1.327 +/** Gets TRgb from 16M colour index.
1.328 +
1.329 +The function takes a 24 bit index into a colour palette and returns the TRgb
1.330 +whose red, green and blue values represent it exactly.
1.331 +
1.332 +@param a0RGB 24 bit index into a colour palette
1.333 +@return The TRgb which represents the index exactly. */
1.334 +inline TRgb TRgb::_Color16M(TInt a0RGB)
1.335 + {
1.336 + return TRgb(a0RGB, 0xff);
1.337 + }
1.338 +
1.339 +/** Gets TRgb from 16MU colour index.
1.340 +The function takes a 24 bit colour value with eight bits for each
1.341 +component, blue in the low byte, and returns the TRgb
1.342 +whose red, green and blue values represent it exactly.
1.343 +@param a0RGB The color - 0, R, G, B bytes. / BGR0 - little endian format /
1.344 +@return The TRgb which represents the index exactly. */
1.345 +inline TRgb TRgb::_Color16MU(TInt a0RGB)
1.346 + {
1.347 + return TRgb(a0RGB, 0xff);
1.348 + }
1.349 +
1.350 +/** Gets the index of the closest TRgb value to this,
1.351 +based on the matching display mode.
1.352 +
1.353 +@return The index (0 - 1) representing the nearest TRgb. */
1.354 +inline TInt TRgb::_Gray2() const
1.355 + {
1.356 + return(Gray256()>>7);
1.357 + }
1.358 +
1.359 +/**Gets the index of the closest TRgb value to this,
1.360 +based on the matching display mode.
1.361 +
1.362 +@return The index (0 - 3) representing the nearest TRgb. */
1.363 +inline TInt TRgb::_Gray4() const
1.364 + {
1.365 + return(Gray256()>>6);
1.366 + }
1.367 +
1.368 +/** Gets the index of the closest TRgb value to this,
1.369 +based on the matching display mode.
1.370 +
1.371 +@return The index (0 - 15) representing the nearest TRgb.*/
1.372 +inline TInt TRgb::_Gray16() const
1.373 + {
1.374 + return(Gray256()>>4);
1.375 + }
1.376 +
1.377 +/** Gets the index of the closest TRgb value to this,
1.378 +based on the matching display mode.
1.379 +
1.380 +@return The index (0 - 255) representing the nearest TRgb.*/
1.381 +inline TInt TRgb::_Gray256() const
1.382 + {
1.383 + return(((Red()<<1)+Green()+(Green()<<2)+Blue())>>3);
1.384 + }
1.385 +
1.386 +/** Gets the index of the closest TRgb value to this,
1.387 +based on the matching display mode.
1.388 +
1.389 +@return The index (0 - 4095) representing the nearest TRgb. */
1.390 +inline TInt TRgb::_Color4K() const
1.391 + {
1.392 + TInt color4K = (iValue & 0x0000f0) >> 4;
1.393 + color4K |= (iValue & 0x00f000) >> 8;
1.394 + color4K |= (iValue & 0xf00000) >> 12;
1.395 + return color4K;
1.396 + } //0RGB
1.397 +
1.398 +/** Gets the index of the closest TRgb value to this,
1.399 +based on the matching display mode.
1.400 +
1.401 +@return The index (0 - 65535) representing the nearest TRgb.*/
1.402 +inline TInt TRgb::_Color64K() const
1.403 + {
1.404 + TInt color64K = (iValue & 0x0000f8) >> 3;
1.405 + color64K |= (iValue & 0x00fc00) >> 5;
1.406 + color64K |= (iValue & 0xf80000) >> 8;
1.407 + return color64K;
1.408 + }
1.409 +
1.410 +/** Gets the index of the closest TRgb value to this,
1.411 +based on the matching display mode.
1.412 +
1.413 +@return The index (0 - 16777215) representing the nearest TRgb.*/
1.414 +inline TInt TRgb::_Color16M() const
1.415 + {
1.416 + return (iValue & 0xffffff);
1.417 + // 0RGB
1.418 + }
1.419 +
1.420 +/** Gets the index of the closest TRgb value to this, based on the matching display mode.
1.421 +@return The index (0 - 16777215) representing the nearest TRgb. */
1.422 +inline TInt TRgb::_Color16MU() const
1.423 + {
1.424 + return (iValue & 0xffffff);
1.425 + // 0RGB
1.426 + }
1.427 +
1.428 +
1.429 +/** Gets the alpha component.
1.430 +@return The alpha component (0 - 255). */
1.431 +inline TInt TRgb::Alpha() const
1.432 + {return (iValue >> 24);}
1.433 +
1.434 +
1.435 +/** Gets TRgb from 16MA colour index.
1.436 +The function takes a 32 bit colour value with eight bits for each
1.437 +component, blue in the low byte, and returns the TRgb
1.438 +whose red, green, blue and alpha values represent it exactly.
1.439 +@param aARGB The color - A, R, G, B bytes. / BGR0 - little endian format /
1.440 +@return The TRgb which represents the index exactly. */
1.441 +inline TRgb TRgb::_Color16MA(TUint aARGB)
1.442 + {
1.443 + TRgb col; col.SetInternal(aARGB);
1.444 + return col;
1.445 + }
1.446 +
1.447 +/** Gets the index of the closest TRgb value to this, based on the matching display mode.
1.448 +@return The index (0 - 16777215) representing the nearest TRgb. */
1.449 +inline TUint TRgb::_Color16MA() const
1.450 + {
1.451 + return (iValue);
1.452 + // ARGB
1.453 + }
1.454 +//
1.455 +// CPalette
1.456 +//
1.457 +
1.458 +
1.459 +inline TInt CPalette::Entries() const
1.460 +/** Gets the number of entries in the palette
1.461 +
1.462 +@return The number of entries in the palette. */
1.463 + {return(iNumEntries);}
1.464 +
1.465 +//
1.466 +// TColor256Utils
1.467 +//
1.468 +
1.469 +
1.470 +inline TRgb TColor256Util::Color256(TInt aColor256) const
1.471 +/** Gets the TRgb value of the entry at the specified index in the colour lookup
1.472 +table.
1.473 +
1.474 +@param aColor256 The index into the colour lookup table.
1.475 +@return The TRgb value of the entry at the specified index. */
1.476 + { return TRgb(iColorTable[aColor256]); }
1.477 +
1.478 +//
1.479 +// TFontStyle
1.480 +//
1.481 +inline TGlyphBitmapType TFontStyle::BitmapType() const
1.482 +/** Gets the anti-aliasing setting for the font, as set by SetBitmapType().
1.483 +
1.484 +@return Indicates whether or not this font should be drawn using anti-aliasing. */
1.485 + {
1.486 + return (TGlyphBitmapType)(iFlags >> 16);
1.487 + }
1.488 +
1.489 +
1.490 +inline void TFontStyle::SetBitmapType(TGlyphBitmapType aBitmapType)
1.491 +/** Sets whether the font should be drawn using anti-aliasing. If set, this value
1.492 +overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType())
1.493 +for this font.
1.494 +
1.495 +Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing
1.496 +support for bitmapped fonts.
1.497 +
1.498 +@param aBitmapType Indicates whether or not this font should be drawn using
1.499 +anti-aliasing. */
1.500 + {
1.501 + iFlags &= 0xFFFF;
1.502 + iFlags |= (aBitmapType << 16);
1.503 + }
1.504 +
1.505 +//
1.506 +// CBitmapDevice
1.507 +//
1.508 +
1.509 +
1.510 +inline TInt CBitmapDevice::CreateBitmapContext(CBitmapContext*& aGC)
1.511 +/** Creates a bitmap context for this bitmap device.
1.512 +
1.513 +@param aGC On return, holds a pointer to the created bitmap context.
1.514 +@return KErrNone, if successful; otherwise, another of the system-wide error
1.515 +codes. */
1.516 + {return(CreateContext((CGraphicsContext*&)aGC));} // relies on CBitmapContext deriving _only_ from CGraphicsContext
1.517 +
1.518 +//
1.519 +// TPictureCapability
1.520 +//
1.521 +
1.522 +inline TPictureCapability::TPictureCapability(TScalingType aScalingType,TBool aCroppable):
1.523 + iScalingType(aScalingType),iIsCroppable(aCroppable)
1.524 +/** Constructs the object setting the scaling-type and croppability properties.
1.525 +
1.526 +@param aScalingType Whether or not the picture is scalable.
1.527 +@param aCroppable Whether or not the picture is croppable. */
1.528 + {}
1.529 +
1.530 +//
1.531 +// TZoomFactor
1.532 +//
1.533 +
1.534 +
1.535 +inline TZoomFactor::TZoomFactor(const MGraphicsDeviceMap* aDevice):
1.536 + iZoomFactor(TZoomFactor::EZoomOneToOne),
1.537 + iDevice(aDevice)
1.538 +/** Constructs a zoom factor object for a specific graphics device map.
1.539 +
1.540 +The graphics map is either directly associated with a particular graphics
1.541 +device itself, or is associated with a hierarchy of device maps whose root
1.542 +map is associated with a particular graphics device.
1.543 +
1.544 +@param aDevice The graphics device map with which the zoom factor is associated. */
1.545 + {}
1.546 +
1.547 +inline TZoomFactor::TZoomFactor(const TZoomFactor* aDevice):
1.548 + iDevice(aDevice)
1.549 + {
1.550 + iZoomFactor=aDevice->iZoomFactor;
1.551 + }
1.552 +
1.553 +
1.554 +inline void TZoomFactor::SetGraphicsDeviceMap(const MGraphicsDeviceMap* aDevice)
1.555 +/** Sets the graphics device map for this zoom factor object.
1.556 +
1.557 +@param aDevice The graphics device map for this TZoomFactor. */
1.558 + {iDevice=aDevice;}
1.559 +
1.560 +
1.561 +inline const MGraphicsDeviceMap* TZoomFactor::GraphicsDeviceMap() const
1.562 +/** Gets the graphics device map of this zoom factor object.
1.563 +
1.564 +@return The graphics device map of the TZoomFactor. */
1.565 + {return(iDevice);}
1.566 +
1.567 +
1.568 +
1.569 +/** Gets the ascent of an ANSI capital letter in the font whether or not
1.570 +there are any ANSI capitals in the font.
1.571 +@return The positive distance from the font baseline to the top of a
1.572 +standard ANSI capital letter
1.573 +@publishedAll
1.574 +@released
1.575 +*/
1.576 +inline TInt CFont::FontCapitalAscent() const
1.577 + {
1.578 + return ExtendedFunction(KFontCapitalAscent);
1.579 + }
1.580 +
1.581 +/** Gets the max ascent of any pre-composed glyph in the font. This will
1.582 +include accents or diacritics that form part of pre-composed glyphs. It is
1.583 +not guaranteed to cover the max ascent of composite glyphs that have to be
1.584 +created by a layout engine. This is also the recommended distance between
1.585 +the top of a text box and the baseline of the first line of text.
1.586 +@return The positive distance from the font baseline to the top of the
1.587 +highest pre-composed glyph (including accents) above the baseline
1.588 +@publishedAll
1.589 +@released
1.590 +*/
1.591 +inline TInt CFont::FontMaxAscent() const
1.592 + {
1.593 + return ExtendedFunction(KFontMaxAscent);
1.594 + }
1.595 +
1.596 +/** Gets the descent of an ANSI descending character in the font.
1.597 +Whether or not there are any ANSI descenders in the font.
1.598 +@return The positive distance from the font baseline to the bottom of the
1.599 +lowest ANSI descender
1.600 +@publishedAll
1.601 +@released
1.602 +*/
1.603 +inline TInt CFont::FontStandardDescent() const
1.604 + {
1.605 + return ExtendedFunction(KFontStandardDescent);
1.606 + }
1.607 +
1.608 +/** Gets the max descent of any pre-composed glyph in the font. This will
1.609 +include accents or diacritics that form part of pre-composed glyphs. It is
1.610 +not guaranteed to cover the max descent of composite glyphs that have to be
1.611 +created by a layout engine.
1.612 +@return The positive distance from the font baseline to the bottom of the
1.613 +lowest pre-composed glyph (including accents) below the baseline
1.614 +@publishedAll
1.615 +@released
1.616 +*/
1.617 +inline TInt CFont::FontMaxDescent() const
1.618 + {
1.619 + return ExtendedFunction(KFontMaxDescent);
1.620 + }
1.621 +
1.622 +/** Gets the suggested line gap for the font. This is the recommended
1.623 +baseline to baseline distance between successive lines of text in the font.
1.624 +@return The positive recommended gap between successive lines
1.625 +@publishedAll
1.626 +@released
1.627 +*/
1.628 +inline TInt CFont::FontLineGap() const
1.629 + {
1.630 + return ExtendedFunction(KFontLineGap);
1.631 + }
1.632 +
1.633 +/**
1.634 +Gets the (positive) maximum height in pixels of the font.
1.635 +This may differ from the design height.
1.636 +
1.637 +@return The maximum height of the font.
1.638 +@publishedAll
1.639 +@released
1.640 +*/
1.641 +inline TInt CFont::FontMaxHeight() const
1.642 + {
1.643 + return FontMaxAscent() + FontMaxDescent();
1.644 + }
1.645 +
1.646 +/** Utility function to check if a display mode has Alpha channel information
1.647 +@param aDisplayMode - the display mode being queried
1.648 +@return ETrue if display mode contains Alpha information.
1.649 +@internalTechnology
1.650 +@released
1.651 +*/
1.652 +inline TBool IsAlphaChannel(TDisplayMode aDisplayMode)
1.653 + {
1.654 + if(aDisplayMode == EColor16MAP || aDisplayMode == EColor16MA)
1.655 + return ETrue;
1.656 + else
1.657 + return EFalse;
1.658 + }
1.659 +
1.660 +/**
1.661 +@internalTechnology
1.662 +@released
1.663 +*/
1.664 +inline TUint QuoteOrBracketPair(TUint code)
1.665 + {
1.666 + // given the opening/closing quote or bracket, return the corresponding closing/opening quote or bracket
1.667 + switch(code)
1.668 + {
1.669 + case 0x0022: return 0x0022; // "..."
1.670 + case 0x0027: return 0x0027; // '...'
1.671 + case 0x0028: return 0x0029; // (...)
1.672 + case 0x003c: return 0x003e; // <...>
1.673 + case 0x005b: return 0x005d; // [...]
1.674 + case 0x007b: return 0x007d; // {...}
1.675 + case 0x2018: return 0x2019; // Single quotation marks
1.676 + case 0x201b: return 0x2019; // Single high-reversed-9 quotation mark
1.677 + case 0x201c: return 0x201d; // Double quotation marks
1.678 + case 0x201f: return 0x201d; // Double high-reversed-9 quotation mark
1.679 + case 0x2035: return 0x2032; // Single primes
1.680 + case 0x2036: return 0x2033; // Double primes
1.681 + case 0x2037: return 0x2034; // Triple primes
1.682 + case 0x2039: return 0x203a; // Single left/right-pointing angle quotation marks
1.683 + case 0x2045: return 0x2046; // Square brackets with quill
1.684 +
1.685 + case 0x0029: return 0x0028; // (...)
1.686 + case 0x003e: return 0x003c; // <...>
1.687 + case 0x005d: return 0x005b; // [...]
1.688 + case 0x007d: return 0x007b; // {...}
1.689 + case 0x2019: return 0x2018; // Single quotation marks
1.690 + case 0x201d: return 0x201c; // Double quotation marks
1.691 + case 0x2032: return 0x2035; // Single primes
1.692 + case 0x2033: return 0x2036; // Double primes
1.693 + case 0x2034: return 0x2037; // Triple primes
1.694 + case 0x203a: return 0x2039; // Single left/right-pointing angle quotation marks
1.695 + case 0x2046: return 0x2045; // Square brackets with quill
1.696 +
1.697 + default: return 0;
1.698 + }
1.699 + }
1.700 +
1.701 +/**
1.702 +@internalTechnology
1.703 +@released
1.704 +*/
1.705 +inline TBool IsIgnoredCharacterForLocalisedProcFunc(TChar aCode)
1.706 + {
1.707 + // All Devanagari characters should be ignored until DrawTextWithContext is implemented
1.708 + // The current GDI only implementation for localised punctuation only works for some
1.709 + // Devanagari characters. Hence this function 'blocks' all Devanagari characters, for now.
1.710 + if (aCode >= 0x0900 && aCode <= 0x0965)
1.711 + return ETrue;
1.712 +
1.713 + TChar::TBdCategory cat = aCode.GetBdCategory();
1.714 +
1.715 + if ((cat == TChar::ELeftToRight ||
1.716 + cat == TChar::ERightToLeft ||
1.717 + cat == TChar::ERightToLeftArabic))
1.718 + return EFalse;
1.719 +
1.720 + return ETrue;
1.721 +
1.722 + }