btobexprofiles/obexsendservices/obexservicesendutils/inc/BTSUImageConverter.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2002 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:  Image conversion class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTSU_IMAGE_CONVERTER_H
       
    20 #define BTSU_IMAGE_CONVERTER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <f32file.h>
       
    24 #include <badesca.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CImageDecoder;
       
    30 class CImageEncoder;
       
    31 class CFrameImageData;
       
    32 class CBitmapScaler;
       
    33 class CFbsBitmap;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * A class for executing simple image conversion tasks.
       
    39 */
       
    40 NONSHARABLE_CLASS (CBTSUImageConverter) : public CActive
       
    41     {
       
    42 
       
    43     public:  // Constructor and destructor
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.        
       
    47         * @param None.
       
    48         */
       
    49         static CBTSUImageConverter* NewL();
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         ~CBTSUImageConverter();
       
    55 
       
    56     public: // New functions        
       
    57 
       
    58         /**
       
    59         * Returns the pixel size of the given image.
       
    60         * @param aImageFile A file handle of image file.
       
    61         * @return The pixel size.
       
    62         */
       
    63         TSize GetImageSizeL( RFile&  aImageFile );        
       
    64 
       
    65         /**
       
    66         * Create a thumbnail version of the source image.
       
    67         * @param aSourceFile A filehandle of sourcefile.
       
    68         * @param aDestFile   Full path for the destination file.
       
    69         * @return None.
       
    70         */
       
    71         void CreateThumbnailL( RFile& aSourceFile, 
       
    72                                const TDesC& aDestFile );
       
    73 
       
    74         /**
       
    75         * Finds a display name for the given mime type.
       
    76         * @param aMimeType Mime type
       
    77         * @return A pointer to the name.
       
    78         */
       
    79         static HBufC* GetDisplayNameL( const TDesC8& aMimeType );
       
    80 
       
    81     private: // Functions from base classes
       
    82 
       
    83         /**
       
    84         * From CActive Get's called when a request is cancelled.
       
    85         * @return None.
       
    86         */
       
    87         void DoCancel();
       
    88 
       
    89         /**
       
    90         * From CActive Get's called when a request is completed.
       
    91         * @return None.
       
    92         */
       
    93         void RunL();
       
    94     
       
    95     private:
       
    96 
       
    97         /**
       
    98         * C++ default constructor.
       
    99         */
       
   100         CBTSUImageConverter();
       
   101 
       
   102         /**
       
   103         * Symbian 2nd phase constructor.
       
   104         */
       
   105         void ConstructL();
       
   106 
       
   107         /**
       
   108         * Decode image.
       
   109         * @param aSourceFile A filehandle of source file.
       
   110         * @return None
       
   111         */
       
   112         void DecodeImageL( RFile& aSourceFile );
       
   113 
       
   114         /**
       
   115         * Encode image.
       
   116         * @param aDestFile Full path for the destination file.
       
   117         * @param aThumbnail ETrue enables thumbnail creation
       
   118         * @return None
       
   119         */
       
   120         void EncodeImageL( const TDesC& aDestFile,
       
   121                            const TBool& aThumbnail = EFalse );
       
   122 
       
   123         /**
       
   124         * Scale image.
       
   125         * @return None
       
   126         */
       
   127         void ScaleImageL();
       
   128 
       
   129         /**
       
   130         * Reset internal state.
       
   131         * @return None.
       
   132         */
       
   133         void Reset();
       
   134 
       
   135     private: // Data
       
   136 
       
   137         CImageDecoder*              iDecoder;
       
   138         CImageEncoder*              iEncoder;
       
   139         CBitmapScaler*              iScaler;
       
   140 
       
   141         CFrameImageData*            iFrameImageData;
       
   142         CFbsBitmap*                 iFrameBitmap;
       
   143         CFbsBitmap*                 iScaledBitmap;
       
   144         RFs                         iFileSession;
       
   145 
       
   146         CActiveSchedulerWait        iWait;
       
   147     };
       
   148 
       
   149 
       
   150 #endif // BTSU_IMAGE_CONVERTER_H