voipplugins/accountcreationplugin/engine/inc/acpimagehandler.h
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Declarition of CAcpImageHandler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ACPIMAGEHANDLER_H
       
    20 #define ACPIMAGEHANDLER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include <imageconversion.h>
       
    26 
       
    27 class CFbsBitmap;
       
    28 class CBitmapRotator;
       
    29 class MImageHandlerObserver;
       
    30 
       
    31 /**
       
    32  *  CAcpImageHandler class
       
    33  *  Declarition of CAcpImageHandler.
       
    34  *
       
    35  *  @lib accountcreationplugin.lib
       
    36  *  @since S60 v3.2
       
    37  */
       
    38 class CAcpImageHandler : public CActive
       
    39     {
       
    40 private:
       
    41     /**
       
    42      * States of execution.
       
    43      */
       
    44     enum TState 
       
    45         {
       
    46         EIdle = 0,
       
    47         EDecoding,
       
    48         EScaling
       
    49         };
       
    50 public:
       
    51 
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      *
       
    55      * @param aController for observer.
       
    56      */
       
    57     static CAcpImageHandler* NewL( MImageHandlerObserver& aController );
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     virtual ~CAcpImageHandler();
       
    63 
       
    64     /**
       
    65      * Decodes an image to bitmap.
       
    66      *
       
    67      * @since S60 v3.2
       
    68      * @param aFileName A file to be decoded to the bitmap.
       
    69      */
       
    70     void StartToDecodeL( const TDesC8& aSourceData,
       
    71         const TDesC8& aContentType );
       
    72 
       
    73     /**
       
    74      * Get bitmap.
       
    75      *
       
    76      * @since S60 v3.2
       
    77      * @return Reference to bitmap already converted.
       
    78      */
       
    79     CFbsBitmap* GetBitmap();
       
    80 
       
    81     /**
       
    82      * Get mask.
       
    83      *
       
    84      * @since S60 v3.2
       
    85      * @return Reference to the mask from bitmap conversion.
       
    86      */
       
    87     CFbsBitmap* GetMask();
       
    88 
       
    89 protected: 
       
    90 
       
    91 // from base class CActive
       
    92 
       
    93     /**
       
    94      * From CActive.
       
    95      * Cancels an outstanding request.
       
    96      * 
       
    97      * @since S60 v3.2
       
    98      */
       
    99     void DoCancel();
       
   100 
       
   101     /**
       
   102      * From CActive.
       
   103      * Handles request completion event.
       
   104      * 
       
   105      * @since S60 v3.2
       
   106      */
       
   107     void RunL();
       
   108 
       
   109 private: 
       
   110     CAcpImageHandler( MImageHandlerObserver& aController ); 
       
   111     void ConstructL();
       
   112 
       
   113 private:  
       
   114 
       
   115     /**
       
   116      * Observer reference.
       
   117      */
       
   118 	MImageHandlerObserver& iController;
       
   119 
       
   120     /**
       
   121      * Handle for file server.
       
   122      */
       
   123     RFs iFs;
       
   124 
       
   125     /**
       
   126      * Handle for image decoder.
       
   127      * Own. 
       
   128      */
       
   129     CImageDecoder* iImageDecoder;
       
   130 
       
   131     /**
       
   132      * State of execution (decoding or scaling).
       
   133      */
       
   134     TState iState;
       
   135 
       
   136     /**
       
   137      * Converted bitmap.
       
   138      * Own. 
       
   139      */
       
   140     CFbsBitmap* iBitmap;
       
   141     
       
   142     /**
       
   143      * Converted mask.
       
   144      * Own.
       
   145      */
       
   146     CFbsBitmap* iMask;
       
   147     
       
   148     // For unit testing.
       
   149 #ifdef _DEBUG
       
   150     friend class T_CAcpImageHandler;
       
   151 #endif
       
   152     };
       
   153 
       
   154 #endif // ACPIMAGEHANDLER_H
       
   155 
       
   156 // End of file.