williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
#if !defined(__BMPANCLI_H__)
|
williamr@2
|
18 |
#define __BMPANCLI_H__
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#include <w32std.h>
|
williamr@2
|
22 |
#include <fbs.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
//
|
williamr@2
|
25 |
// CFrameData
|
williamr@2
|
26 |
//
|
williamr@2
|
27 |
|
williamr@2
|
28 |
|
williamr@2
|
29 |
/**
|
williamr@2
|
30 |
Encapsulates the information required for one frame of an animation.
|
williamr@2
|
31 |
|
williamr@2
|
32 |
Each animation frame includes a bitmap that is displayed in a specified position
|
williamr@2
|
33 |
for a specified length of time. You can optionally include a mask that either
|
williamr@2
|
34 |
hides part of the bitmap, or makes part of the bitmap transparent so that the
|
williamr@2
|
35 |
background can be seen.
|
williamr@2
|
36 |
|
williamr@2
|
37 |
You will probably need to define several frames for a complete animation.
|
williamr@2
|
38 |
When you have defined the frames you require, use CBitmapAnimClientData to
|
williamr@2
|
39 |
construct the animation itself.
|
williamr@2
|
40 |
|
williamr@2
|
41 |
@publishedAll
|
williamr@2
|
42 |
@released
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
class CBitmapFrameData : public CBase
|
williamr@2
|
45 |
{
|
williamr@2
|
46 |
public:
|
williamr@2
|
47 |
IMPORT_C ~CBitmapFrameData();
|
williamr@2
|
48 |
IMPORT_C static CBitmapFrameData* NewL();
|
williamr@2
|
49 |
IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL);
|
williamr@2
|
50 |
IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIntervalInMilliSeconds, TPoint aPosition);
|
williamr@2
|
51 |
//
|
williamr@2
|
52 |
IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
|
williamr@2
|
53 |
IMPORT_C void SetMask(CFbsBitmap* aMask);
|
williamr@2
|
54 |
IMPORT_C void SetPosition(TPoint aPosition);
|
williamr@2
|
55 |
IMPORT_C void SetInterval(TInt aIntervalInMilliSeconds);
|
williamr@2
|
56 |
IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
|
williamr@2
|
57 |
//
|
williamr@2
|
58 |
IMPORT_C CFbsBitmap* Bitmap() const;
|
williamr@2
|
59 |
IMPORT_C CFbsBitmap* Mask() const;
|
williamr@2
|
60 |
IMPORT_C TInt IntervalInMilliSeconds() const;
|
williamr@2
|
61 |
IMPORT_C TPoint Position() const;
|
williamr@2
|
62 |
IMPORT_C TBool BitmapsOwnedExternally() const;
|
williamr@2
|
63 |
private:
|
williamr@2
|
64 |
CBitmapFrameData();
|
williamr@2
|
65 |
private:
|
williamr@2
|
66 |
CFbsBitmap* iBitmap;
|
williamr@2
|
67 |
CFbsBitmap* iMaskBitmap;
|
williamr@2
|
68 |
TBool iBitmapsOwnedExternally;
|
williamr@2
|
69 |
TInt iIntervalInMilliSeconds;
|
williamr@2
|
70 |
TPoint iPosition;
|
williamr@2
|
71 |
};
|
williamr@2
|
72 |
|
williamr@2
|
73 |
|
williamr@2
|
74 |
//
|
williamr@2
|
75 |
// CBitmapAnimClientData
|
williamr@2
|
76 |
//
|
williamr@2
|
77 |
|
williamr@2
|
78 |
|
williamr@2
|
79 |
/**
|
williamr@2
|
80 |
Encapsulates one or more animation frames into an entire animation.
|
williamr@2
|
81 |
|
williamr@2
|
82 |
In addition to specifying the frames you wish to include in your animation,
|
williamr@2
|
83 |
you can also specify:
|
williamr@2
|
84 |
|
williamr@2
|
85 |
- whether the animation will flash
|
williamr@2
|
86 |
|
williamr@2
|
87 |
- whether the animation is played once, or continuously
|
williamr@2
|
88 |
|
williamr@2
|
89 |
- the background frame that is drawn to clear each frame in the animation
|
williamr@2
|
90 |
|
williamr@2
|
91 |
You can also specify a default frame interval that is used for all frames
|
williamr@2
|
92 |
in an animation. If the interval is already set for any of the individual
|
williamr@2
|
93 |
frames, that takes precedence.
|
williamr@2
|
94 |
|
williamr@2
|
95 |
When you have defined your animation, use RBitmapAnim to play the animation.
|
williamr@2
|
96 |
|
williamr@2
|
97 |
@publishedAll
|
williamr@2
|
98 |
@released
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
class CBitmapAnimClientData : public CBase
|
williamr@2
|
101 |
{
|
williamr@2
|
102 |
public:
|
williamr@2
|
103 |
/** Animation play mode flags.
|
williamr@2
|
104 |
|
williamr@2
|
105 |
The animation can be played in any of the ways described below. */
|
williamr@2
|
106 |
enum TPlayMode
|
williamr@2
|
107 |
{
|
williamr@2
|
108 |
/** Plays the animation once, from the first frame to the last one. */
|
williamr@2
|
109 |
EPlay = 0x00,
|
williamr@2
|
110 |
/** Plays the animation from the first frame to the last one continuously. */
|
williamr@2
|
111 |
ECycle = 0x01,
|
williamr@2
|
112 |
/** Plays the animation from the first frame to the last one then from the last
|
williamr@2
|
113 |
frame to the first continuously. */
|
williamr@2
|
114 |
EBounce = 0x02
|
williamr@2
|
115 |
};
|
williamr@2
|
116 |
public:
|
williamr@2
|
117 |
IMPORT_C static CBitmapAnimClientData* NewL();
|
williamr@2
|
118 |
IMPORT_C ~CBitmapAnimClientData();
|
williamr@2
|
119 |
//
|
williamr@2
|
120 |
IMPORT_C void AppendFrameL(CBitmapFrameData* aFrame);
|
williamr@2
|
121 |
IMPORT_C void ResetFrameArray();
|
williamr@2
|
122 |
IMPORT_C void SetBackgroundFrame(CBitmapFrameData* aBackgroundFrame);
|
williamr@2
|
123 |
IMPORT_C void SetFlash(TBool aFlash);
|
williamr@2
|
124 |
IMPORT_C void SetFrameInterval(TInt aFrameIntervalInMilliSeconds);
|
williamr@2
|
125 |
IMPORT_C void SetPlayMode(TPlayMode aPlayMode);
|
williamr@2
|
126 |
//
|
williamr@2
|
127 |
IMPORT_C CBitmapFrameData* BackgroundFrame() const;
|
williamr@2
|
128 |
IMPORT_C TBool Flash() const;
|
williamr@2
|
129 |
IMPORT_C const CArrayPtrFlat<CBitmapFrameData>& FrameArray() const;
|
williamr@2
|
130 |
IMPORT_C TInt FrameIntervalInMilliSeconds() const;
|
williamr@2
|
131 |
IMPORT_C TPlayMode PlayMode() const;
|
williamr@2
|
132 |
//
|
williamr@2
|
133 |
IMPORT_C TInt DurationInMilliSeconds() const;
|
williamr@2
|
134 |
IMPORT_C TSize Size() const;
|
williamr@2
|
135 |
private:
|
williamr@2
|
136 |
CBitmapAnimClientData();
|
williamr@2
|
137 |
private:
|
williamr@2
|
138 |
TBool iFlash;
|
williamr@2
|
139 |
TPlayMode iPlayMode;
|
williamr@2
|
140 |
TInt iFrameIntervalInMilliSeconds;
|
williamr@2
|
141 |
CArrayPtrFlat<CBitmapFrameData> iFrameArray;
|
williamr@2
|
142 |
CBitmapFrameData* iBackgroundFrame;
|
williamr@2
|
143 |
};
|
williamr@2
|
144 |
|
williamr@2
|
145 |
|
williamr@2
|
146 |
|
williamr@2
|
147 |
/**
|
williamr@2
|
148 |
Enables a client to package animation data, and send it to the window server
|
williamr@2
|
149 |
for display.
|
williamr@2
|
150 |
|
williamr@2
|
151 |
Before using RBitmapAnim, a client must instantiate an RAnimDll. This provides
|
williamr@2
|
152 |
a reference to the window server DLL that runs the animation specified through
|
williamr@2
|
153 |
the RBitmapAnim() object. To complete construction, call ConstructL().
|
williamr@2
|
154 |
|
williamr@2
|
155 |
@publishedAll
|
williamr@2
|
156 |
@released
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
class RBitmapAnim : public RAnim
|
williamr@2
|
159 |
{
|
williamr@2
|
160 |
public:
|
williamr@2
|
161 |
IMPORT_C RBitmapAnim(RAnimDll& aAnimDll);
|
williamr@2
|
162 |
IMPORT_C void ConstructL(const RWindowBase& aWindow);
|
williamr@2
|
163 |
IMPORT_C void DisplayFrameL(TInt aIndex);
|
williamr@2
|
164 |
IMPORT_C void SetBitmapAnimDataL(const CBitmapAnimClientData& aBitmapAnimData);
|
williamr@2
|
165 |
IMPORT_C void SetFlashL(TBool aFlash);
|
williamr@2
|
166 |
IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
|
williamr@2
|
167 |
IMPORT_C void SetPlayModeL(CBitmapAnimClientData::TPlayMode aPlayMode);
|
williamr@2
|
168 |
IMPORT_C void StartL();
|
williamr@2
|
169 |
IMPORT_C void StopL();
|
williamr@2
|
170 |
IMPORT_C void SetNumberOfCyclesL(TInt aNumberOfCycles);
|
williamr@2
|
171 |
IMPORT_C void SetPositionL(TPoint aPosition);
|
williamr@2
|
172 |
private:
|
williamr@2
|
173 |
void SetAttributesL(const CBitmapAnimClientData& aBitmapAnimData);
|
williamr@2
|
174 |
void SetBackgroundFrameL(const CBitmapFrameData& aFrame);
|
williamr@2
|
175 |
void SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray);
|
williamr@2
|
176 |
void SetFrameL(const CBitmapFrameData& aFrame, TInt aOpCode);
|
williamr@2
|
177 |
};
|
williamr@2
|
178 |
|
williamr@2
|
179 |
#endif
|