camerauis/cameraapp/generic/inc/CamBurstThumbnailGridSizer.h
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
53:61bc0f252b2b 54: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:  Class used to for resizing burst mode thumbnails*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef CAMBURSTTHUMBNAILGRIDSIZER_H
       
    20 #define CAMBURSTTHUMBNAILGRIDSIZER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <bitmaptransforms.h>   // For CBitmapScaler
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 // MACROS
       
    28 
       
    29 // DATA TYPES
       
    30 
       
    31 // FUNCTION PROTOTYPES
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 // Helper class
       
    35 class CScaleTask : public CBase
       
    36   {   
       
    37   // =======================================================
       
    38   public:
       
    39     
       
    40     static CScaleTask* NewL( const CFbsBitmap& aBitmap, 
       
    41                              const TSize&      aSize,
       
    42                              TInt32            aInfo );
       
    43     
       
    44     virtual ~CScaleTask();
       
    45 
       
    46   private:
       
    47 
       
    48     CScaleTask( const TSize&      aSize,
       
    49                 TInt32            aInfo    );
       
    50 
       
    51     void ConstructL( const CFbsBitmap& aBitmap );
       
    52 
       
    53   // -------------------------------------------------------  
       
    54   public:
       
    55   
       
    56     inline const CFbsBitmap* Bitmap() const { return iSrc;  };
       
    57     inline const TSize&      Size()   const { return iSize; };
       
    58     inline TInt32            Info()   const { return iInfo; };
       
    59 
       
    60   // =======================================================
       
    61   private:
       
    62   
       
    63     CFbsBitmap* iSrc; //< owned
       
    64     TSize       iSize;
       
    65     TInt32      iInfo;
       
    66 
       
    67   // =======================================================
       
    68   };    
       
    69 
       
    70 
       
    71 // Interface definition for notification of when an image has been resized.
       
    72 class MBitmapScaler
       
    73     {
       
    74 public: 
       
    75     /**
       
    76     * Mixin interface to be implemented by any object wishing to receive 
       
    77     * notification of scale complete events.
       
    78     * @since 2.8
       
    79     * @param aErr KErrNone if successful, on error other Epoc codes possible
       
    80     * @param aBitmap The resized bitmap (called class takes ownership)
       
    81     * @param aInfo Optional parameter that will be passed back when scale completes
       
    82     */
       
    83     virtual void BitmapScaleCompleteL( TInt aErr, CFbsBitmap* aBitmap, TInt32 aInfo ) = 0 ;
       
    84     };
       
    85 
       
    86 /**
       
    87 *  Utility class used by the Thumbnail Grid Model for resizing/scaling bitmaps
       
    88 *
       
    89 *  @since 2.8
       
    90 */
       
    91 class CCamThumbnailGridSizer : public CActive
       
    92     {
       
    93     public:  // Constructors and destructor
       
    94         
       
    95         /**
       
    96         * Two-phased constructor.
       
    97         * @param aObserver The object to be notified of scaling completion
       
    98         * @param aSize The default size of the bitmap to scale TO
       
    99         * @return An instance of the sizer object
       
   100         */
       
   101         static CCamThumbnailGridSizer* NewL( MBitmapScaler* aObserver, TSize& aSize );
       
   102         
       
   103         /**
       
   104         * Destructor.
       
   105         */
       
   106         virtual ~CCamThumbnailGridSizer();
       
   107               
       
   108     public: // New functions
       
   109         
       
   110    
       
   111     	/**
       
   112     	 * Sets new size for the scaling
       
   113     	 * @param aThumbSize The new size
       
   114     	 */
       
   115     	void SetSize( const TSize aThumbSize );
       
   116         
       
   117     	/**
       
   118         * Scales from a source bitmap to a target bitmap, using the dimentions
       
   119         * of the target bitmap to define the scale
       
   120         * @since 2.8
       
   121         * @param aSrc Source bitmap, scaling from        
       
   122         */
       
   123         void StartScaleL( const CFbsBitmap& aSrc );
       
   124         
       
   125         /**
       
   126         * Scales from a source bitmap to a target bitmap, using the dimensions
       
   127         * of the target bitmap to define the scale
       
   128         * @since 2.8
       
   129         * @param aSrc Source bitmap, scaling from        
       
   130         * @param aSize The size of the bitmap to scale to
       
   131         * @param aInfo Optional parameter that will be passed back when scale completes
       
   132         */
       
   133         void StartScaleL( const CFbsBitmap& aSrc, TSize& aSize, TInt32 aInfo );
       
   134     
       
   135     public: // Functions from base classes
       
   136        
       
   137     protected:  // New functions
       
   138         
       
   139     protected:  // Functions from base classes
       
   140         
       
   141         /**
       
   142         * From CActive
       
   143         */
       
   144        	void DoCancel();
       
   145     
       
   146         /**
       
   147         * From CActive
       
   148         */
       
   149         void RunL();    
       
   150 
       
   151     private:
       
   152 
       
   153         /**
       
   154         * C++ default constructor.
       
   155         * @param aObserver The object to be notified of scaling completion
       
   156         * @param aSize The default size of the bitmap to scale TO
       
   157         */
       
   158         CCamThumbnailGridSizer( MBitmapScaler* aObserver, TSize& aSize );
       
   159 
       
   160         /**
       
   161         * By default Symbian 2nd phase constructor is private.
       
   162         */
       
   163         void ConstructL();
       
   164         
       
   165         /**
       
   166         * Allows specifying of specific sizing task to start
       
   167         * @param aTask The task to begin
       
   168         * @since 3.0
       
   169         */
       
   170         void StartScaleL( CScaleTask* aTask );
       
   171        
       
   172     private:    // Data
       
   173         // Bitmap scaling object, actually does the scaling
       
   174         CBitmapScaler* iScaler;        
       
   175 
       
   176         // The object to be notified when scaling is complete.
       
   177         MBitmapScaler* iObserver;    
       
   178         
       
   179         // Temporary bitmap used while performing the scaling operation
       
   180         CFbsBitmap* iTmpBitmap; 
       
   181         
       
   182         // The size of the bitmap to scale to
       
   183         TSize iThumbSize;                
       
   184         
       
   185         // List of outstanding scaling tasks
       
   186         RPointerArray <CScaleTask> iScaleTaskArray;        
       
   187     };
       
   188 
       
   189 #endif      // CAMBURSTTHUMBNAILGRIDSIZER_H
       
   190             
       
   191 // End of File