webengine/wmlengine/src/image/include/Epoc32ImageDecoder.h
changeset 0 dd21522fd290
child 16 a359256acfc6
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2000 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 the License "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 /* CEpoc32ImageDecoder class
       
    20  *
       
    21  * Every non-canned image has an image decoder associated with it. This is opened
       
    22  * when the image is created in order to get the size. This is an asynchronous
       
    23  * operation; "MiuoOpenComplete" is called when the opening is complete.
       
    24  *
       
    25  * The first time an image is displayed, "Decode" is called, which starts the
       
    26  * asynchrounous decoding process. When this completes, the image object is
       
    27  * updated with the decoded image, which then causes the new image to be
       
    28  * displayed.
       
    29  *
       
    30  * A decode is also done every time the frame number of an animated image is
       
    31  * changed.
       
    32  */
       
    33 
       
    34 #ifndef EPOC32IMAGEDECODER_H
       
    35 #define EPOC32IMAGEDECODER_H
       
    36 
       
    37 // INCLUDES
       
    38 
       
    39 #include <e32base.h>
       
    40 #include <ImageConversion.h>
       
    41 
       
    42 #include "nw_image_epoc32simpleimage.h"
       
    43    
       
    44 // FORWARD DECLARATIONS
       
    45 // #define INCREMENTAL_IMAGE_ON
       
    46 
       
    47 class CFbsBitmap;
       
    48 
       
    49 // CLASS DECLARATION
       
    50 
       
    51 class CEpoc32ImageDecoder : public CActive
       
    52     {
       
    53     public:
       
    54         static CEpoc32ImageDecoder* NewL(NW_Image_Epoc32Simple_t* aImage);
       
    55         void ConstructL();
       
    56         void RunL();
       
    57         void DoCancel() {iImageConverter->Cancel();}
       
    58 
       
    59         virtual ~CEpoc32ImageDecoder();
       
    60 
       
    61         /*!
       
    62          @function Decode
       
    63          @discussion Opens data into fbsBitmap. 
       
    64          */
       
    65         void Open();
       
    66 
       
    67         /*!
       
    68          @function Decode
       
    69          @discussion Converts data into fbsBitmap. 
       
    70          */
       
    71         TInt Decode(); 
       
    72 
       
    73         NW_Bool IncrementImage(NW_Bool& startingFrameSequenceOver);
       
    74 
       
    75         /*!
       
    76          @function PartialNextChunkL
       
    77          @discussion new chunk of raw data
       
    78          */
       
    79         void PartialNextChunkL( NW_Buffer_t* aNextChunk );
       
    80 
       
    81         /*!
       
    82          @function ImageDataComplete
       
    83          @discussion end of raw data
       
    84          */
       
    85         void ImageDataComplete();
       
    86 
       
    87 
       
    88         /*!
       
    89          @function ResetImage
       
    90          @discussion display the last frame of an animated image
       
    91          */
       
    92 		void ResetImage();
       
    93 
       
    94         /*!
       
    95          @function Finished
       
    96          @discussion Finished animating image. 
       
    97          */
       
    98 		TBool Finished();
       
    99 
       
   100 
       
   101         inline void SetImageHasNotBeenOpened (NW_Bool aImageHasNotBeenOpened) { iImageHasNotBeenOpened = aImageHasNotBeenOpened; }
       
   102 
       
   103     private:
       
   104 
       
   105         void DoDecodeL(); 
       
   106 
       
   107         CEpoc32ImageDecoder(NW_Image_Epoc32Simple_t* aImage);
       
   108 
       
   109         /*!
       
   110         @function OpenComplete
       
   111 
       
   112         @discussion Called when the image file has been opened
       
   113         */
       
   114         void OpenComplete();
       
   115 
       
   116         /*!
       
   117         @function ConvertComplete
       
   118 
       
   119         @discussion Called when conversion process performed on the bitmap is complete
       
   120         */
       
   121         void ConvertComplete();
       
   122 
       
   123         /*!
       
   124         @function CreateComplete
       
   125 
       
   126         @discussion Called when the file in which the bitmap is to be saved has been created 
       
   127         */
       
   128         void CreateComplete( TInt aError );
       
   129 
       
   130         TDisplayMode GetDisplayMode( TFrameInfo& aFrameInfo );
       
   131 
       
   132         void CheckAnimation();
       
   133         void DeleteImageConverterBitmapMask();
       
   134         TInt16 GetLoopCount();
       
   135 
       
   136         /*
       
   137          * imageSizeCheck: This compares the original image size with
       
   138          * that specified in the <img src = ".." width="" height="">. Then
       
   139          * creates bit map accordingly. The value is return true if the 
       
   140          * <img> tag attribute values need to be used.
       
   141          */
       
   142 
       
   143          NW_Bool ImageSizeCheck(TSize iFrameInfoOverallSize, TSize* sizeSet);
       
   144          TInt ImgAttrInfo();
       
   145 		 TInt CheckForDRMImage();
       
   146 
       
   147     private:
       
   148         enum
       
   149         {
       
   150           ID_IDLE = 0,
       
   151           ID_INITIALIZING,
       
   152           ID_DECODING
       
   153         } iState;                       // Current decoder operation
       
   154 
       
   155         CBufferedImageDecoder* iImageConverter;  // Connection to media server
       
   156         
       
   157         NW_Image_Epoc32Simple_t* iImage;// OOC image
       
   158         TPtrC8 iImageDataPtr;           // Raw unconverted image data
       
   159         TFrameInfo iFrameInfo;          // Info about image from media server
       
   160         NW_Bool iIsAnimated;            // NW_TRUE if more than one frame in image
       
   161         TUint iCurrentFrame;            // Number of current frame displayed
       
   162         CFbsBitmap* iBitmap;            // Decoded bitmap
       
   163         CFbsBitmap* iMask;              // Decoded bitmap mask
       
   164         NW_Bool iImageHasNotBeenOpened; // NW_TRUE the first time an image is opened
       
   165         TBool  iMoreData;               // iMoreData
       
   166         TBool  iFirstFrameComplete;     // first frame complete
       
   167         TBool  iRawDataComplete;        // we've got all the raw data
       
   168         RFs iRfs;                       // A dummy parameter required by the Symbian API
       
   169 		TUint8 *iDRMOutBuf;             //Outputput buffer for the DRM decryption.
       
   170         TBool iFinished;				// Finished animating image.
       
   171     };
       
   172 
       
   173 #endif