screengrabber/inc/SGGifAnimator.h
branchRCL_3
changeset 20 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
19:b3cee849fa46 20:fad26422216a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __GIFANIMATOR_H__
       
    21 #define __GIFANIMATOR_H__
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include "SGModel.h"
       
    26 #include "SGStd.h"
       
    27 
       
    28 
       
    29 class CImageEncoder;
       
    30 class CSavingProgressDialog;
       
    31 class CAknGlobalProgressDialog;
       
    32 
       
    33 class MDialogCallback
       
    34     {
       
    35 public:
       
    36     virtual void DialogDismissedL( TInt aButtonId ) = 0;
       
    37     };
       
    38 
       
    39 
       
    40 class CGifAnimator : public CActive, public MDialogCallback
       
    41 	{
       
    42 public:
       
    43 	static int CreateGifAnimation(const TDesC& aFileName, TSize aDimensions, CVideoFrameArray* aVideoFrameArray);
       
    44 	~CGifAnimator();
       
    45 
       
    46 private:
       
    47     CGifAnimator();
       
    48     void StartL(const TDesC& aFileName, const TSize& aDimensions, CVideoFrameArray* aVideoFrameArray);
       
    49     void WriteHeaderL(const TSize& aDimensions);
       
    50     void WriteGraphicControlL(const TVideoFrame& aFrame);
       
    51     void WriteImageDescriptorL(const TVideoFrame& aFrame);
       
    52     CFbsBitmap* GetBitmapLC(TVideoFrame& aFrame, const TSize& aDimensions);
       
    53     void WriteRasterDataL(CFbsBitmap* aBitmap);
       
    54     void WriteFooterL();
       
    55     void FinishL();
       
    56     void WriteInt8L(TInt aValue);
       
    57     void WriteInt16L(TInt aValue);
       
    58     void RunL();
       
    59 	void DoCancel();
       
    60 	void DialogDismissedL(TInt aButtonId); // from MDialogCallback
       
    61     
       
    62 private:
       
    63     RFs                         iFs;
       
    64     RFile                       iOutFile;
       
    65 	CImageEncoder*              iImageEncoder;
       
    66 	HBufC8*                     iGIFImageData;
       
    67 	CActiveSchedulerWait        iWait;
       
    68     CSavingProgressDialog*      iSavingProgressDialog;
       
    69     };
       
    70 
       
    71 
       
    72 class CSavingProgressDialog : public CActive
       
    73     {
       
    74 public:
       
    75     static CSavingProgressDialog* NewL(MDialogCallback* aDialogCallback);
       
    76     ~CSavingProgressDialog();
       
    77     void StartDisplayingL(const TDesC &aText, TInt aFinalValue);
       
    78     void IncreaseProgressValueWithOne();
       
    79     void ProcessFinished();
       
    80 
       
    81 private:
       
    82     void DoCancel();
       
    83     void RunL();
       
    84 
       
    85 private: 
       
    86     CSavingProgressDialog();
       
    87     void ConstructL(MDialogCallback* aDialogCallback);
       
    88 
       
    89 private:
       
    90     MDialogCallback*            iDialogCallback;
       
    91     CAknGlobalProgressDialog*   iGlobalProgressDialog;
       
    92     TBool                       iVisible;
       
    93     TInt                        iCurrentValue;
       
    94     TInt                        iFinalValue;
       
    95     };
       
    96 		
       
    97 	
       
    98 #endif // __GIFANIMATOR_H__