1 // Copyright (c) 2001-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__GULSPRITE_H__)
17 #define __GULSPRITE_H__
22 class CWindowToBitmapMappingGc;
24 class CSpriteSet : public CBase
26 The CSpriteSet class allows a window server sprite to be drawn to a window. The class
27 supports storage of any number of bitmap/mask pairs, though allowing only one of these
28 bitmap/mask members to be displayed at any one time. The client of this class should
29 provide the source bitmap/mask pairs which can be resized to fit a specified rectangle.
30 Also provided for at runtime is the ability to draw onto the sprite as though it were a
31 regular CWindowGc and using the same coordinate offsets as the window it exists in.
38 enum TSpriteResizeMode
43 EResizeHorizAndVertToFit
46 // methods for creation of the sprite set
47 IMPORT_C static CSpriteSet* NewL(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice, CGulIcon* aSpriteSetMember, TBool aInvertMask);
48 IMPORT_C static CSpriteSet* NewLC(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice, CGulIcon* aSpriteSetMember, TBool aInvertMask);
49 IMPORT_C void AddMemberL(CGulIcon* aSpriteSetMember);
50 IMPORT_C void RemoveMember(TInt aSpriteSetMemberIndex);
51 // methods for preparing and using a sprite in the set
52 IMPORT_C void PrepareSpriteForDisplayL(TInt aSpriteType, const TPoint& aSpritePos, const TSize& aSpriteSize, TSpriteResizeMode aSpriteResizeMode);
53 IMPORT_C void StartDisplayingSpriteL();
54 IMPORT_C void StopDisplayingSprite();
55 IMPORT_C CWindowGc* SpriteGc() const;
56 IMPORT_C void TranslateSpritePosition(const TPoint& aSpritePos);
57 IMPORT_C void SetClippingRect(const TRect& aRect);
61 enum TInternalSpriteResizeMode
74 CSpriteSet(TBool aInvertMask);
75 void ConstructL(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice);
76 void CreateSpriteMember();
77 void AdjustSpriteSizeAccordingToResizeMode(TSize& aTargetSize, const TSize& aSourceSize, TSpriteResizeMode aSpriteResizeMode) const;
78 void ComputeInternalResizeMode(TInternalSpriteResizeMode& aInternalSpriteResizeMode, TSpriteResizeMode aSpriteResizeMode, const TSize& aSourceSize, const TSize& aSpriteSize) const;
79 void RenderSprite(TInt aSpriteType, TInternalSpriteResizeMode aInternalSpriteResizeMode, const TSize& aSourceSize, const TSize& aSpriteSize);
83 EMaskIsInverted =0x01,
84 ESpriteIsCurrentlyDisplayed =0x02
87 RPointerArray<CGulIcon> iSourceMembers;
88 CWsBitmap* iTargetBitmap;
89 CWsBitmap* iTargetMaskBitmap;
91 TSpriteMember iSpriteMember;
92 CWindowToBitmapMappingGc* iWindowToBitmapMappingGc;
93 CFbsBitGc* iMainFbsBitGc;
94 CFbsBitGc* iMaskFbsBitGc;
95 CFbsBitmapDevice* iMainBmpDevice;
96 CFbsBitmapDevice* iMaskBmpDevice;
97 TPoint iSpritePosition;