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