1 // Copyright (c) 1997-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.
17 #if !defined(__BMPANCLI_H__)
18 #define __BMPANCLI_H__
30 Encapsulates the information required for one frame of an animation.
32 Each animation frame includes a bitmap that is displayed in a specified position
33 for a specified length of time. You can optionally include a mask that either
34 hides part of the bitmap, or makes part of the bitmap transparent so that the
35 background can be seen.
37 You will probably need to define several frames for a complete animation.
38 When you have defined the frames you require, use CBitmapAnimClientData to
39 construct the animation itself.
44 class CBitmapFrameData : public CBase
47 IMPORT_C ~CBitmapFrameData();
48 IMPORT_C static CBitmapFrameData* NewL();
49 IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL);
50 IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIntervalInMilliSeconds, TPoint aPosition);
52 IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
53 IMPORT_C void SetMask(CFbsBitmap* aMask);
54 IMPORT_C void SetPosition(TPoint aPosition);
55 IMPORT_C void SetInterval(TInt aIntervalInMilliSeconds);
56 IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
58 IMPORT_C CFbsBitmap* Bitmap() const;
59 IMPORT_C CFbsBitmap* Mask() const;
60 IMPORT_C TInt IntervalInMilliSeconds() const;
61 IMPORT_C TPoint Position() const;
62 IMPORT_C TBool BitmapsOwnedExternally() const;
67 CFbsBitmap* iMaskBitmap;
68 TBool iBitmapsOwnedExternally;
69 TInt iIntervalInMilliSeconds;
75 // CBitmapAnimClientData
80 Encapsulates one or more animation frames into an entire animation.
82 In addition to specifying the frames you wish to include in your animation,
85 - whether the animation will flash
87 - whether the animation is played once, or continuously
89 - the background frame that is drawn to clear each frame in the animation
91 You can also specify a default frame interval that is used for all frames
92 in an animation. If the interval is already set for any of the individual
93 frames, that takes precedence.
95 When you have defined your animation, use RBitmapAnim to play the animation.
100 class CBitmapAnimClientData : public CBase
103 /** Animation play mode flags.
105 The animation can be played in any of the ways described below. */
108 /** Plays the animation once, from the first frame to the last one. */
110 /** Plays the animation from the first frame to the last one continuously. */
112 /** Plays the animation from the first frame to the last one then from the last
113 frame to the first continuously. */
117 IMPORT_C static CBitmapAnimClientData* NewL();
118 IMPORT_C ~CBitmapAnimClientData();
120 IMPORT_C void AppendFrameL(CBitmapFrameData* aFrame);
121 IMPORT_C void ResetFrameArray();
122 IMPORT_C void SetBackgroundFrame(CBitmapFrameData* aBackgroundFrame);
123 IMPORT_C void SetFlash(TBool aFlash);
124 IMPORT_C void SetFrameInterval(TInt aFrameIntervalInMilliSeconds);
125 IMPORT_C void SetPlayMode(TPlayMode aPlayMode);
127 IMPORT_C CBitmapFrameData* BackgroundFrame() const;
128 IMPORT_C TBool Flash() const;
129 IMPORT_C const CArrayPtrFlat<CBitmapFrameData>& FrameArray() const;
130 IMPORT_C TInt FrameIntervalInMilliSeconds() const;
131 IMPORT_C TPlayMode PlayMode() const;
133 IMPORT_C TInt DurationInMilliSeconds() const;
134 IMPORT_C TSize Size() const;
136 CBitmapAnimClientData();
140 TInt iFrameIntervalInMilliSeconds;
141 CArrayPtrFlat<CBitmapFrameData> iFrameArray;
142 CBitmapFrameData* iBackgroundFrame;
148 Enables a client to package animation data, and send it to the window server
151 Before using RBitmapAnim, a client must instantiate an RAnimDll. This provides
152 a reference to the window server DLL that runs the animation specified through
153 the RBitmapAnim() object. To complete construction, call ConstructL().
158 class RBitmapAnim : public RAnim
161 IMPORT_C RBitmapAnim(RAnimDll& aAnimDll);
162 IMPORT_C void ConstructL(const RWindowBase& aWindow);
163 IMPORT_C void DisplayFrameL(TInt aIndex);
164 IMPORT_C void SetBitmapAnimDataL(const CBitmapAnimClientData& aBitmapAnimData);
165 IMPORT_C void SetFlashL(TBool aFlash);
166 IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
167 IMPORT_C void SetPlayModeL(CBitmapAnimClientData::TPlayMode aPlayMode);
168 IMPORT_C void StartL();
169 IMPORT_C void StopL();
170 IMPORT_C void SetNumberOfCyclesL(TInt aNumberOfCycles);
171 IMPORT_C void SetPositionL(TPoint aPosition);
173 void SetAttributesL(const CBitmapAnimClientData& aBitmapAnimData);
174 void SetBackgroundFrameL(const CBitmapFrameData& aFrame);
175 void SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray);
176 void SetFrameL(const CBitmapFrameData& aFrame, TInt aOpCode);