williamr@2: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // TRgb williamr@2: // williamr@2: // williamr@2: williamr@2: williamr@2: inline TRgb::TRgb(): williamr@2: iValue(0xffffffff) williamr@2: /** Constructs a TRgb initialised to KRgbWhite.*/ williamr@2: {} williamr@2: williamr@4: williamr@2: inline TRgb::TRgb(TUint32 aValue): williamr@2: iValue(((aValue & 0xff0000) >> 16) | (aValue & 0x00ff00) | ((aValue & 0x0000ff) << 16) | (0xff000000 - (aValue & 0xff000000))) williamr@2: /** Constructs a TRgb directly from a single 32-bit integer. williamr@2: williamr@4: The integer is of the form 0xaabbggrr, where bb is the hex number for blue, williamr@4: gg is the hex number for green, rr is the hex number for red, and aa is the hex number for williamr@4: "transparency" alpha (0 means opaque, 255 means transparent). williamr@2: williamr@4: This constructor is deprecated. The byte order of Red ,Green and Blue williamr@4: does not match other constructors and methods in this class, williamr@4: and the meaning of alpha is reversed compared to current convention. williamr@2: williamr@4: For example, TRgb(0x00080402) using this constructor williamr@4: can be replaced with the 3 colour constructor TRgb(2,4,8). williamr@4: The equivalent explicit alpha constructors are TRgb(0x020408,0xff) and TRgb(2,4,8,255). williamr@4: The equivalent call to SetInternal is SetInternal(0xff020408). williamr@2: williamr@4: This constructor is deprecated. Use other constructors or SetInternal() instead. williamr@4: williamr@4: @param aValue Integer representing colour value. Takes form 0x00bbggrr. williamr@2: @deprecated */ williamr@2: {} williamr@2: williamr@2: inline TRgb::TRgb(TUint32 aInternalValue, TInt aAlpha) : williamr@2: iValue((aInternalValue & 0x00ffffff) | (aAlpha << 24)) williamr@2: /** Constructs a TRgb from a 32-bit integer (which corresponds to a colour) and from an alpha value. williamr@2: williamr@4: The first parameter is of the form 0x00rrggbb, where rr is the hex number for red, williamr@4: gg is the hex number for green, and bb is the hex number for blue. williamr@2: williamr@2: The second parameter corresponds to an alpha channel (0 means transparent, 255 means opaque). williamr@2: williamr@4: For example, TRgb(2,4,8,255) using the 3 colour+alpha constructor is equal to TRgb(0x00020408, 255) using williamr@2: this constructor. williamr@2: williamr@4: This constructor, which implements alpha in the conventional way, williamr@4: replaces TRgb( TUint32 aValue ) which is deprecated. williamr@2: williamr@2: @param aInternalValue Integer representing a colour value, which takes the form 0x00rrggbb. williamr@2: @param aAlpha Alpha component of the colour (0 - 255).*/ williamr@2: { williamr@2: } williamr@2: williamr@2: inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue): williamr@2: iValue(aRed<<16|aGreen<<8|aBlue|0xff000000) williamr@2: /** Constructs a TRgb from its three component colours. williamr@2: williamr@2: Each colour has a value between 0 and 255. williamr@4: The alpha component is always set to opaque (255) williamr@2: williamr@4: @param aRed Red component of the colour (0 - 255). williamr@4: @param aGreen Green component of the colour (0 - 255). williamr@2: @param aBlue Blue component of the colour (0 - 255). */ williamr@2: {} williamr@2: williamr@2: /** Constructs a TRgb from its three colour components and alpha component. williamr@2: williamr@2: Each component has a value between 0 and 255. williamr@2: The fourth parameter corresponds to an alpha channel (0 means transparent, 255 means opaque). williamr@2: williamr@4: This constructor, which implements alpha in the conventional way, williamr@4: replaces TRgb( TUint32 aValue ) which is deprecated. williamr@4: williamr@2: @param aRed Red component of the colour (0 - 255). williamr@2: @param aGreen Green component of the colour (0 - 255). williamr@2: @param aBlue Blue component of the colour (0 - 255). williamr@2: @param aAlpha Alpha component of the colour (0 - 255).*/ williamr@2: inline TRgb::TRgb(TInt aRed,TInt aGreen,TInt aBlue, TInt aAlpha): williamr@2: iValue(aRed<<16|aGreen<<8|aBlue|aAlpha<<24) williamr@2: {} williamr@2: williamr@2: williamr@2: inline TInt TRgb::Red() const williamr@2: /** Gets the red component. williamr@2: williamr@2: @return The red component (0 - 255). */ williamr@2: {return((iValue&0xff0000)>>16);} williamr@2: williamr@2: williamr@2: inline TInt TRgb::Green() const williamr@2: /** Gets the green component. williamr@2: williamr@2: @return The green component (0 - 255). */ williamr@2: {return((iValue&0xff00)>>8);} williamr@2: williamr@2: williamr@2: inline TInt TRgb::Blue() const williamr@2: /** Gets the blue component. williamr@2: williamr@2: @return The blue component (0 - 255). */ williamr@2: {return(iValue&0xff);} williamr@2: williamr@2: williamr@2: inline TBool TRgb::operator==(const TRgb& aColor) const williamr@2: /** Compares this colour with the specified colour for equality. williamr@2: williamr@2: For two colours to be equal, their red, green and blue components must all williamr@2: be equal. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return ETrue. if the colours are equal; EFalse, otherwise. */ williamr@2: williamr@2: {return(iValue==aColor.iValue);} williamr@2: williamr@2: williamr@2: inline TBool TRgb::operator!=(const TRgb& aColor) const williamr@2: /** Compares this colour with the specified colour for inequality. williamr@2: williamr@2: Two colours are unequal if one at least one of their red, green and blue components williamr@2: are unequal. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return ETrue, if the colours are not equal; EFalse, otherwise. williamr@2: */ williamr@2: {return(!(*this==aColor));} williamr@2: williamr@2: inline TRgb& TRgb::operator&=(const TRgb& aColor) williamr@2: /** Logical AND assignment operator. williamr@2: williamr@2: The operator ANDs the first operand with the second and then assigns the result williamr@2: back to the first operand. williamr@2: williamr@2: Note: williamr@2: williamr@2: This operates in the TRgb domain. Graphics defines logical operations for williamr@2: drawing primitives which operate in the device colour domain. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return First operand-contains result of logical AND. */ williamr@2: {iValue&=aColor.iValue;return(*this);} williamr@2: williamr@2: inline TRgb& TRgb::operator|=(const TRgb& aColor) williamr@2: /** Logical OR assignment operator. williamr@2: williamr@2: The operator ORs the first operand with the second and then assigns the result williamr@2: back to the first operand. williamr@2: williamr@2: Note: williamr@2: williamr@2: This operates in the TRgb domain. Graphics defines logical operations for williamr@2: drawing primitives which operate in the device colour domain. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return First operand- contains result of logical OR. */ williamr@2: {iValue|=aColor.iValue;return(*this);} williamr@2: williamr@2: williamr@2: inline TRgb& TRgb::operator^=(const TRgb& aColor) williamr@2: /** Logical EXCLUSIVE OR assignment operator. williamr@2: williamr@2: The operator Exclusive ORs the first operand with the second and then assigns williamr@2: the result back to the first operand. williamr@2: williamr@2: Note: williamr@2: williamr@2: This operates in the TRgb domain. Graphics defines logical operations for williamr@2: drawing primitives which operate in the device colour domain. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return First operand contains result of logical Exclusive OR. */ williamr@2: {iValue^=aColor.iValue;iValue^=0xff000000; return(*this);} williamr@2: williamr@4: williamr@2: inline TUint32 TRgb::Value() const williamr@4: /** Gets the 32-bit value of the TRgb as an integer. williamr@2: This function is deprecated. Use Internal() instead. williamr@4: Note: the order of Red, Green and Blue components returned by this method williamr@4: is reversed compared to all other methods. The alpha value is also reversed in meaning williamr@4: compared to current convention, such that 0 represents opaque and 0xff represents transparent. williamr@2: williamr@4: @return The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number for blue, williamr@4: gg is the hex number for green, rr is the hex number for red, and aa is the hex number for williamr@4: "transparency" alpha (0 means opaque, 255 means transparent). williamr@4: @deprecated */ williamr@2: // rr gg bb aa williamr@2: {return (((iValue & 0xff0000) >> 16) | (iValue & 0x00ff00) | ((iValue & 0x0000ff) << 16) | (0xff000000 - (iValue & 0xff000000)));} williamr@2: williamr@2: inline TUint32 TRgb::Internal() const williamr@4: /** Gets the 32-bit value of the TRgb as an integer. williamr@2: williamr@2: @return The 32 bit value of the TRgb. Has the form 0xaarrggbb. */ williamr@2: {return (iValue);} williamr@2: williamr@2: inline void TRgb::SetInternal(TUint32 aInternal) williamr@2: /** Sets the 32-bit value of the TRgb as a 32-bit integer. williamr@4: @param aInternal Colour internal representation. Has the form 0xaarrggbb. williamr@2: */ williamr@2: {iValue = aInternal;} williamr@4: williamr@2: inline TRgb TRgb::operator~() const williamr@2: /** Bitwise logical inversion operator. williamr@2: williamr@2: @return Contains results of logical inversion. */ williamr@2: {TRgb rgb; rgb.SetInternal(iValue^0x00ffffff); return rgb;} williamr@2: williamr@2: williamr@2: inline TRgb TRgb::operator&(const TRgb& aColor) williamr@2: /** Bitwise logical AND operator. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return Contains results of logical AND. */ williamr@2: {TRgb rgb; rgb.SetInternal(iValue&aColor.iValue); return rgb;} williamr@2: williamr@2: williamr@2: inline TRgb TRgb::operator|(const TRgb& aColor) williamr@2: /** Bitwise logical OR operator. williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return Contains results of logical OR. */ williamr@2: {TRgb rgb; rgb.SetInternal(iValue|aColor.iValue); return rgb;} williamr@2: williamr@2: williamr@2: inline TRgb TRgb::operator^(const TRgb& aColor) williamr@2: /** Bitwise EXCLUSIVE OR operator williamr@2: williamr@2: @param aColor Colour to be compared. williamr@2: @return Contains results of logical EXCLUSIVE OR. */ williamr@2: {TRgb rgb; rgb.SetInternal(iValue^aColor.iValue); return rgb;} williamr@2: williamr@2: williamr@2: /** Gets TRgb from 2 level grayscale. williamr@2: williamr@2: The function takes a grayscale argument and return a TRgb whose red, green williamr@2: and blue values are set to an appropriate level. williamr@2: williamr@2: @param aGray2 Grayscale value to be converted. williamr@2: @return Equivalent 24 bit colour. Gray2 has only 2 levels (black and white), williamr@2: the function returns r=g=b=0 or r=g=b=255. */ williamr@2: inline TRgb TRgb::_Gray2(TInt aGray2) williamr@2: { williamr@2: if(aGray2) return(TRgb(0xffffff, 0xff)); williamr@2: return(TRgb(0, 0xff)); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 4 level grayscale. williamr@2: williamr@2: The function takes a grayscale argument and return a TRgb whose red, green williamr@2: and blue values are set to an appropriate level. williamr@2: williamr@2: @param aGray4 Grayscale value to be converted. williamr@2: @return Equivalent 24 bit colour. Gray4 has 4 levels- the function returns williamr@2: r=g=b=85*c, where c=0,1,2, or 3. */ williamr@2: inline TRgb TRgb::_Gray4(TInt aGray4) williamr@2: { williamr@2: aGray4&=3; williamr@2: aGray4|=aGray4<<2; williamr@2: aGray4|=aGray4<<4; williamr@2: return(TRgb(aGray4,aGray4,aGray4)); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 16 level grayscale. williamr@2: williamr@2: The function takes a grayscale argument and return a TRgb whose red, green williamr@2: and blue values are set to an appropriate level. williamr@2: williamr@2: @param aGray16 Grayscale value to be converted. williamr@2: @return Equivalent 24 bit colour. Gray16 has 16 levels - the function returns williamr@2: r=g=b=17*c, where c=0, 1, ... 15. */ williamr@2: inline TRgb TRgb::_Gray16(TInt aGray16) williamr@2: { williamr@2: aGray16&=0xf; williamr@2: aGray16|=aGray16<<4; williamr@2: return(TRgb(aGray16,aGray16,aGray16)); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 256 level grayscale. williamr@2: williamr@2: The function takes a grayscale argument and return a TRgb whose red, green williamr@2: and blue values are set to an appropriate level. williamr@2: williamr@2: @param aGray256 Grayscale value to be converted. williamr@2: @return Equivalent 24 bit colour. Gray256 has 256 levels- the function williamr@2: returns r=g=b=c, where c=0, 1, ... 255. */ williamr@2: inline TRgb TRgb::_Gray256(TInt aGray256) williamr@2: { williamr@2: aGray256&=0xff; williamr@2: return(TRgb(aGray256,aGray256,aGray256)); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 4K colour index. williamr@2: williamr@2: The function takes a 12 bit index into a colour palette and returns a TRgb williamr@2: whose red, green and blue values are set to an appropriate level. williamr@2: williamr@2: @param aColor4K 12 bit index into a colour palette williamr@2: @return Equivalent 24 bit colour. */ williamr@2: inline TRgb TRgb::_Color4K(TInt aColor4K) williamr@2: { williamr@2: TUint32 value = (aColor4K & 0xf00) << 8; williamr@2: value |= (aColor4K & 0x0f0) << 4; williamr@2: value |= (aColor4K & 0x00f); williamr@2: return TRgb(value | (value << 4), 0xff); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 64K colour index. williamr@2: williamr@2: The function takes a 16 bit index into a colour palette and returns a TRgb williamr@2: whose red, green and blue values are set to an appropriate level. williamr@2: williamr@2: @param aColor64K 16 bit index into a colour palette williamr@2: @return Equivalent 24 bit colour. */ williamr@2: inline TRgb TRgb::_Color64K(TInt aColor64K) williamr@2: { williamr@2: TInt red = (aColor64K&0xF800)>>8; williamr@2: red += red>>5; williamr@2: TInt green = (aColor64K&0x07E0)>>3; williamr@2: green += green>>6; williamr@2: TInt blue = (aColor64K&0x001F)<<3; williamr@2: blue += blue>>5; williamr@2: return TRgb(red,green,blue); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 16M colour index. williamr@2: williamr@2: The function takes a 24 bit index into a colour palette and returns the TRgb williamr@2: whose red, green and blue values represent it exactly. williamr@2: williamr@2: @param a0RGB 24 bit index into a colour palette williamr@2: @return The TRgb which represents the index exactly. */ williamr@2: inline TRgb TRgb::_Color16M(TInt a0RGB) williamr@2: { williamr@2: return TRgb(a0RGB, 0xff); williamr@2: } williamr@2: williamr@2: /** Gets TRgb from 16MU colour index. williamr@2: The function takes a 24 bit colour value with eight bits for each williamr@2: component, blue in the low byte, and returns the TRgb williamr@2: whose red, green and blue values represent it exactly. williamr@2: @param a0RGB The color - 0, R, G, B bytes. / BGR0 - little endian format / williamr@2: @return The TRgb which represents the index exactly. */ williamr@2: inline TRgb TRgb::_Color16MU(TInt a0RGB) williamr@2: { williamr@2: return TRgb(a0RGB, 0xff); williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 1) representing the nearest TRgb. */ williamr@2: inline TInt TRgb::_Gray2() const williamr@2: { williamr@2: return(Gray256()>>7); williamr@2: } williamr@2: williamr@2: /**Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 3) representing the nearest TRgb. */ williamr@2: inline TInt TRgb::_Gray4() const williamr@2: { williamr@2: return(Gray256()>>6); williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 15) representing the nearest TRgb.*/ williamr@2: inline TInt TRgb::_Gray16() const williamr@2: { williamr@2: return(Gray256()>>4); williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 255) representing the nearest TRgb.*/ williamr@2: inline TInt TRgb::_Gray256() const williamr@2: { williamr@2: return(((Red()<<1)+Green()+(Green()<<2)+Blue())>>3); williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 4095) representing the nearest TRgb. */ williamr@2: inline TInt TRgb::_Color4K() const williamr@2: { williamr@2: TInt color4K = (iValue & 0x0000f0) >> 4; williamr@2: color4K |= (iValue & 0x00f000) >> 8; williamr@2: color4K |= (iValue & 0xf00000) >> 12; williamr@2: return color4K; williamr@2: } //0RGB williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 65535) representing the nearest TRgb.*/ williamr@2: inline TInt TRgb::_Color64K() const williamr@2: { williamr@2: TInt color64K = (iValue & 0x0000f8) >> 3; williamr@2: color64K |= (iValue & 0x00fc00) >> 5; williamr@2: color64K |= (iValue & 0xf80000) >> 8; williamr@2: return color64K; williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, williamr@2: based on the matching display mode. williamr@2: williamr@2: @return The index (0 - 16777215) representing the nearest TRgb.*/ williamr@2: inline TInt TRgb::_Color16M() const williamr@2: { williamr@2: return (iValue & 0xffffff); williamr@2: // 0RGB williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, based on the matching display mode. williamr@2: @return The index (0 - 16777215) representing the nearest TRgb. */ williamr@2: inline TInt TRgb::_Color16MU() const williamr@2: { williamr@2: return (iValue & 0xffffff); williamr@2: // 0RGB williamr@2: } williamr@2: williamr@2: williamr@2: /** Gets the alpha component. williamr@2: @return The alpha component (0 - 255). */ williamr@2: inline TInt TRgb::Alpha() const williamr@2: {return (iValue >> 24);} williamr@2: williamr@2: williamr@2: /** Gets TRgb from 16MA colour index. williamr@2: The function takes a 32 bit colour value with eight bits for each williamr@2: component, blue in the low byte, and returns the TRgb williamr@2: whose red, green, blue and alpha values represent it exactly. williamr@2: @param aARGB The color - A, R, G, B bytes. / BGR0 - little endian format / williamr@2: @return The TRgb which represents the index exactly. */ williamr@2: inline TRgb TRgb::_Color16MA(TUint aARGB) williamr@2: { williamr@2: TRgb col; col.SetInternal(aARGB); williamr@2: return col; williamr@2: } williamr@2: williamr@2: /** Gets the index of the closest TRgb value to this, based on the matching display mode. williamr@2: @return The index (0 - 16777215) representing the nearest TRgb. */ williamr@2: inline TUint TRgb::_Color16MA() const williamr@2: { williamr@2: return (iValue); williamr@2: // ARGB williamr@2: } williamr@2: // williamr@2: // CPalette williamr@2: // williamr@2: williamr@2: williamr@2: inline TInt CPalette::Entries() const williamr@2: /** Gets the number of entries in the palette williamr@2: williamr@2: @return The number of entries in the palette. */ williamr@2: {return(iNumEntries);} williamr@2: williamr@2: // williamr@2: // TColor256Utils williamr@2: // williamr@2: williamr@2: williamr@2: inline TRgb TColor256Util::Color256(TInt aColor256) const williamr@2: /** Gets the TRgb value of the entry at the specified index in the colour lookup williamr@2: table. williamr@2: williamr@2: @param aColor256 The index into the colour lookup table. williamr@2: @return The TRgb value of the entry at the specified index. */ williamr@2: { return TRgb(iColorTable[aColor256]); } williamr@2: williamr@2: // williamr@2: // TFontStyle williamr@2: // williamr@2: inline TGlyphBitmapType TFontStyle::BitmapType() const williamr@2: /** Gets the anti-aliasing setting for the font, as set by SetBitmapType(). williamr@2: williamr@2: @return Indicates whether or not this font should be drawn using anti-aliasing. */ williamr@2: { williamr@2: return (TGlyphBitmapType)(iFlags >> 16); williamr@2: } williamr@2: williamr@2: williamr@2: inline void TFontStyle::SetBitmapType(TGlyphBitmapType aBitmapType) williamr@2: /** Sets whether the font should be drawn using anti-aliasing. If set, this value williamr@2: overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) williamr@2: for this font. williamr@2: williamr@2: Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing williamr@2: support for bitmapped fonts. williamr@2: williamr@2: @param aBitmapType Indicates whether or not this font should be drawn using williamr@2: anti-aliasing. */ williamr@2: { williamr@2: iFlags &= 0xFFFF; williamr@2: iFlags |= (aBitmapType << 16); williamr@2: } williamr@2: williamr@2: // williamr@2: // CBitmapDevice williamr@2: // williamr@2: williamr@2: williamr@2: inline TInt CBitmapDevice::CreateBitmapContext(CBitmapContext*& aGC) williamr@2: /** Creates a bitmap context for this bitmap device. williamr@2: williamr@2: @param aGC On return, holds a pointer to the created bitmap context. williamr@2: @return KErrNone, if successful; otherwise, another of the system-wide error williamr@2: codes. */ williamr@2: {return(CreateContext((CGraphicsContext*&)aGC));} // relies on CBitmapContext deriving _only_ from CGraphicsContext williamr@2: williamr@2: // williamr@2: // TPictureCapability williamr@2: // williamr@2: williamr@2: inline TPictureCapability::TPictureCapability(TScalingType aScalingType,TBool aCroppable): williamr@2: iScalingType(aScalingType),iIsCroppable(aCroppable) williamr@2: /** Constructs the object setting the scaling-type and croppability properties. williamr@2: williamr@2: @param aScalingType Whether or not the picture is scalable. williamr@2: @param aCroppable Whether or not the picture is croppable. */ williamr@2: {} williamr@2: williamr@2: // williamr@2: // TZoomFactor williamr@2: // williamr@2: williamr@2: williamr@2: inline TZoomFactor::TZoomFactor(const MGraphicsDeviceMap* aDevice): williamr@2: iZoomFactor(TZoomFactor::EZoomOneToOne), williamr@2: iDevice(aDevice) williamr@2: /** Constructs a zoom factor object for a specific graphics device map. williamr@2: williamr@2: The graphics map is either directly associated with a particular graphics williamr@2: device itself, or is associated with a hierarchy of device maps whose root williamr@2: map is associated with a particular graphics device. williamr@2: williamr@2: @param aDevice The graphics device map with which the zoom factor is associated. */ williamr@2: {} williamr@2: williamr@2: inline TZoomFactor::TZoomFactor(const TZoomFactor* aDevice): williamr@2: iDevice(aDevice) williamr@2: { williamr@2: iZoomFactor=aDevice->iZoomFactor; williamr@2: } williamr@2: williamr@2: williamr@2: inline void TZoomFactor::SetGraphicsDeviceMap(const MGraphicsDeviceMap* aDevice) williamr@2: /** Sets the graphics device map for this zoom factor object. williamr@2: williamr@2: @param aDevice The graphics device map for this TZoomFactor. */ williamr@2: {iDevice=aDevice;} williamr@2: williamr@2: williamr@2: inline const MGraphicsDeviceMap* TZoomFactor::GraphicsDeviceMap() const williamr@2: /** Gets the graphics device map of this zoom factor object. williamr@2: williamr@2: @return The graphics device map of the TZoomFactor. */ williamr@2: {return(iDevice);} williamr@2: williamr@2: williamr@2: williamr@2: /** Gets the ascent of an ANSI capital letter in the font whether or not williamr@2: there are any ANSI capitals in the font. williamr@2: @return The positive distance from the font baseline to the top of a williamr@2: standard ANSI capital letter williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontCapitalAscent() const williamr@2: { williamr@2: return ExtendedFunction(KFontCapitalAscent); williamr@2: } williamr@2: williamr@2: /** Gets the max ascent of any pre-composed glyph in the font. This will williamr@2: include accents or diacritics that form part of pre-composed glyphs. It is williamr@2: not guaranteed to cover the max ascent of composite glyphs that have to be williamr@2: created by a layout engine. This is also the recommended distance between williamr@2: the top of a text box and the baseline of the first line of text. williamr@2: @return The positive distance from the font baseline to the top of the williamr@2: highest pre-composed glyph (including accents) above the baseline williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontMaxAscent() const williamr@2: { williamr@2: return ExtendedFunction(KFontMaxAscent); williamr@2: } williamr@2: williamr@2: /** Gets the descent of an ANSI descending character in the font. williamr@2: Whether or not there are any ANSI descenders in the font. williamr@2: @return The positive distance from the font baseline to the bottom of the williamr@2: lowest ANSI descender williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontStandardDescent() const williamr@2: { williamr@2: return ExtendedFunction(KFontStandardDescent); williamr@2: } williamr@2: williamr@2: /** Gets the max descent of any pre-composed glyph in the font. This will williamr@2: include accents or diacritics that form part of pre-composed glyphs. It is williamr@2: not guaranteed to cover the max descent of composite glyphs that have to be williamr@2: created by a layout engine. williamr@2: @return The positive distance from the font baseline to the bottom of the williamr@2: lowest pre-composed glyph (including accents) below the baseline williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontMaxDescent() const williamr@2: { williamr@2: return ExtendedFunction(KFontMaxDescent); williamr@2: } williamr@2: williamr@2: /** Gets the suggested line gap for the font. This is the recommended williamr@2: baseline to baseline distance between successive lines of text in the font. williamr@2: @return The positive recommended gap between successive lines williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontLineGap() const williamr@2: { williamr@2: return ExtendedFunction(KFontLineGap); williamr@2: } williamr@2: williamr@2: /** williamr@2: Gets the (positive) maximum height in pixels of the font. williamr@2: This may differ from the design height. williamr@2: williamr@2: @return The maximum height of the font. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: inline TInt CFont::FontMaxHeight() const williamr@2: { williamr@2: return FontMaxAscent() + FontMaxDescent(); williamr@2: } williamr@2: