camerauis/cameraapp/generic/inc/CamSyncRotatorAo.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     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:  Utility class to rotate bitmaps*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CamSyncRotatorAo_H
       
    22 #define __CamSyncRotatorAo_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <bitmaptransforms.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 class MBitmapRotationObserver
       
    40     {
       
    41 public: 
       
    42     /**
       
    43     * Mixin interface to be implemented by any object wishing to receive 
       
    44     * notification of rotation complete events.
       
    45     * @since 3.0
       
    46     * @param aErr KErrNone if successful, on error other Epoc codes possible
       
    47     */
       
    48     virtual void RotationCompleteL( TInt aErr ) = 0 ;
       
    49     };
       
    50 
       
    51 
       
    52 /**
       
    53 *  Utility class to help in the rotating of bitmaps (for post-capture snapshot)
       
    54 *
       
    55 *  @since 3.0
       
    56 */
       
    57 class CCamSyncRotatorAo : public CActive
       
    58     {
       
    59     private:
       
    60         // This structure stores the details of a rotation task.
       
    61         // Used only internally, the bitmap is *not* owned by this
       
    62         // class, and will be overwritten by the rotation operation.        
       
    63         class CRotateTask : public CBase
       
    64             {        
       
    65         public:
       
    66             // The source bitmap to be rotated (and overwritten)
       
    67             CFbsBitmap* iBitmap;
       
    68 
       
    69             // The angle to rotate the bitmap by
       
    70             CBitmapRotator::TRotationAngle iAngle;
       
    71             };
       
    72 
       
    73     public:  // Constructors and destructor
       
    74         
       
    75         /**
       
    76         * Two-phased constructor.
       
    77         */
       
    78         static CCamSyncRotatorAo* NewL(MBitmapRotationObserver& aObserver);
       
    79         
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         virtual ~CCamSyncRotatorAo();
       
    84 
       
    85     public: // New functions        
       
    86         /**
       
    87         * Rotates the specified bitmap by the supplied angle.  
       
    88         * Note that the original bitmap will be overwritten
       
    89         * @since 3.0
       
    90         * @param aBitmap The bitmap to rotate
       
    91         * @param aRotation The angle to rotate the bitmap        
       
    92         */
       
    93         void RotateL( CFbsBitmap* aBitmap, CBitmapRotator::TRotationAngle aRotation );        
       
    94 
       
    95     public: // Functions from base classes
       
    96         /**
       
    97         * Called when a rotate operation has completed
       
    98         * @since 3.0        
       
    99         */
       
   100         void RunL();
       
   101            
       
   102 
       
   103         /**
       
   104         * Called to cancel an outstanding operation (eg when class is being destroyed)
       
   105         * @since 3.0       
       
   106         */
       
   107         void DoCancel();
       
   108         
       
   109     private:
       
   110 
       
   111         /**
       
   112         * C++ default constructor.
       
   113         * @since 3.0
       
   114         */
       
   115         CCamSyncRotatorAo(MBitmapRotationObserver& aObserver);
       
   116 
       
   117         /**
       
   118         * By default Symbian 2nd phase constructor is private.
       
   119         * @since 3.0
       
   120         */
       
   121         void ConstructL();
       
   122 
       
   123     private:    // Data
       
   124     
       
   125         // ICL utility class that actually does the bitmap rotation
       
   126         CBitmapRotator* iRotator;        
       
   127         
       
   128         MBitmapRotationObserver& iObserver;
       
   129     };
       
   130 
       
   131 #endif      // __CamSyncRotatorAo_H
       
   132             
       
   133 // End of File