photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h
changeset 0 4e91876724a2
child 32 78ad99c24f08
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:     Declaration of Maths Engine
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef GLXZOOMMATHSENGINE_H_
       
    19 #define GLXZOOMMATHSENGINE_H_
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <glxzoomview.hrh>
       
    26 
       
    27 NONSHARABLE_CLASS( TGlxZoomAndPanMathsEngine )
       
    28     {
       
    29 public:
       
    30     
       
    31     /**
       
    32      * Starts panning with keys
       
    33      *@ param aOffset:Specifies the offset value with which image has to be shifted/panned
       
    34      */              
       
    35     void Pan(TPoint aOffset, 
       
    36             TPoint& aViewPortTopLeft,
       
    37             TGlxPanIncrementType aPanIncrement,
       
    38             TBool* aThresholdReached = NULL);
       
    39 
       
    40     /**
       
    41      * Starts zooming In/out with slider/Keys
       
    42      * @ param aMfactor:The Zooming factor with which image has to be zoomed
       
    43      */              
       
    44     TInt Zoom( TZoomMode aZoomMode,         // Ignored when aExpectedZoomRatio has a value 
       
    45                 TInt aExpectedZoomRatio,    // only for slider based zoom. = 0 for key based zoom. 
       
    46                 TPoint& aViewPortTopLeft, 
       
    47                 TSize& aViewPortDimension,
       
    48                 TBool* apThresholdReached = NULL,
       
    49                 TPoint* apZoomFocus = NULL, 
       
    50                 TInt aRelativeZoomFactor = 0);
       
    51     
       
    52     // Initialize 
       
    53     void Initialize(TPoint& aCenter, 
       
    54             TSize& aScreenSize, 
       
    55             TSize& aImageSize,
       
    56             TSize& aOriginalZoomedDimensions, 
       
    57             TUint8 aInitialZoomRatio);
       
    58     
       
    59     void UpdatePanFactor(TTime& aPanTime);
       
    60     
       
    61     // this can have a more generic name. but now it informs only abt screen orientation changes. and hence the name 
       
    62     void OrientationChanged(const TRect& aNewScreenRect);
       
    63     
       
    64     TSize ImageVirtualSize();
       
    65     
       
    66     TSize ScreenSize();
       
    67     
       
    68     TInt NewCenterCoordinate(TInt Center, 
       
    69             TInt Offset, 
       
    70             TUint16 HalfScreenDimension, 
       
    71             TInt MinimumCoordinate, 
       
    72             TInt MaximumCoordinate, 
       
    73             TBool *aLimitReached = NULL) ;
       
    74     
       
    75     void SetupPanOperation();
       
    76     
       
    77     TPoint LastPanOffset();
       
    78 
       
    79 private:
       
    80 
       
    81     /**
       
    82      * Get the next Zoomlevel on the basis of Zoom In/Out
       
    83      *  @ param aZoomMode:Specifies the zoomode,whether it is Zoom In/Out
       
    84      *  
       
    85      *  We ignore aZoommode and aRelativeZoomFactor if we have a aExpectedZoomRatio.
       
    86      *  We ignore aZoommode if we have a aRelativeZoomFactor.
       
    87      *  
       
    88      */          
       
    89     TInt NewZoomRatio( 
       
    90             TInt aExpectedZoomRatio,
       
    91             TInt aRelativeZoomFactor,
       
    92             TZoomMode aZoomMode,
       
    93             TBool *aThresholdReached = NULL) ;
       
    94     
       
    95     TPoint          iCenter             ;
       
    96     TSize           iScreenSize         ;
       
    97     TSize           iImageVirtualSize   ;
       
    98     TSize           iActualImageSize    ;
       
    99     
       
   100     // The Purpose of this Variable is to set the No:of pixels, by which it should Pan,
       
   101     // when the Key is held for long time.
       
   102     TUint8          iPanFactor          ;       
       
   103     // No of continuous pan operations that have happened. This is used in calculating the pan factor  
       
   104     TInt            iContinuousPanOperations;
       
   105                                                  
       
   106     // These are the thresholds
       
   107     TUint8          iMaxZoomRatio;
       
   108     TUint8          iMinZoomRatio   ;
       
   109     TSize           iInitialImageSize   ;
       
   110 
       
   111     // This is what our current zoom ratio is in percentage
       
   112     TReal						iZoomRatio;
       
   113     
       
   114     TPoint          iPanSpeed;          //  Pixels Panned per pan operation in vector form.  
       
   115     TPoint          iLastPanOffset;     //  Pixels Panned during the last pan operation.
       
   116     
       
   117     // [TODO]:Tsize might not be an exact match for this. using this only since it has exactly all the parameters that are required.   
       
   118     TSize           iBorderWidth;
       
   119 
       
   120     };
       
   121 
       
   122 
       
   123 
       
   124 #endif //GLXZOOMMATHSENGINE