CSpriteSet Class Reference

class CSpriteSet : public CBase

The CSpriteSet class allows a window server sprite to be drawn to a window. The class supports storage of any number of bitmap/mask pairs, though allowing only one of these bitmap/mask members to be displayed at any one time. The client of this class should provide the source bitmap/mask pairs which can be resized to fit a specified rectangle. Also provided for at runtime is the ability to draw onto the sprite as though it were a regular CWindowGc and using the same coordinate offsets as the window it exists in.

Inherits from

Public Member Functions
~CSpriteSet ()
IMPORT_C void AddMemberL ( CGulIcon *)
IMPORT_C CSpriteSet * NewL ( RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool )
IMPORT_C CSpriteSet * NewLC ( RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool )
IMPORT_C void PrepareSpriteForDisplayL ( TInt , const TPoint &, const TSize &, TSpriteResizeMode )
IMPORT_C void RemoveMember ( TInt )
IMPORT_C void SetClippingRect (const TRect &)
IMPORT_C CWindowGc * SpriteGc ()
IMPORT_C void StartDisplayingSpriteL ()
IMPORT_C void StopDisplayingSprite ()
IMPORT_C void TranslateSpritePosition (const TPoint &)
Private Member Functions
CSpriteSet ( TBool )
void AdjustSpriteSizeAccordingToResizeMode ( TSize &, const TSize &, TSpriteResizeMode )
void ComputeInternalResizeMode ( TInternalSpriteResizeMode &, TSpriteResizeMode , const TSize &, const TSize &)
void ConstructL ( RWindowTreeNode &, RWsSession &, CWsScreenDevice &)
void CreateSpriteMember ()
void RenderSprite ( TInt , TInternalSpriteResizeMode , const TSize &, const TSize &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TSpriteResizeMode { ENoResizing , EResizeHorizToFit , EResizeVertToFit , EResizeHorizAndVertToFit }
Private Member Enumerations
enum TFlags { EMaskIsInverted  = 0x01, ESpriteIsCurrentlyDisplayed  = 0x02 }
enum TInternalSpriteResizeMode {
EHSameVSame , EHSameVShrink , EHSameVStretch , EHShrinkVSame , EHShrinkVShrink , EHShrinkVStretch , EHStretchVSame , EHStretchVShrink , EHStretchVStretch
}
Private Attributes
TRect iClippingRect
TInt iFlags
CFbsBitmapDevice * iMainBmpDevice
CFbsBitGc * iMainFbsBitGc
CFbsBitmapDevice * iMaskBmpDevice
CFbsBitGc * iMaskFbsBitGc
RPointerArray < CGulIcon > iSourceMembers
RWsSprite iSprite
TSpriteMember iSpriteMember
TPoint iSpritePosition
CWsBitmap * iTargetBitmap
CWsBitmap * iTargetMaskBitmap
CWindowToBitmapMappingGc * iWindowToBitmapMappingGc

Constructor & Destructor Documentation

CSpriteSet(TBool)

CSpriteSet ( TBool aInvertMask ) [private]

Parameters

TBool aInvertMask

~CSpriteSet()

~CSpriteSet ( )

Member Functions Documentation

AddMemberL(CGulIcon *)

IMPORT_C void AddMemberL ( CGulIcon * aSpriteSetMember )

Adds aSpriteSetMember to the sprite set. Panics if a null member is passed in, or if the argument does not include a bitmap and mask.

Parameters

CGulIcon * aSpriteSetMember

AdjustSpriteSizeAccordingToResizeMode(TSize &, const TSize &, TSpriteResizeMode)

void AdjustSpriteSizeAccordingToResizeMode ( TSize & aTargetSize,
const TSize & aSourceSize,
TSpriteResizeMode aSpriteResizeMode
) const [private]

Parameters

TSize & aTargetSize
const TSize & aSourceSize
TSpriteResizeMode aSpriteResizeMode

ComputeInternalResizeMode(TInternalSpriteResizeMode &, TSpriteResizeMode, const TSize &, const TSize &)

void ComputeInternalResizeMode ( TInternalSpriteResizeMode & aInternalSpriteResizeMode,
TSpriteResizeMode aSpriteResizeMode,
const TSize & aSourceSize,
const TSize & aSpriteSize
) const [private]

Parameters

TInternalSpriteResizeMode & aInternalSpriteResizeMode
TSpriteResizeMode aSpriteResizeMode
const TSize & aSourceSize
const TSize & aSpriteSize

ConstructL(RWindowTreeNode &, RWsSession &, CWsScreenDevice &)

void ConstructL ( RWindowTreeNode & aWindow,
RWsSession & aWs,
CWsScreenDevice & aDevice
) [private]

Parameters

RWindowTreeNode & aWindow
RWsSession & aWs
CWsScreenDevice & aDevice

CreateSpriteMember()

void CreateSpriteMember ( ) [private]

NewL(RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool)

IMPORT_C CSpriteSet * NewL ( RWindowTreeNode & aWindow,
RWsSession & aWs,
CWsScreenDevice & aDevice,
CGulIcon * aSpriteSetMember,
TBool aInvertMask
) [static]

Creates and returns a pointer to a CSpriteSet object clipped to the parent aWindow. The sprite set is initialized with aSpriteSetMember and the sprite set takes ownership of this parameter. aWs is the window session used. aInvertMask specifies whether the bitmap/mask pairs which will be added will use an inverted mask.

Parameters

RWindowTreeNode & aWindow
RWsSession & aWs
CWsScreenDevice & aDevice
CGulIcon * aSpriteSetMember
TBool aInvertMask

NewLC(RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool)

IMPORT_C CSpriteSet * NewLC ( RWindowTreeNode & aWindow,
RWsSession & aWs,
CWsScreenDevice & aDevice,
CGulIcon * aSpriteSetMember,
TBool aInvertMask
) [static]

Creates and returns a pointer to a CSpriteSet object clipped to the parent aWindow. The sprite set is initialized with aSpriteSetMember and the sprite set takes ownership of this parameter. aWs is the window session used. aInvertMask specifies whether the bitmap/mask pairs which will be added will use an inverted mask. Leaves the returned pointer on the cleanup stack.

Parameters

RWindowTreeNode & aWindow
RWsSession & aWs
CWsScreenDevice & aDevice
CGulIcon * aSpriteSetMember
TBool aInvertMask

PrepareSpriteForDisplayL(TInt, const TPoint &, const TSize &, TSpriteResizeMode)

IMPORT_C void PrepareSpriteForDisplayL ( TInt aSpriteType,
const TPoint & aSpritePos,
const TSize & aSpriteSize,
TSpriteResizeMode aSpriteResizeMode
)

Prepares the sprite in the set of type aSpriteType to be displayed at aSpritePos with size aSpriteSize. The sprite will be resized as necessary under the restriction of aSpriteResizeMode.

Parameters

TInt aSpriteType
const TPoint & aSpritePos
const TSize & aSpriteSize
TSpriteResizeMode aSpriteResizeMode

RemoveMember(TInt)

IMPORT_C void RemoveMember ( TInt aSpriteSetMemberIndex )

Removes a member (indexed by aSpriteSetMemberIndex) from the array. Panics if the member index is not within the existing array's range.

Parameters

TInt aSpriteSetMemberIndex

RenderSprite(TInt, TInternalSpriteResizeMode, const TSize &, const TSize &)

void RenderSprite ( TInt aSpriteType,
TInternalSpriteResizeMode aInternalSpriteResizeMode,
const TSize & aSourceSize,
const TSize & aSpriteSize
) [private]

Parameters

TInt aSpriteType
TInternalSpriteResizeMode aInternalSpriteResizeMode
const TSize & aSourceSize
const TSize & aSpriteSize

SetClippingRect(const TRect &)

IMPORT_C void SetClippingRect ( const TRect & aRect )

Bounds the drawing of the sprite within aRect, stopping it drawing over surrounding components.

Parameters

const TRect & aRect

SpriteGc()

IMPORT_C CWindowGc * SpriteGc ( ) const

Allows use of the Gc which the sprite uses for it's drawing. This enables the client to effectively draw onto the sprite.

StartDisplayingSpriteL()

IMPORT_C void StartDisplayingSpriteL ( )

Brings the sprite onto the visible area of the screen. Must also call this if the sprite set member which is being used has changed.

StopDisplayingSprite()

IMPORT_C void StopDisplayingSprite ( )

Stops the display of the sprite on the visible area of the screen.

TranslateSpritePosition(const TPoint &)

IMPORT_C void TranslateSpritePosition ( const TPoint & aSpritePos )

Method for moving the postion of the sprite by aSpritePos from the current position.

Parameters

const TPoint & aSpritePos

Member Enumerations Documentation

Enum TFlags

Enumerators

EMaskIsInverted = 0x01
ESpriteIsCurrentlyDisplayed = 0x02

Enum TInternalSpriteResizeMode

Enumerators

EHSameVSame
EHSameVShrink
EHSameVStretch
EHShrinkVSame
EHShrinkVShrink
EHShrinkVStretch
EHStretchVSame
EHStretchVShrink
EHStretchVStretch

Enum TSpriteResizeMode

Enumerators

ENoResizing
EResizeHorizToFit
EResizeVertToFit
EResizeHorizAndVertToFit

Member Data Documentation

TRect iClippingRect

TRect iClippingRect [private]

TInt iFlags

TInt iFlags [private]

CFbsBitmapDevice * iMainBmpDevice

CFbsBitmapDevice * iMainBmpDevice [private]

CFbsBitGc * iMainFbsBitGc

CFbsBitGc * iMainFbsBitGc [private]

CFbsBitmapDevice * iMaskBmpDevice

CFbsBitmapDevice * iMaskBmpDevice [private]

CFbsBitGc * iMaskFbsBitGc

CFbsBitGc * iMaskFbsBitGc [private]

RPointerArray< CGulIcon > iSourceMembers

RPointerArray < CGulIcon > iSourceMembers [private]

RWsSprite iSprite

RWsSprite iSprite [private]

TSpriteMember iSpriteMember

TSpriteMember iSpriteMember [private]

TPoint iSpritePosition

TPoint iSpritePosition [private]

CWsBitmap * iTargetBitmap

CWsBitmap * iTargetBitmap [private]

CWsBitmap * iTargetMaskBitmap

CWsBitmap * iTargetMaskBitmap [private]

CWindowToBitmapMappingGc * iWindowToBitmapMappingGc

CWindowToBitmapMappingGc * iWindowToBitmapMappingGc [private]