mmappcomponents/mmappcommonui/albumartutility/inc/mpximageutilsync.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Synchronous wrapper around CMPXImageUtil.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPXIMAGEUTILSYNC_H
       
    20 #define MPXIMAGEUTILSYNC_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <imageconversion.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CMPXImageUtil;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 * Declares the CMPXImageUtilSync class.
       
    33 * @lib MPXSQLiteDbCommon.lib
       
    34 **/
       
    35 NONSHARABLE_CLASS( CMPXImageUtilSync ) : public CActive
       
    36     {
       
    37 public:  // Constructors and destructor
       
    38     /**
       
    39     * Two-phased constructor.
       
    40     * @return pointer to a newly created object
       
    41     */
       
    42     static CMPXImageUtilSync* NewL();
       
    43 
       
    44     /**
       
    45     * Destructor.
       
    46     */
       
    47     ~CMPXImageUtilSync();
       
    48 
       
    49 public: // New functions
       
    50     /*
       
    51     * Synchronously converts a JPG buffer to an CFbsBitmap.
       
    52     * @param aSourceJPG JPG data
       
    53     * @param aSize destination size to be used for calculating the optimal loading size
       
    54     * @param aDisplayMode the display mode of the destination BMP
       
    55     * @return converted bitmap. Ownership is transferred.
       
    56     */
       
    57     CFbsBitmap* DecodeL(const TDesC8& aSourceJPG, TSize aSize, TDisplayMode aDisplayMode = EColor64K);
       
    58 
       
    59     /*
       
    60     * Synchronously decodes an image from a JPG file. 
       
    61     * @param aSourceJPGFile Full path and filename of the image to be decoded.
       
    62     * @param aSize destination size to be used for calculating the optimal loading size
       
    63     * @param aDisplayMode the display mode of the destination BMP
       
    64     * @return converted bitmap. Ownership is transferred.
       
    65     */  
       
    66     CFbsBitmap* DecodeL(const TDesC& aSourceJPGFile, TSize aSize, TDisplayMode aDisplayMode = EColor64K);
       
    67 
       
    68     /*
       
    69     * Synchronously encodes a BMP to JPG.
       
    70     * @param aSourceBMP source BMP
       
    71     * @return destination JPG, ownership is transferred
       
    72     */
       
    73     HBufC8* EncodeL(const CFbsBitmap& aSourceBMP);
       
    74             
       
    75     /*
       
    76     * Synchronously scales a BMP to a specified size
       
    77     * @param aSourceBMP source BMP
       
    78     * @param aSize size to scale to
       
    79     * @param aDisplayMode display mode for the destination image
       
    80     * @return scaled BMP, ownership is transferred
       
    81     */
       
    82     CFbsBitmap* ScaleL(CFbsBitmap& aSourceBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K);
       
    83 
       
    84 private:    // From CActive
       
    85     /**
       
    86     * @see CActive
       
    87     */
       
    88     void DoCancel();
       
    89 
       
    90     /**
       
    91     * @see CActive
       
    92     */
       
    93     void RunL();
       
    94 
       
    95     /**
       
    96     * @see CActive
       
    97     */
       
    98     TInt RunError(TInt aError);
       
    99 
       
   100 private:
       
   101     /**
       
   102     * C++ default constructor.
       
   103     */
       
   104     CMPXImageUtilSync();
       
   105 
       
   106     /**
       
   107     * By default Symbian 2nd phase constructor is private.
       
   108     */
       
   109     void ConstructL();
       
   110 
       
   111 private:    // Data
       
   112     CActiveSchedulerWait* iActiveSchedulerWait;
       
   113     CMPXImageUtil* iImageUtil;
       
   114     CFbsBitmap* iBitmap;
       
   115     HBufC8* iData;
       
   116     TInt iError;
       
   117     };
       
   118 
       
   119 #endif // MPXIMAGEUTILSYNC_H
       
   120 
       
   121 // End of File