photosgallery/viewframework/texturemanager/inc/glxbitmapdecoderwrapper.h
changeset 0 4e91876724a2
child 47 f9e827349359
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    Texture Manager component/Decodes the Image in step for large images
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXBITMAPDECODERWRAPPER_H
       
    22 #define C_GLXBITMAPDECODERWRAPPER_H
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include<alf/alftimedvalue.h>
       
    26 #include <IclExtJpegApi.h>  // For CExtJpegDecoder
       
    27 
       
    28 /**
       
    29  * Observer interface used to be notified when texture bitmap   is completed.
       
    30  */
       
    31 NONSHARABLE_CLASS( MGlxBitmapDecoderObserver )
       
    32         {
       
    33         public:
       
    34             /**
       
    35              * Called when the content of the texture is changed.
       
    36              * @param aHasContent Whether the texture now has content.
       
    37              */
       
    38             virtual void HandleBitmapDecodedL(TInt aThumbnailIndex,CFbsBitmap* aBitmap) = 0;
       
    39         };
       
    40 /**
       
    41  * This class does the decoding of the images in steps depending on the size of the images .
       
    42  * this is a wrapper class, doesn't actually decode the images.
       
    43  */
       
    44 
       
    45 class CGlxBitmapDecoderWrapper: public CActive
       
    46     {
       
    47 public:
       
    48     /*This Enums specifies the state of the Decoding*/
       
    49     enum TDecoderState
       
    50         {
       
    51         ESTate0, ESTate1,ESTateFinal
       
    52         };  
       
    53     /*This Enums specifies the size of the images*/
       
    54     enum TImageLevel
       
    55         {
       
    56         ELevel0, ELevel1,ELevel2
       
    57         }; 
       
    58     /**
       
    59      * Two-phased constructor
       
    60      * @param aObserver:The Observer contains the CGlxTextureManagerImpl Object
       
    61      * @return Constructed object
       
    62      */
       
    63     static CGlxBitmapDecoderWrapper* NewL(MGlxBitmapDecoderObserver* aObserver);
       
    64 
       
    65     /**
       
    66      * Destructor
       
    67      */
       
    68     ~CGlxBitmapDecoderWrapper();
       
    69 
       
    70     /**
       
    71      * intiates the Decoding the Image and updates the no:of steps to decode
       
    72      * @param aSourceFileName :contains the file name
       
    73      * @param aindex:contains the index value
       
    74      */
       
    75     void DoDecodeImageL(const TDesC & aSourceFileName,TInt aIndex);
       
    76 
       
    77     /**
       
    78      * starts the decoding and updates the state of the decoding
       
    79      */
       
    80     void DecodeImageL();
       
    81     /**
       
    82      * Request free memory with Out of Memory Monitor
       
    83      * @param aBytesRequested : Request for free memory in Bytes
       
    84      */
       
    85     TInt OOMRequestFreeMemoryL( TInt aBytesRequested);
       
    86 
       
    87 public:    
       
    88     /**
       
    89      * Standard Active object functions
       
    90      * */
       
    91     virtual void RunL();
       
    92     virtual void DoCancel();
       
    93 
       
    94 private:
       
    95     /*
       
    96      * Constructor
       
    97      * */
       
    98     CGlxBitmapDecoderWrapper();
       
    99     
       
   100     /*
       
   101      *Second-phase constuction 
       
   102      * */
       
   103     void ConstructL(MGlxBitmapDecoderObserver* aObserver);
       
   104     /*
       
   105      * Get the orientation of the file
       
   106      * This API reads the Exif tag in an image and returns the orientation of that Image 
       
   107      */
       
   108     TUint16 GetOrientationL(const TDesC& aFileName) ;
       
   109     /*
       
   110      * Get the Rotation Angle and Mirroring status of the image so as to set it on the decoder 
       
   111      * This API calculates the rotation angle and the Mirroring status required by the decoder
       
   112      * @param aOrientation Orientation of the image.
       
   113      * @param aRotAngle Rotation angle to be set on the image decoder.
       
   114      * @param aFlipStatus Mirroring status for the decoder if 1 then mirroring should be set.
       
   115      * Internally it also sets the iOriginalSize to the required size
       
   116      */
       
   117     void GetRotationParameters(TUint16 aOrientation, TInt& aRotAngle, TBool& aFlipStatus) ;
       
   118 
       
   119 private:    
       
   120     /* Contains the TextureManagerImpl object,calls the HandleBitmapDecoded*/
       
   121     MGlxBitmapDecoderObserver* iObserver;
       
   122     /*Specifies the Decoder */
       
   123     CImageDecoder*          iImageDecoder; // decoder from ICL API
       
   124     /*Contains the Thumbnail Index*/
       
   125     TInt iThumbnailIndex;
       
   126     /*Contains the Bitmap generated*/
       
   127     CFbsBitmap* iBitmap;
       
   128     /*contains the original size of the image*/
       
   129     TAlfRealSize iOriginalSize;
       
   130     /*A handle to a file server session.*/ 
       
   131     RFs iFs;
       
   132     /*Specifies the state of decoding ,if it is in initial level(3MP), Middlelevel(6MP) or final level*/
       
   133     TDecoderState iDecoderState;
       
   134     /*Specifies the size of teh image and levels to decode*/
       
   135     TImageLevel   iImageLevel;
       
   136 #ifdef _DEBUG
       
   137     
       
   138     TTime iDecodeProcessstartTime;
       
   139     TTime iStartTime;
       
   140     TTime iStopTime;
       
   141 #endif
       
   142     };
       
   143 
       
   144 #endif //C_GLXBITMAPDECODERWRAPPER_H