1 gdi.inl |
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 // TRgb |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 inline TRgb::TRgb(): |
|
20 iValue(0xffffffff) |
|
21 /** Constructs a TRgb initialised to KRgbWhite.*/ |
|
22 {} |
|
23 |
|
24 |
|
25 inline TRgb::TRgb(TUint32 aValue): |
|
26 iValue(((aValue & 0xff0000) >> 16) | (aValue & 0x00ff00) | ((aValue & 0x0000ff) << 16) | (0xff000000 - (aValue & 0xff000000))) |
|
27 /** Constructs a TRgb directly from a single 32-bit integer. |
|
28 |
|
29 The integer is of the form 0xaabbggrr, where bb is the hex number of blue, |
|
30 gg is the hex number for green, and rr is the hex number for red, aa is the hex number of |
|
31 alpha (0 means opaque, 255 means transparent). |
|
32 |
|
33 For example, TRgb(2,4,8) using the 3 colour constructor is equal to TRgb(0x00080402) using |
|
34 this constructor. |
|
35 |
|
36 The constructor is deprecated. Use others constructor or SetInternal() instead. |
|
37 |
|
38 @param aValue Integer representing colour value. Takes form 0x00bbggrr. |
|
39 @deprecated */ |
|
40 {} |
|
41 |
|
42 inline TRgb::TRgb(TUint32 aInternalValue, TInt aAlpha) : |
|
43 iValue((aInternalValue & 0x00ffffff) | (aAlpha << 24)) |
|
44 /** Constructs a TRgb from a 32-bit integer (which corresponds to a colour) and from an alpha value. |
|
45 |
|
46 The first parameter is of the form 0x00rrggbb, where rr is the hex number for red, |
|
47 gg is the hex number for green, and bb is the hex number of blue. |
|
48 |
|
49 The second parameter corresponds to an alpha channel (0 means transparent, 255 means opaque). |
|
50 |
|
51 For example, TRgb(2,4,8,255) using the 3 colour constructor is equal to TRgb(0x00020408, 255) using |
|
52 this constructor. |
|
53 |
|
54 The constructor is a replacement for TRgb(TUint32 aValue). |
|
55 |
|
56 @param aInternalValue Integer representing a colour value, which takes the form 0x00rrggbb. |
|
57 @param aAlpha Alpha component of the colour (0 - 255).*/ |
|
58 { |
|
59 } |
|
60 |
|
61 inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue): |
|
62 iValue(aRed<<16|aGreen<<8|aBlue|0xff000000) |
|
63 /** Constructs a TRgb from its three component colours. |
|
64 |
|
65 Each colour has a value between 0 and 255. |
|
66 |
|
67 @param aRed Red component of the colour (0 - 255). |
|
68 @param aGreen Green component of the colour (0 - 255). |
|
69 @param aBlue Blue component of the colour (0 - 255). */ |
|
70 {} |
|
71 |
|
72 /** Constructs a TRgb from its three colour components and alpha component. |
|
73 |
|
74 Each component has a value between 0 and 255. |
|
75 The fourth parameter corresponds to an alpha channel (0 means transparent, 255 means opaque). |
|
76 |
|
77 @param aRed Red component of the colour (0 - 255). |
|
78 @param aGreen Green component of the colour (0 - 255). |
|
79 @param aBlue Blue component of the colour (0 - 255). |
|
80 @param aAlpha Alpha component of the colour (0 - 255).*/ |
|
81 inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue, TInt aAlpha): |
|
82 iValue(aRed<<16|aGreen<<8|aBlue|aAlpha<<24) |
|
83 {} |
|
84 |
|
85 |
|
86 inline TInt TRgb::Red() const |
|
87 /** Gets the red component. |
|
88 |
|
89 @return The red component (0 - 255). */ |
|
90 {return((iValue&0xff0000)>>16);} |
|
91 |
|
92 |
|
93 inline TInt TRgb::Green() const |
|
94 /** Gets the green component. |
|
95 |
|
96 @return The green component (0 - 255). */ |
|
97 {return((iValue&0xff00)>>8);} |
|
98 |
|
99 |
|
100 inline TInt TRgb::Blue() const |
|
101 /** Gets the blue component. |
|
102 |
|
103 @return The blue component (0 - 255). */ |
|
104 {return(iValue&0xff);} |
|
105 |
|
106 |
|
107 inline TBool TRgb::operator==(const TRgb& aColor) const |
|
108 /** Compares this colour with the specified colour for equality. |
|
109 |
|
110 For two colours to be equal, their red, green and blue components must all |
|
111 be equal. |
|
112 |
|
113 @param aColor Colour to be compared. |
|
114 @return ETrue. if the colours are equal; EFalse, otherwise. */ |
|
115 |
|
116 {return(iValue==aColor.iValue);} |
|
117 |
|
118 |
|
119 inline TBool TRgb::operator!=(const TRgb& aColor) const |
|
120 /** Compares this colour with the specified colour for inequality. |
|
121 |
|
122 Two colours are unequal if one at least one of their red, green and blue components |
|
123 are unequal. |
|
124 |
|
125 @param aColor Colour to be compared. |
|
126 @return ETrue, if the colours are not equal; EFalse, otherwise. |
|
127 */ |
|
128 {return(!(*this==aColor));} |
|
129 |
|
130 inline TRgb& TRgb::operator&=(const TRgb& aColor) |
|
131 /** Logical AND assignment operator. |
|
132 |
|
133 The operator ANDs the first operand with the second and then assigns the result |
|
134 back to the first operand. |
|
135 |
|
136 Note: |
|
137 |
|
138 This operates in the TRgb domain. Graphics defines logical operations for |
|
139 drawing primitives which operate in the device colour domain. |
|
140 |
|
141 @param aColor Colour to be compared. |
|
142 @return First operand-contains result of logical AND. */ |
|
143 {iValue&=aColor.iValue;return(*this);} |
|
144 |
|
145 inline TRgb& TRgb::operator|=(const TRgb& aColor) |
|
146 /** Logical OR assignment operator. |
|
147 |
|
148 The operator ORs the first operand with the second and then assigns the result |
|
149 back to the first operand. |
|
150 |
|
151 Note: |
|
152 |
|
153 This operates in the TRgb domain. Graphics defines logical operations for |
|
154 drawing primitives which operate in the device colour domain. |
|
155 |
|
156 @param aColor Colour to be compared. |
|
157 @return First operand- contains result of logical OR. */ |
|
158 {iValue|=aColor.iValue;return(*this);} |
|
159 |
|
160 |
|
161 inline TRgb& TRgb::operator^=(const TRgb& aColor) |
|
162 /** Logical EXCLUSIVE OR assignment operator. |
|
163 |
|
164 The operator Exclusive ORs the first operand with the second and then assigns |
|
165 the result back to the first operand. |
|
166 |
|
167 Note: |
|
168 |
|
169 This operates in the TRgb domain. Graphics defines logical operations for |
|
170 drawing primitives which operate in the device colour domain. |
|
171 |
|
172 @param aColor Colour to be compared. |
|
173 @return First operand contains result of logical Exclusive OR. */ |
|
174 {iValue^=aColor.iValue;iValue^=0xff000000; return(*this);} |
|
175 |
|
176 |
|
177 inline TUint32 TRgb::Value() const |
|
178 /** Gets the 32-bit value of the TRgb as an integer. |
|
179 This function is deprecated. Use Internal() instead. |
|
180 |
|
181 @return The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number of blue, |
|
182 gg is the hex number for green, rr is the hex number for red and aa is the hex number of |
|
183 alpha (0 means opaque, 255 means transparent). |
|
184 @deprecated */ |
|
185 // rr gg bb aa |
|
186 {return (((iValue & 0xff0000) >> 16) | (iValue & 0x00ff00) | ((iValue & 0x0000ff) << 16) | (0xff000000 - (iValue & 0xff000000)));} |
|
187 |
|
188 inline TUint32 TRgb::Internal() const |
|
189 /** Gets the 32-bit value of the TRgb as an integer. |
|
190 |
|
191 @return The 32 bit value of the TRgb. Has the form 0xaarrggbb. */ |
|
192 {return (iValue);} |
|
193 |
|
194 inline void TRgb::SetInternal(TUint32 aInternal) |
|
195 /** Sets the 32-bit value of the TRgb as a 32-bit integer. |
|
196 @param aInternal Colour internal representation. Has the form 0xaarrggbb. |
|
197 */ |
|
198 {iValue = aInternal;} |
|
199 |
|
200 inline TRgb TRgb::operator~() const |
|
201 /** Bitwise logical inversion operator. |
|
202 |
|
203 @return Contains results of logical inversion. */ |
|
204 {TRgb rgb; rgb.SetInternal(iValue^0x00ffffff); return rgb;} |
|
205 |
|
206 |
|
207 inline TRgb TRgb::operator&(const TRgb& aColor) |
|
208 /** Bitwise logical AND operator. |
|
209 |
|
210 @param aColor Colour to be compared. |
|
211 @return Contains results of logical AND. */ |
|
212 {TRgb rgb; rgb.SetInternal(iValue&aColor.iValue); return rgb;} |
|
213 |
|
214 |
|
215 inline TRgb TRgb::operator|(const TRgb& aColor) |
|
216 /** Bitwise logical OR operator. |
|
217 |
|
218 @param aColor Colour to be compared. |
|
219 @return Contains results of logical OR. */ |
|
220 {TRgb rgb; rgb.SetInternal(iValue|aColor.iValue); return rgb;} |
|
221 |
|
222 |
|
223 inline TRgb TRgb::operator^(const TRgb& aColor) |
|
224 /** Bitwise EXCLUSIVE OR operator |
|
225 |
|
226 @param aColor Colour to be compared. |
|
227 @return Contains results of logical EXCLUSIVE OR. */ |
|
228 {TRgb rgb; rgb.SetInternal(iValue^aColor.iValue); return rgb;} |
|
229 |
|
230 |
|
231 /** Gets TRgb from 2 level grayscale. |
|
232 |
|
233 The function takes a grayscale argument and return a TRgb whose red, green |
|
234 and blue values are set to an appropriate level. |
|
235 |
|
236 @param aGray2 Grayscale value to be converted. |
|
237 @return Equivalent 24 bit colour. Gray2 has only 2 levels (black and white), |
|
238 the function returns r=g=b=0 or r=g=b=255. */ |
|
239 inline TRgb TRgb::_Gray2(TInt aGray2) |
|
240 { |
|
241 if(aGray2) return(TRgb(0xffffff, 0xff)); |
|
242 return(TRgb(0, 0xff)); |
|
243 } |
|
244 |
|
245 /** Gets TRgb from 4 level grayscale. |
|
246 |
|
247 The function takes a grayscale argument and return a TRgb whose red, green |
|
248 and blue values are set to an appropriate level. |
|
249 |
|
250 @param aGray4 Grayscale value to be converted. |
|
251 @return Equivalent 24 bit colour. Gray4 has 4 levels- the function returns |
|
252 r=g=b=85*c, where c=0,1,2, or 3. */ |
|
253 inline TRgb TRgb::_Gray4(TInt aGray4) |
|
254 { |
|
255 aGray4&=3; |
|
256 aGray4|=aGray4<<2; |
|
257 aGray4|=aGray4<<4; |
|
258 return(TRgb(aGray4,aGray4,aGray4)); |
|
259 } |
|
260 |
|
261 /** Gets TRgb from 16 level grayscale. |
|
262 |
|
263 The function takes a grayscale argument and return a TRgb whose red, green |
|
264 and blue values are set to an appropriate level. |
|
265 |
|
266 @param aGray16 Grayscale value to be converted. |
|
267 @return Equivalent 24 bit colour. Gray16 has 16 levels - the function returns |
|
268 r=g=b=17*c, where c=0, 1, ... 15. */ |
|
269 inline TRgb TRgb::_Gray16(TInt aGray16) |
|
270 { |
|
271 aGray16&=0xf; |
|
272 aGray16|=aGray16<<4; |
|
273 return(TRgb(aGray16,aGray16,aGray16)); |
|
274 } |
|
275 |
|
276 /** Gets TRgb from 256 level grayscale. |
|
277 |
|
278 The function takes a grayscale argument and return a TRgb whose red, green |
|
279 and blue values are set to an appropriate level. |
|
280 |
|
281 @param aGray256 Grayscale value to be converted. |
|
282 @return Equivalent 24 bit colour. Gray256 has 256 levels- the function |
|
283 returns r=g=b=c, where c=0, 1, ... 255. */ |
|
284 inline TRgb TRgb::_Gray256(TInt aGray256) |
|
285 { |
|
286 aGray256&=0xff; |
|
287 return(TRgb(aGray256,aGray256,aGray256)); |
|
288 } |
|
289 |
|
290 /** Gets TRgb from 4K colour index. |
|
291 |
|
292 The function takes a 12 bit index into a colour palette and returns a TRgb |
|
293 whose red, green and blue values are set to an appropriate level. |
|
294 |
|
295 @param aColor4K 12 bit index into a colour palette |
|
296 @return Equivalent 24 bit colour. */ |
|
297 inline TRgb TRgb::_Color4K(TInt aColor4K) |
|
298 { |
|
299 TUint32 value = (aColor4K & 0xf00) << 8; |
|
300 value |= (aColor4K & 0x0f0) << 4; |
|
301 value |= (aColor4K & 0x00f); |
|
302 return TRgb(value | (value << 4), 0xff); |
|
303 } |
|
304 |
|
305 /** Gets TRgb from 64K colour index. |
|
306 |
|
307 The function takes a 16 bit index into a colour palette and returns a TRgb |
|
308 whose red, green and blue values are set to an appropriate level. |
|
309 |
|
310 @param aColor64K 16 bit index into a colour palette |
|
311 @return Equivalent 24 bit colour. */ |
|
312 inline TRgb TRgb::_Color64K(TInt aColor64K) |
|
313 { |
|
314 TInt red = (aColor64K&0xF800)>>8; |
|
315 red += red>>5; |
|
316 TInt green = (aColor64K&0x07E0)>>3; |
|
317 green += green>>6; |
|
318 TInt blue = (aColor64K&0x001F)<<3; |
|
319 blue += blue>>5; |
|
320 return TRgb(red,green,blue); |
|
321 } |
|
322 |
|
323 /** Gets TRgb from 16M colour index. |
|
324 |
|
325 The function takes a 24 bit index into a colour palette and returns the TRgb |
|
326 whose red, green and blue values represent it exactly. |
|
327 |
|
328 @param a0RGB 24 bit index into a colour palette |
|
329 @return The TRgb which represents the index exactly. */ |
|
330 inline TRgb TRgb::_Color16M(TInt a0RGB) |
|
331 { |
|
332 return TRgb(a0RGB, 0xff); |
|
333 } |
|
334 |
|
335 /** Gets TRgb from 16MU colour index. |
|
336 The function takes a 24 bit colour value with eight bits for each |
|
337 component, blue in the low byte, and returns the TRgb |
|
338 whose red, green and blue values represent it exactly. |
|
339 @param a0RGB The color - 0, R, G, B bytes. / BGR0 - little endian format / |
|
340 @return The TRgb which represents the index exactly. */ |
|
341 inline TRgb TRgb::_Color16MU(TInt a0RGB) |
|
342 { |
|
343 return TRgb(a0RGB, 0xff); |
|
344 } |
|
345 |
|
346 /** Gets the index of the closest TRgb value to this, |
|
347 based on the matching display mode. |
|
348 |
|
349 @return The index (0 - 1) representing the nearest TRgb. */ |
|
350 inline TInt TRgb::_Gray2() const |
|
351 { |
|
352 return(Gray256()>>7); |
|
353 } |
|
354 |
|
355 /**Gets the index of the closest TRgb value to this, |
|
356 based on the matching display mode. |
|
357 |
|
358 @return The index (0 - 3) representing the nearest TRgb. */ |
|
359 inline TInt TRgb::_Gray4() const |
|
360 { |
|
361 return(Gray256()>>6); |
|
362 } |
|
363 |
|
364 /** Gets the index of the closest TRgb value to this, |
|
365 based on the matching display mode. |
|
366 |
|
367 @return The index (0 - 15) representing the nearest TRgb.*/ |
|
368 inline TInt TRgb::_Gray16() const |
|
369 { |
|
370 return(Gray256()>>4); |
|
371 } |
|
372 |
|
373 /** Gets the index of the closest TRgb value to this, |
|
374 based on the matching display mode. |
|
375 |
|
376 @return The index (0 - 255) representing the nearest TRgb.*/ |
|
377 inline TInt TRgb::_Gray256() const |
|
378 { |
|
379 return(((Red()<<1)+Green()+(Green()<<2)+Blue())>>3); |
|
380 } |
|
381 |
|
382 /** Gets the index of the closest TRgb value to this, |
|
383 based on the matching display mode. |
|
384 |
|
385 @return The index (0 - 4095) representing the nearest TRgb. */ |
|
386 inline TInt TRgb::_Color4K() const |
|
387 { |
|
388 TInt color4K = (iValue & 0x0000f0) >> 4; |
|
389 color4K |= (iValue & 0x00f000) >> 8; |
|
390 color4K |= (iValue & 0xf00000) >> 12; |
|
391 return color4K; |
|
392 } //0RGB |
|
393 |
|
394 /** Gets the index of the closest TRgb value to this, |
|
395 based on the matching display mode. |
|
396 |
|
397 @return The index (0 - 65535) representing the nearest TRgb.*/ |
|
398 inline TInt TRgb::_Color64K() const |
|
399 { |
|
400 TInt color64K = (iValue & 0x0000f8) >> 3; |
|
401 color64K |= (iValue & 0x00fc00) >> 5; |
|
402 color64K |= (iValue & 0xf80000) >> 8; |
|
403 return color64K; |
|
404 } |
|
405 |
|
406 /** Gets the index of the closest TRgb value to this, |
|
407 based on the matching display mode. |
|
408 |
|
409 @return The index (0 - 16777215) representing the nearest TRgb.*/ |
|
410 inline TInt TRgb::_Color16M() const |
|
411 { |
|
412 return (iValue & 0xffffff); |
|
413 // 0RGB |
|
414 } |
|
415 |
|
416 /** Gets the index of the closest TRgb value to this, based on the matching display mode. |
|
417 @return The index (0 - 16777215) representing the nearest TRgb. */ |
|
418 inline TInt TRgb::_Color16MU() const |
|
419 { |
|
420 return (iValue & 0xffffff); |
|
421 // 0RGB |
|
422 } |
|
423 |
|
424 |
|
425 /** Gets the alpha component. |
|
426 @return The alpha component (0 - 255). */ |
|
427 inline TInt TRgb::Alpha() const |
|
428 {return (iValue >> 24);} |
|
429 |
|
430 |
|
431 /** Gets TRgb from 16MA colour index. |
|
432 The function takes a 32 bit colour value with eight bits for each |
|
433 component, blue in the low byte, and returns the TRgb |
|
434 whose red, green, blue and alpha values represent it exactly. |
|
435 @param aARGB The color - A, R, G, B bytes. / BGR0 - little endian format / |
|
436 @return The TRgb which represents the index exactly. */ |
|
437 inline TRgb TRgb::_Color16MA(TUint aARGB) |
|
438 { |
|
439 TRgb col; col.SetInternal(aARGB); |
|
440 return col; |
|
441 } |
|
442 |
|
443 /** Gets the index of the closest TRgb value to this, based on the matching display mode. |
|
444 @return The index (0 - 16777215) representing the nearest TRgb. */ |
|
445 inline TUint TRgb::_Color16MA() const |
|
446 { |
|
447 return (iValue); |
|
448 // ARGB |
|
449 } |
|
450 // |
|
451 // CPalette |
|
452 // |
|
453 |
|
454 |
|
455 inline TInt CPalette::Entries() const |
|
456 /** Gets the number of entries in the palette |
|
457 |
|
458 @return The number of entries in the palette. */ |
|
459 {return(iNumEntries);} |
|
460 |
|
461 // |
|
462 // TColor256Utils |
|
463 // |
|
464 |
|
465 |
|
466 inline TRgb TColor256Util::Color256(TInt aColor256) const |
|
467 /** Gets the TRgb value of the entry at the specified index in the colour lookup |
|
468 table. |
|
469 |
|
470 @param aColor256 The index into the colour lookup table. |
|
471 @return The TRgb value of the entry at the specified index. */ |
|
472 { return TRgb(iColorTable[aColor256]); } |
|
473 |
|
474 // |
|
475 // TFontStyle |
|
476 // |
|
477 inline TGlyphBitmapType TFontStyle::BitmapType() const |
|
478 /** Gets the anti-aliasing setting for the font, as set by SetBitmapType(). |
|
479 |
|
480 @return Indicates whether or not this font should be drawn using anti-aliasing. */ |
|
481 { |
|
482 return (TGlyphBitmapType)(iFlags >> 16); |
|
483 } |
|
484 |
|
485 |
|
486 inline void TFontStyle::SetBitmapType(TGlyphBitmapType aBitmapType) |
|
487 /** Sets whether the font should be drawn using anti-aliasing. If set, this value |
|
488 overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) |
|
489 for this font. |
|
490 |
|
491 Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing |
|
492 support for bitmapped fonts. |
|
493 |
|
494 @param aBitmapType Indicates whether or not this font should be drawn using |
|
495 anti-aliasing. */ |
|
496 { |
|
497 iFlags &= 0xFFFF; |
|
498 iFlags |= (aBitmapType << 16); |
|
499 } |
|
500 |
|
501 // |
|
502 // CBitmapDevice |
|
503 // |
|
504 |
|
505 |
|
506 inline TInt CBitmapDevice::CreateBitmapContext(CBitmapContext*& aGC) |
|
507 /** Creates a bitmap context for this bitmap device. |
|
508 |
|
509 @param aGC On return, holds a pointer to the created bitmap context. |
|
510 @return KErrNone, if successful; otherwise, another of the system-wide error |
|
511 codes. */ |
|
512 {return(CreateContext((CGraphicsContext*&)aGC));} // relies on CBitmapContext deriving _only_ from CGraphicsContext |
|
513 |
|
514 // |
|
515 // TPictureCapability |
|
516 // |
|
517 |
|
518 inline TPictureCapability::TPictureCapability(TScalingType aScalingType,TBool aCroppable): |
|
519 iScalingType(aScalingType),iIsCroppable(aCroppable) |
|
520 /** Constructs the object setting the scaling-type and croppability properties. |
|
521 |
|
522 @param aScalingType Whether or not the picture is scalable. |
|
523 @param aCroppable Whether or not the picture is croppable. */ |
|
524 {} |
|
525 |
|
526 // |
|
527 // TZoomFactor |
|
528 // |
|
529 |
|
530 |
|
531 inline TZoomFactor::TZoomFactor(const MGraphicsDeviceMap* aDevice): |
|
532 iZoomFactor(TZoomFactor::EZoomOneToOne), |
|
533 iDevice(aDevice) |
|
534 /** Constructs a zoom factor object for a specific graphics device map. |
|
535 |
|
536 The graphics map is either directly associated with a particular graphics |
|
537 device itself, or is associated with a hierarchy of device maps whose root |
|
538 map is associated with a particular graphics device. |
|
539 |
|
540 @param aDevice The graphics device map with which the zoom factor is associated. */ |
|
541 {} |
|
542 |
|
543 inline TZoomFactor::TZoomFactor(const TZoomFactor* aDevice): |
|
544 iDevice(aDevice) |
|
545 { |
|
546 iZoomFactor=aDevice->iZoomFactor; |
|
547 } |
|
548 |
|
549 |
|
550 inline void TZoomFactor::SetGraphicsDeviceMap(const MGraphicsDeviceMap* aDevice) |
|
551 /** Sets the graphics device map for this zoom factor object. |
|
552 |
|
553 @param aDevice The graphics device map for this TZoomFactor. */ |
|
554 {iDevice=aDevice;} |
|
555 |
|
556 |
|
557 inline const MGraphicsDeviceMap* TZoomFactor::GraphicsDeviceMap() const |
|
558 /** Gets the graphics device map of this zoom factor object. |
|
559 |
|
560 @return The graphics device map of the TZoomFactor. */ |
|
561 {return(iDevice);} |
|
562 |
|
563 |
|
564 |
|
565 /** Gets the ascent of an ANSI capital letter in the font whether or not |
|
566 there are any ANSI capitals in the font. |
|
567 @return The positive distance from the font baseline to the top of a |
|
568 standard ANSI capital letter |
|
569 @publishedAll |
|
570 @released |
|
571 */ |
|
572 inline TInt CFont::FontCapitalAscent() const |
|
573 { |
|
574 return ExtendedFunction(KFontCapitalAscent); |
|
575 } |
|
576 |
|
577 /** Gets the max ascent of any pre-composed glyph in the font. This will |
|
578 include accents or diacritics that form part of pre-composed glyphs. It is |
|
579 not guaranteed to cover the max ascent of composite glyphs that have to be |
|
580 created by a layout engine. This is also the recommended distance between |
|
581 the top of a text box and the baseline of the first line of text. |
|
582 @return The positive distance from the font baseline to the top of the |
|
583 highest pre-composed glyph (including accents) above the baseline |
|
584 @publishedAll |
|
585 @released |
|
586 */ |
|
587 inline TInt CFont::FontMaxAscent() const |
|
588 { |
|
589 return ExtendedFunction(KFontMaxAscent); |
|
590 } |
|
591 |
|
592 /** Gets the descent of an ANSI descending character in the font. |
|
593 Whether or not there are any ANSI descenders in the font. |
|
594 @return The positive distance from the font baseline to the bottom of the |
|
595 lowest ANSI descender |
|
596 @publishedAll |
|
597 @released |
|
598 */ |
|
599 inline TInt CFont::FontStandardDescent() const |
|
600 { |
|
601 return ExtendedFunction(KFontStandardDescent); |
|
602 } |
|
603 |
|
604 /** Gets the max descent of any pre-composed glyph in the font. This will |
|
605 include accents or diacritics that form part of pre-composed glyphs. It is |
|
606 not guaranteed to cover the max descent of composite glyphs that have to be |
|
607 created by a layout engine. |
|
608 @return The positive distance from the font baseline to the bottom of the |
|
609 lowest pre-composed glyph (including accents) below the baseline |
|
610 @publishedAll |
|
611 @released |
|
612 */ |
|
613 inline TInt CFont::FontMaxDescent() const |
|
614 { |
|
615 return ExtendedFunction(KFontMaxDescent); |
|
616 } |
|
617 |
|
618 /** Gets the suggested line gap for the font. This is the recommended |
|
619 baseline to baseline distance between successive lines of text in the font. |
|
620 @return The positive recommended gap between successive lines |
|
621 @publishedAll |
|
622 @released |
|
623 */ |
|
624 inline TInt CFont::FontLineGap() const |
|
625 { |
|
626 return ExtendedFunction(KFontLineGap); |
|
627 } |
|
628 |
|
629 /** |
|
630 Gets the (positive) maximum height in pixels of the font. |
|
631 This may differ from the design height. |
|
632 |
|
633 @return The maximum height of the font. |
|
634 @publishedAll |
|
635 @released |
|
636 */ |
|
637 inline TInt CFont::FontMaxHeight() const |
|
638 { |
|
639 return FontMaxAscent() + FontMaxDescent(); |
|
640 } |
|
641 |
|
642 /** Utility function to check if a display mode has Alpha channel information |
|
643 @param aDisplayMode - the display mode being queried |
|
644 @return ETrue if display mode contains Alpha information. |
|
645 @internalTechnology |
|
646 @released |
|
647 */ |
|
648 inline TBool IsAlphaChannel(TDisplayMode aDisplayMode) |
|
649 { |
|
650 if(aDisplayMode == EColor16MAP || aDisplayMode == EColor16MA) |
|
651 return ETrue; |
|
652 else |
|
653 return EFalse; |
|
654 } |
|
655 |
|
656 /** |
|
657 @internalTechnology |
|
658 @released |
|
659 */ |
|
660 inline TUint QuoteOrBracketPair(TUint code) |
|
661 { |
|
662 // given the opening/closing quote or bracket, return the corresponding closing/opening quote or bracket |
|
663 switch(code) |
|
664 { |
|
665 case 0x0022: return 0x0022; // "..." |
|
666 case 0x0027: return 0x0027; // '...' |
|
667 case 0x0028: return 0x0029; // (...) |
|
668 case 0x003c: return 0x003e; // <...> |
|
669 case 0x005b: return 0x005d; // [...] |
|
670 case 0x007b: return 0x007d; // {...} |
|
671 case 0x2018: return 0x2019; // Single quotation marks |
|
672 case 0x201b: return 0x2019; // Single high-reversed-9 quotation mark |
|
673 case 0x201c: return 0x201d; // Double quotation marks |
|
674 case 0x201f: return 0x201d; // Double high-reversed-9 quotation mark |
|
675 case 0x2035: return 0x2032; // Single primes |
|
676 case 0x2036: return 0x2033; // Double primes |
|
677 case 0x2037: return 0x2034; // Triple primes |
|
678 case 0x2039: return 0x203a; // Single left/right-pointing angle quotation marks |
|
679 case 0x2045: return 0x2046; // Square brackets with quill |
|
680 |
|
681 case 0x0029: return 0x0028; // (...) |
|
682 case 0x003e: return 0x003c; // <...> |
|
683 case 0x005d: return 0x005b; // [...] |
|
684 case 0x007d: return 0x007b; // {...} |
|
685 case 0x2019: return 0x2018; // Single quotation marks |
|
686 case 0x201d: return 0x201c; // Double quotation marks |
|
687 case 0x2032: return 0x2035; // Single primes |
|
688 case 0x2033: return 0x2036; // Double primes |
|
689 case 0x2034: return 0x2037; // Triple primes |
|
690 case 0x203a: return 0x2039; // Single left/right-pointing angle quotation marks |
|
691 case 0x2046: return 0x2045; // Square brackets with quill |
|
692 |
|
693 default: return 0; |
|
694 } |
|
695 } |
|
696 |
|
697 /** |
|
698 @internalTechnology |
|
699 @released |
|
700 */ |
|
701 inline TBool IsIgnoredCharacterForLocalisedProcFunc(TChar aCode) |
|
702 { |
|
703 // All Devanagari characters should be ignored until DrawTextWithContext is implemented |
|
704 // The current GDI only implementation for localised punctuation only works for some |
|
705 // Devanagari characters. Hence this function 'blocks' all Devanagari characters, for now. |
|
706 if (aCode >= 0x0900 && aCode <= 0x0965) |
|
707 return ETrue; |
|
708 |
|
709 TChar::TBdCategory cat = aCode.GetBdCategory(); |
|
710 |
|
711 if ((cat == TChar::ELeftToRight || |
|
712 cat == TChar::ERightToLeft || |
|
713 cat == TChar::ERightToLeftArabic)) |
|
714 return EFalse; |
|
715 |
|
716 return ETrue; |
|
717 |
|
718 } |