uiservicetab/vimpstdetailsviewplugin/inc/cvimpstdetailsimagedecoder.h
branchRCL_3
changeset 23 9a48e301e94b
equal deleted inserted replaced
22:3104fc151679 23:9a48e301e94b
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Utility class for asynchronously decoding the header thumbnail image
       
    15  *
       
    16 */
       
    17 
       
    18  
       
    19 #ifndef CVIMPSTDETAILSIMAGEDECODER_H_
       
    20 #define CVIMPSTDETAILSIMAGEDECODER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 class CVIMPSTDetailsHeaderControl;
       
    26 class CImageDecoder;
       
    27 class CFbsBitmap;
       
    28 class CBitmapScaler;
       
    29 
       
    30 /**
       
    31  * Utility class for asynchronously decoding the header thumbnail image
       
    32  *
       
    33  *  @lib vimpstdetailsviewplugin.dll
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 class CVIMPSTDetailsImageDecoder : public CActive
       
    37     {
       
    38 public:
       
    39     /**
       
    40      * Two-phased constructor
       
    41      * 
       
    42      * @param aHeader The header control to which the bitmap is to be inserted after loading
       
    43      * @param aBitmapData Descriptor containing the bitmap data stream
       
    44      * @return a instance of same class
       
    45      * @since S60 v5.0 
       
    46      */
       
    47     static CVIMPSTDetailsImageDecoder* NewL(CVIMPSTDetailsHeaderControl& aHeader, const TDesC8& aBitmapData);
       
    48     
       
    49     /**
       
    50      * Destructor
       
    51 	 * @since S60 v5.0 
       
    52      */
       
    53     ~CVIMPSTDetailsImageDecoder();
       
    54     
       
    55     /**
       
    56      * Starts the decoding process
       
    57      * @since S60 v5.0 
       
    58      *
       
    59      */
       
    60     void StartL(TSize aBitmapSize);
       
    61     
       
    62     /**
       
    63      * From CActive
       
    64      * (see details from baseclass )
       
    65      * @since S60 v5.0 
       
    66      */
       
    67     void RunL();
       
    68     
       
    69     /**
       
    70      * From CActive
       
    71      * (see details from baseclass )
       
    72      * @since S60 v5.0 
       
    73      */
       
    74     void DoCancel();
       
    75 private:
       
    76     /**
       
    77      * First-phase (C++) constructor
       
    78      * @param aHeader The header control to which the bitmap is to be inserted after loading
       
    79      * @since S60 v5.0  
       
    80      */
       
    81     CVIMPSTDetailsImageDecoder(CVIMPSTDetailsHeaderControl& aHeader);
       
    82     
       
    83     /**
       
    84      * Second phase constructor
       
    85      * @since S60 v5.0 
       
    86      * @param aBitmapData Descriptor containing the bitmap data stream
       
    87      */
       
    88     void ConstructL(const TDesC8& aBitmapData);
       
    89     /**
       
    90      * Scales bitmap
       
    91      *
       
    92      */
       
    93     void ScaleBitmapL();
       
    94 
       
    95     enum TCcaImageDecoderState
       
    96         {
       
    97         ECcaConvertThumbnailImage = 1,
       
    98         ECcaScaleThumbnail,       
       
    99         };
       
   100     
       
   101     /**
       
   102      * Create bitmap
       
   103      *
       
   104      */
       
   105     void CreateBitmapL();
       
   106  private : // data  
       
   107     
       
   108   
       
   109     /**
       
   110      * Not Owns : The header control to which the bitmap is to be inserted after loading
       
   111      */
       
   112     CVIMPSTDetailsHeaderControl& iHeader;
       
   113 
       
   114 
       
   115     /**
       
   116      * Owns : The image decoder whose service is called to decode the image
       
   117      */
       
   118     CImageDecoder* iImgDecoder;
       
   119       
       
   120     /**
       
   121      * Owns : Handle to the file server session for loading the bitmap
       
   122      */ 
       
   123     RFs iFs;
       
   124     
       
   125     /**
       
   126      * The bitmap.
       
   127      * Owned until decoding is complete, then ownersip is transferred to header control.
       
   128      */
       
   129     CFbsBitmap* iBitmap; // owned until completion
       
   130     
       
   131     /**
       
   132      * Owns : Copy of the bitmap data stream
       
   133      */
       
   134     HBufC8* iBitmapData;
       
   135     
       
   136     /**
       
   137      * The image scaler whose service is called to scale the image
       
   138      * Own.
       
   139      */
       
   140     CBitmapScaler* iBitmapScaler;
       
   141 
       
   142     TSize iBitmapSize;
       
   143 
       
   144     /** 
       
   145      * Decoder internal state
       
   146      */ 
       
   147     TInt iDecoderState;
       
   148     };
       
   149 
       
   150 #endif /*CVIMPSTDETAILSIMAGEDECODER_H_*/