activityfw/activitydatabase/hsactivitydbserver/inc/activitygraphicfilescaling.h
branchGCC_SURGE
changeset 105 e7325f632549
parent 81 5ef31a21fdd5
parent 104 9b022b1f357c
equal deleted inserted replaced
81:5ef31a21fdd5 105:e7325f632549
     1 /*
       
     2  * Copyright (c) 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 :
       
    15  *
       
    16  */
       
    17 #ifndef ACTIVITYGRAPHICFILESSCALING_H
       
    18 #define ACTIVITYGRAPHICFILESSCALING_H
       
    19 
       
    20 #ifndef __E32SVR_H__
       
    21 #define __E32SVR_H__
       
    22 #endif
       
    23 
       
    24 
       
    25 #ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
       
    26 #define SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
       
    27 #endif
       
    28 
       
    29 #include <bitmaptransforms.h>
       
    30 
       
    31 class CImageDecoder;
       
    32 class CFbsBitmap;
       
    33 
       
    34 class MImageReadyCallBack
       
    35 {
       
    36 public:
       
    37     virtual void ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap ) = 0;
       
    38 };
       
    39 
       
    40 class CGraphicsSalingHandler : public CActive
       
    41 {
       
    42 public:
       
    43 
       
    44 enum TCurrentOperation{
       
    45         ENone = 0,
       
    46         EConvertBitmapFromFile = 1,
       
    47         EScale = 2
       
    48     };
       
    49 
       
    50 enum TKindOfScaling
       
    51 {
       
    52    EIgnoreAspectRatio = 0,
       
    53    EKeepAspectRatio = 1,
       
    54    EKeepAspectRatioByExpanding = 2,
       
    55 };
       
    56 
       
    57     ~CGraphicsSalingHandler();
       
    58 
       
    59     static CGraphicsSalingHandler* NewL(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
       
    60     static CGraphicsSalingHandler* NewLC(MImageReadyCallBack &aNotify, RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
       
    61 
       
    62 protected:
       
    63     void DoCancel();
       
    64     void RunL();
       
    65     TInt RunError(TInt);
       
    66 
       
    67 private:
       
    68     void ConstructL(RFs &aFs, const TDesC &aFileName, const TDesC8& aMimeType);
       
    69     CGraphicsSalingHandler(MImageReadyCallBack &aNotify, const TSize &aNewSize, TKindOfScaling aKindOfScaling);
       
    70     TSize Scaling();
       
    71 
       
    72 private:
       
    73     MImageReadyCallBack &mNotify;
       
    74     CImageDecoder *mImageDecoder;
       
    75     CFbsBitmap *mBitmapFromFile;
       
    76     CFbsBitmap *mBitmapOutput;
       
    77     CBitmapScaler *mBitmapScaler;
       
    78     TSize mNewSize;
       
    79     TBool mKindOfScaling;
       
    80 
       
    81     TCurrentOperation mCurrentOperation;
       
    82 };
       
    83 
       
    84 #endif // ACTIVITYGRAPHICFILESSCALING_H