1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
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 |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 |
|
17 |
|
18 /** |
16 /** |
19 @file |
17 @file |
20 @internalComponent |
18 @internalComponent |
21 */ |
19 */ |
22 |
20 |
23 #if !defined(__BMPANSRV_H__) |
21 #if !defined(__BMPANSRV_H__) |
24 #define __BMPANSRV_H__ |
22 #define __BMPANSRV_H__ |
25 |
23 |
26 #include <e32std.h> |
24 #include <e32std.h> |
27 #include <w32adll.h> |
25 #include <w32adll.h> |
28 #include <bmpanconsts.h> |
26 #include "bmpanconsts.h" |
29 #include "bmpancli.h" |
27 #include "bmpancli.h" |
30 #include <e32math.h> |
28 #include <e32math.h> |
31 |
29 |
32 |
30 |
33 |
31 |
206 EPlayModeBounce = 0x0020, |
204 EPlayModeBounce = 0x0020, |
207 EPlayForwards = 0x0040, |
205 EPlayForwards = 0x0040, |
208 EPlayBackwards = 0x0080, |
206 EPlayBackwards = 0x0080, |
209 // General |
207 // General |
210 EFlash = 0x0100, |
208 EFlash = 0x0100, |
211 EBackgroundBitmapProvided = 0x0200, |
|
212 EWindowContentsInitialized = 0x0400, |
|
213 ENoBitmapWindowRestoring = 0x0800, |
209 ENoBitmapWindowRestoring = 0x0800, |
214 EChangedBackgroundFramePending = 0x1000, |
|
215 EBackgroundShouldIncludeWindowContents = 0x2000, |
|
216 EDisplayLastFrameWhenFinished = 0x4000, |
210 EDisplayLastFrameWhenFinished = 0x4000, |
217 EBackgroundMaskProvided = 0x8000 |
|
218 }; |
211 }; |
219 |
212 |
220 private: //Pure Virtual function from CAnim |
213 private: //Pure Virtual function from CAnim |
221 virtual void ConstructL(TAny *aArgs, TBool aHasFocus); |
214 virtual void ConstructL(TAny *aArgs, TBool aHasFocus); |
222 virtual void Command(TInt aOpcode, TAny* aArgs); |
215 virtual void Command(TInt aOpcode, TAny* aArgs); |
237 void DrawBitmap(TInt aPreviousIndex=-1, TBool aRedraw=EFalse); |
230 void DrawBitmap(TInt aPreviousIndex=-1, TBool aRedraw=EFalse); |
238 inline TBool IsFrameDisplayable() const; |
231 inline TBool IsFrameDisplayable() const; |
239 inline TBool IsRunning() const; |
232 inline TBool IsRunning() const; |
240 inline TBool IsFrozen() const; |
233 inline TBool IsFrozen() const; |
241 void ResetAnimation(); |
234 void ResetAnimation(); |
242 void ClearFrame(TInt aIndex); |
|
243 void ClearFrameNow(TInt aIndex); |
235 void ClearFrameNow(TInt aIndex); |
244 void RenderFrameBackground(TInt aIndex); |
236 void RenderFrameBackground(TInt aIndex); |
245 TRect CalcFrameRect(TInt aIndex); |
237 TRect CalcFrameRect(TInt aIndex); |
246 void SetBackgroundFrameL(TFrameData aFrameDataArg); |
238 void SetBackgroundFrameL(TFrameData aFrameDataArg); |
247 void SetFlash(TBmpAnimAttributes aFlash); |
239 void SetFlash(TBmpAnimAttributes aFlash); |
250 void SetNumberOfCycles(SBitmapAnimNumberOfCycles aNumberOfCycles); |
242 void SetNumberOfCycles(SBitmapAnimNumberOfCycles aNumberOfCycles); |
251 void SetPlayMode(TBmpAnimAttributes aPlayMode); |
243 void SetPlayMode(TBmpAnimAttributes aPlayMode); |
252 void SetPosition(SBitmapAnimNewPosition aNewPosition); |
244 void SetPosition(SBitmapAnimNewPosition aNewPosition); |
253 void StartAnimationL(); |
245 void StartAnimationL(); |
254 void StopAnimation(); |
246 void StopAnimation(); |
255 void StoreWindowContentsToBackgroundBitmapL(const TRegion* aRegion); |
|
256 void UpdateCurrentIndex(); |
247 void UpdateCurrentIndex(); |
257 inline TRect WindowRect() const; |
248 inline TRect WindowRect() const; |
258 CFbsBitmap* CreateRestoringBitmapL(TPoint& aPosition, TInt aPreviousIndex); |
|
259 void UpdateBackgroundBitmapIfNeeded(const TRegion* aRegion, TRect aBackgroundBitmapScreenRect); |
|
260 static TBool FrameNeedsRedrawing(const TRegion* aRedrawRegion, TRect aFrameScreenRect); |
249 static TBool FrameNeedsRedrawing(const TRegion* aRedrawRegion, TRect aFrameScreenRect); |
261 void ResetFrameArray(); |
250 void ResetFrameArray(); |
262 void ClearFrameData(); |
251 void ClearFrameData(); |
263 TBool CanDrawNextFrameWithoutErasingPreviousFrameL(TInt aPreviousIndex); |
|
264 TBool CompareBitmapsL(CFbsBitmap* aBmp1, CFbsBitmap* aBmp2); |
|
265 |
252 |
266 private: |
253 private: |
267 RPointerArray<CBitmapAnimFrameData> iBitmapAnimFrameDataArray; |
254 RPointerArray<CBitmapAnimFrameData> iBitmapAnimFrameDataArray; |
268 CBitmapAnimTimer* iAnimTimer; |
255 CBitmapAnimTimer* iAnimTimer; |
269 CBitmapAnimFlashTimer* iFlashTimer; |
256 CBitmapAnimFlashTimer* iFlashTimer; |
270 CBitmapAnimFrameData* iBackgroundFrame; |
257 CBitmapAnimFrameData* iBackgroundFrame; |
271 CFbsBitmap* iBackgroundBitmap; |
|
272 CFbsBitmapDevice* iBackgroundbitmapDevice; |
|
273 CFbsBitGc* iBackgroundbitmapGc; |
|
274 |
258 |
275 // |
259 // |
276 TInt iDummy; |
260 TInt iDummy; |
277 TInt iFlags; |
261 TInt iFlags; |
278 TInt iIndex; |
262 TInt iIndex; |
279 TInt iNumberOfCycles; |
263 TInt iNumberOfCycles; |
280 TPoint iPosition; |
264 TPoint iPosition; |
281 TInt iWindowConfig; |
265 TInt iWindowConfig; |
282 TTimeIntervalMicroSeconds32 iFrameInterval; |
266 TTimeIntervalMicroSeconds32 iFrameInterval; |
283 // |
|
284 CFbsBitGc* iRestoringGc; |
|
285 }; |
267 }; |
286 |
268 |
287 // Returns the number of frames store in the frame array. |
269 // Returns the number of frames store in the frame array. |
288 inline TInt CBitmapAnim::Count() const |
270 inline TInt CBitmapAnim::Count() const |
289 { return iBitmapAnimFrameDataArray.Count(); } |
271 { return iBitmapAnimFrameDataArray.Count(); } |