imageeditor/plugins/ClipartPlugin/src/ClipartScaler.cpp
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 #include <BitmapTransforms.h>
       
    23 
       
    24 #include "ClipartScaler.h"
       
    25 #include "ImageEditorError.h"
       
    26 
       
    27 
       
    28 //=============================================================================
       
    29 CClipartScaler::CClipartScaler (MClipartScalerNotifier* aNotifier)
       
    30 : CActive(0), iNotifier(aNotifier)
       
    31     {
       
    32     }
       
    33 
       
    34 //=============================================================================
       
    35 CClipartScaler::~CClipartScaler ()
       
    36     {
       
    37     Cancel();
       
    38     delete iBitmapScaler;
       
    39     iBitmapScaler = 0;    
       
    40     }
       
    41 
       
    42 //=============================================================================
       
    43 void CClipartScaler::ConstructL ()
       
    44     {
       
    45     CActiveScheduler::Add(this);
       
    46     iBitmapScaler = CBitmapScaler::NewL();
       
    47     }
       
    48 
       
    49 //=============================================================================
       
    50 void CClipartScaler::ScaleBitmapL(CFbsBitmap* aBitmap, TSize aNewSize)
       
    51     {
       
    52     iBitmapScaler->Scale(&iStatus, *aBitmap, aNewSize);
       
    53     SetActive();
       
    54     }
       
    55 
       
    56 //=============================================================================
       
    57 void CClipartScaler::DoCancel()
       
    58     {
       
    59     if(IsActive())
       
    60         {
       
    61         iBitmapScaler->Cancel();
       
    62         }
       
    63     }
       
    64  
       
    65 //=============================================================================
       
    66 void CClipartScaler::RunL()
       
    67     {
       
    68     if (iStatus == KErrNone)
       
    69         {
       
    70         iNotifier->ClipartScalerOperationReadyL(KErrNone); 
       
    71         }
       
    72     else
       
    73         {
       
    74         iNotifier->ClipartScalerOperationReadyL(KSIEEInternal);        
       
    75         }
       
    76     }
       
    77 
       
    78 // End of File