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 voidAddMemberL(CGulIcon *)
IMPORT_C CSpriteSet *NewL(RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool)
IMPORT_C CSpriteSet *NewLC(RWindowTreeNode &, RWsSession &, CWsScreenDevice &, CGulIcon *, TBool)
IMPORT_C voidPrepareSpriteForDisplayL(TInt, const TPoint &, const TSize &, TSpriteResizeMode)
IMPORT_C voidRemoveMember(TInt)
IMPORT_C voidSetClippingRect(const TRect &)
IMPORT_C CWindowGc *SpriteGc()
IMPORT_C voidStartDisplayingSpriteL()
IMPORT_C voidStopDisplayingSprite()
IMPORT_C voidTranslateSpritePosition(const TPoint &)
Private Member Functions
CSpriteSet(TBool)
voidAdjustSpriteSizeAccordingToResizeMode(TSize &, const TSize &, TSpriteResizeMode)
voidComputeInternalResizeMode(TInternalSpriteResizeMode &, TSpriteResizeMode, const TSize &, const TSize &)
voidConstructL(RWindowTreeNode &, RWsSession &, CWsScreenDevice &)
voidCreateSpriteMember()
voidRenderSprite(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
enumTSpriteResizeMode { ENoResizing, EResizeHorizToFit, EResizeVertToFit, EResizeHorizAndVertToFit }
Private Member Enumerations
enumTFlags { EMaskIsInverted = 0x01, ESpriteIsCurrentlyDisplayed = 0x02 }
enumTInternalSpriteResizeMode {
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(TBoolaInvertMask)[private]

Parameters

TBool aInvertMask

~CSpriteSet()

~CSpriteSet()

Member Functions Documentation

AddMemberL(CGulIcon *)

IMPORT_C voidAddMemberL(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)

voidAdjustSpriteSizeAccordingToResizeMode(TSize &aTargetSize,
const TSize &aSourceSize,
TSpriteResizeModeaSpriteResizeMode
)const [private]

Parameters

TSize & aTargetSize
const TSize & aSourceSize
TSpriteResizeMode aSpriteResizeMode

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

voidComputeInternalResizeMode(TInternalSpriteResizeMode &aInternalSpriteResizeMode,
TSpriteResizeModeaSpriteResizeMode,
const TSize &aSourceSize,
const TSize &aSpriteSize
)const [private]

Parameters

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

ConstructL(RWindowTreeNode &, RWsSession &, CWsScreenDevice &)

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

Parameters

RWindowTreeNode & aWindow
RWsSession & aWs
CWsScreenDevice & aDevice

CreateSpriteMember()

voidCreateSpriteMember()[private]

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

IMPORT_C CSpriteSet *NewL(RWindowTreeNode &aWindow,
RWsSession &aWs,
CWsScreenDevice &aDevice,
CGulIcon *aSpriteSetMember,
TBoolaInvertMask
)[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,
TBoolaInvertMask
)[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 voidPrepareSpriteForDisplayL(TIntaSpriteType,
const TPoint &aSpritePos,
const TSize &aSpriteSize,
TSpriteResizeModeaSpriteResizeMode
)

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 voidRemoveMember(TIntaSpriteSetMemberIndex)

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 &)

voidRenderSprite(TIntaSpriteType,
TInternalSpriteResizeModeaInternalSpriteResizeMode,
const TSize &aSourceSize,
const TSize &aSpriteSize
)[private]

Parameters

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

SetClippingRect(const TRect &)

IMPORT_C voidSetClippingRect(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 voidStartDisplayingSpriteL()

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 voidStopDisplayingSprite()

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

TranslateSpritePosition(const TPoint &)

IMPORT_C voidTranslateSpritePosition(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]