lafagnosticuifoundation/animation/src/BitmapAnimator.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2004-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __BITMAPANIMATOR_H__
       
    17 #define __BITMAPANIMATOR_H__
       
    18 
       
    19 #include "Animator.h"
       
    20 #include "AnimationMixins.h"
       
    21 #include "AnimationFrame.h"
       
    22 
       
    23 class TAnimationConfig;
       
    24 
       
    25 /**
       
    26 CAnimator derived plugin for bitmap frames.
       
    27 
       
    28 This animator is loaded when the data provider is passing a fixed sequence
       
    29 of bitmap frames, and a type of "bitmap".  This is the type used by the
       
    30 CICLAnimationDataProvider.
       
    31 
       
    32 You do not need to instatiate animators in a client application.  This is
       
    33 handled by the animation classes.
       
    34 
       
    35 @see CICLAnimationDataProvider
       
    36 @internalAll
       
    37 */
       
    38 class CBitmapAnimator : public CAnimator, public MAnimationTickee
       
    39 	{
       
    40 protected:
       
    41 	enum TFlags
       
    42 		{
       
    43 		ECompleteData		= 0x0001,
       
    44 		EHeld				= 0x0002,
       
    45 		ECountFrames		= 0x0004,
       
    46 		EEndOnLastFrame		= 0x0008,
       
    47 		ERunning			= 0x0010,
       
    48 		EPaused				= 0x0020,
       
    49 		EPending			= 0x0040,
       
    50 		ERunMask			= 0x00F0,
       
    51 		};
       
    52 public:
       
    53     static CBitmapAnimator* NewL(TAny* aRenderer);
       
    54     ~CBitmapAnimator();
       
    55 public:
       
    56 	virtual void Start(const TAnimationConfig& aConfig);
       
    57 	virtual void Stop();
       
    58 	virtual void Pause();
       
    59 	virtual void Resume();
       
    60 	virtual void Hold();
       
    61 	virtual void Unhold();
       
    62 	virtual void DataEventL(TInt aEvent, TAny* aData, TInt aDataSize);	
       
    63 	virtual void Draw(CBitmapContext& aBitmapContext) const;
       
    64 	virtual void DrawMask(CBitmapContext& aBitmapContext) const;
       
    65 private:
       
    66 	CBitmapAnimator(MAnimationDrawer* aRenderer);
       
    67 	void ConstructL();
       
    68 	void InitialisedL();
       
    69 	void ResetL();
       
    70 	void AppendFrameL(CAnimationFrame::THandles& aAnimationFrame);
       
    71 	void DoUpdateFrame();
       
    72 	void Render(CBitmapContext& aBitmapContext, TInt aFrame) const;
       
    73 	void RenderMask(CBitmapContext& aBitmapContext, TInt aFrame) const;
       
    74 	void RestoreToPrevious(CBitmapContext& aBitmapContext, TBool aMask) const;
       
    75 	// From MAnimationTickee
       
    76 	virtual void Tick();
       
    77 private:
       
    78 	MAnimationDrawer* iRenderer;
       
    79 	TInt iFlags;
       
    80 	RPointerArray<CAnimationFrame> iFrameArray;
       
    81 	TSize iMaxSize;
       
    82 	TInt iCurrentFrame;
       
    83 	TInt iNextFrame;
       
    84 	TInt iTicksLeft;
       
    85 	};
       
    86 
       
    87 #endif //__BITMAPANIMATOR_H__