photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h
branchRCL_3
changeset 18 78ad99c24f08
parent 0 4e91876724a2
child 19 420f6808bf21
equal deleted inserted replaced
17:a60acebbbd9d 18:78ad99c24f08
    36             TPoint& aViewPortTopLeft,
    36             TPoint& aViewPortTopLeft,
    37             TGlxPanIncrementType aPanIncrement,
    37             TGlxPanIncrementType aPanIncrement,
    38             TBool* aThresholdReached = NULL);
    38             TBool* aThresholdReached = NULL);
    39 
    39 
    40     /**
    40     /**
    41      * Starts zooming In/out with slider/Keys
    41      * Recalculates the new TL and Dimension values for the viewport to be drawn after a new Zoom Operation
    42      * @ param aMfactor:The Zooming factor with which image has to be zoomed
    42      * @ param aZoomMode :          Are we Zooming In our out. Ignored when aExpectedZoomRatio 
       
    43      *                                      has a non zero value
       
    44      * @ param aExpectedZoomRatio : When we need zooming to a particular finite value. 
       
    45      *                                      Generally for Slider based zoom.
       
    46      * @ param aViewPortTopLeft:    The new TL location of the viewport after zooming
       
    47      * @ param aViewPortDimension:  The new dimensions of the viewport after zooming
       
    48      * @ param apThresholdReached : Optional parameter. If present, indicates whether we 
       
    49      *                                      have reached a limit while zooming. 
       
    50      * @ param apZoomFocus:         Optional parameter. If present, indicates the point 
       
    51      *                                      around wich zooming happens, (offcenter zoom)
       
    52      * @ param aRelativeZoomFactor: Percentage of zoom in relation to the previous value. 
       
    53      *                                      useful in pinch zoom. If this is greater than 0, 
       
    54      *                                      the first 2 parameters are ignored 
    43      */              
    55      */              
    44     TInt Zoom( TZoomMode aZoomMode,         // Ignored when aExpectedZoomRatio has a value 
    56     TInt Zoom( TZoomMode aZoomMode,         // Ignored when aExpectedZoomRatio has a value 
    45                 TInt aExpectedZoomRatio,    // only for slider based zoom. = 0 for key based zoom. 
    57                 TInt aExpectedZoomRatio,    // only for slider based zoom. = 0 for key based zoom. 
    46                 TPoint& aViewPortTopLeft, 
    58                 TPoint& aViewPortTopLeft, 
    47                 TSize& aViewPortDimension,
    59                 TSize& aViewPortDimension,
    48                 TBool* apThresholdReached = NULL,
    60                 TBool* apThresholdReached = NULL,
    49                 TPoint* apZoomFocus = NULL, 
    61                 TPoint* apZoomFocus = NULL, 
    50                 TInt aRelativeZoomFactor = 0);
    62                 TInt aRelativeZoomFactor = 0);
    51     
    63     
    52     // Initialize 
    64     /**
       
    65      * Initialize the Maths engine
       
    66      * @ param aCenter:         The center of the VP(View Port)
       
    67      * @ param aScreenSize:     Screensize of the device. 
       
    68      * @ param aImageSize:      Size of the image.
       
    69      * @ param aOriginalZoomedDimensions:The Original zoomed dimension.
       
    70      * @ param aInitialZoomRatio:Initial zoom ratio.
       
    71      */              
    53     void Initialize(TPoint& aCenter, 
    72     void Initialize(TPoint& aCenter, 
    54             TSize& aScreenSize, 
    73             TSize& aScreenSize, 
    55             TSize& aImageSize,
    74             TSize& aImageSize,
    56             TSize& aOriginalZoomedDimensions, 
    75             TSize& aOriginalZoomedDimensions, 
    57             TUint8 aInitialZoomRatio);
    76             TUint8 aInitialZoomRatio);
    58     
    77     
    59     void UpdatePanFactor(TTime& aPanTime);
    78     /**
       
    79      * UpdatePanFactor [Useful only in Key-based Panning]
       
    80      */              
       
    81     void UpdatePanFactor();
    60     
    82     
       
    83     /**
       
    84      * Indicates change of orientation. 
       
    85      * @ param aNewScreenRect: New Screen size
       
    86      */              
    61     // this can have a more generic name. but now it informs only abt screen orientation changes. and hence the name 
    87     // 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);
    88     void OrientationChanged(const TRect& aNewScreenRect);
    63     
    89     
       
    90     /**
       
    91      * Retrieves the Image Virtual Size
       
    92      */              
    64     TSize ImageVirtualSize();
    93     TSize ImageVirtualSize();
    65     
    94     
       
    95     /**
       
    96      * Retrieves the Image Virtual Size
       
    97      */              
    66     TSize ScreenSize();
    98     TSize ScreenSize();
    67     
    99     
    68     TInt NewCenterCoordinate(TInt Center, 
   100     /**
    69             TInt Offset, 
   101      * Retrieves the New Center Coordinate on one axis. 
    70             TUint16 HalfScreenDimension, 
   102      * Needs to be called twice for both axes.
    71             TInt MinimumCoordinate, 
   103      * @ param aCenter: The Center of the VP.
    72             TInt MaximumCoordinate, 
   104      * @ param aOffset: The offset along one axis if we have paned 
       
   105      * @ param aHalfScreenDimension: Half the screen dimension along this axis.
       
   106      * @ param aMinimumCoordinate: Minimum possible coordinate along this axis. Usually 0.
       
   107      * @ param aMaximumCoordinate: Maximum possible coordinate along this axis. 
       
   108      * @ param aLimitReached:   Indicates if we have reached a limit while zooming/Panning.
       
   109      */              
       
   110     TInt NewCenterCoordinate(TInt aCenter, 
       
   111             TInt aOffset, 
       
   112             TUint16 aHalfScreenDimension, 
       
   113             TInt aMinimumCoordinate, 
       
   114             TInt aMaximumCoordinate, 
    73             TBool *aLimitReached = NULL) ;
   115             TBool *aLimitReached = NULL) ;
    74     
   116     
       
   117     /**
       
   118      * Begin the pan operation
       
   119      */              
    75     void SetupPanOperation();
   120     void SetupPanOperation();
    76     
   121     
       
   122     /**
       
   123      * Retrieves the latest ofset by which we panned
       
   124      */              
    77     TPoint LastPanOffset();
   125     TPoint LastPanOffset();
    78 
   126 
       
   127     /**
       
   128      * Retrieves the minimum zoom ratio with which we stay in zoomode
       
   129      */              
       
   130     TInt MinimumZoomRatio();
       
   131     
    79 private:
   132 private:
    80 
   133 
    81     /**
   134     /**
    82      * Get the next Zoomlevel on the basis of Zoom In/Out
   135      * Get the next Zoomlevel on the basis of Zoom In/Out
    83      *  @ param aZoomMode:Specifies the zoomode,whether it is Zoom In/Out
   136      *  @ param aZoomMode:Specifies the zoomode,whether it is Zoom In/Out
   103     // No of continuous pan operations that have happened. This is used in calculating the pan factor  
   156     // No of continuous pan operations that have happened. This is used in calculating the pan factor  
   104     TInt            iContinuousPanOperations;
   157     TInt            iContinuousPanOperations;
   105                                                  
   158                                                  
   106     // These are the thresholds
   159     // These are the thresholds
   107     TUint8          iMaxZoomRatio;
   160     TUint8          iMaxZoomRatio;
   108     TUint8          iMinZoomRatio   ;
   161     TUint8          iMinZoomRatio;
   109     TSize           iInitialImageSize   ;
   162     TSize           iInitialImageSize;
   110 
   163 
   111     // This is what our current zoom ratio is in percentage
   164     // This is what our current zoom ratio is in percentage
   112     TReal						iZoomRatio;
   165     TReal           iZoomRatio;
   113     
   166     
   114     TPoint          iPanSpeed;          //  Pixels Panned per pan operation in vector form.  
       
   115     TPoint          iLastPanOffset;     //  Pixels Panned during the last pan operation.
   167     TPoint          iLastPanOffset;     //  Pixels Panned during the last pan operation.
   116     
   168     
   117     // [TODO]:Tsize might not be an exact match for this. using this only since it has exactly all the parameters that are required.   
   169     // [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;
   170     TSize           iBorderWidth;
   119 
   171