diff -r a60acebbbd9d -r 78ad99c24f08 photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h --- a/photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h Tue May 11 16:13:40 2010 +0300 +++ b/photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h Tue May 25 12:42:31 2010 +0300 @@ -38,8 +38,20 @@ TBool* aThresholdReached = NULL); /** - * Starts zooming In/out with slider/Keys - * @ param aMfactor:The Zooming factor with which image has to be zoomed + * Recalculates the new TL and Dimension values for the viewport to be drawn after a new Zoom Operation + * @ param aZoomMode : Are we Zooming In our out. Ignored when aExpectedZoomRatio + * has a non zero value + * @ param aExpectedZoomRatio : When we need zooming to a particular finite value. + * Generally for Slider based zoom. + * @ param aViewPortTopLeft: The new TL location of the viewport after zooming + * @ param aViewPortDimension: The new dimensions of the viewport after zooming + * @ param apThresholdReached : Optional parameter. If present, indicates whether we + * have reached a limit while zooming. + * @ param apZoomFocus: Optional parameter. If present, indicates the point + * around wich zooming happens, (offcenter zoom) + * @ param aRelativeZoomFactor: Percentage of zoom in relation to the previous value. + * useful in pinch zoom. If this is greater than 0, + * the first 2 parameters are ignored */ TInt Zoom( TZoomMode aZoomMode, // Ignored when aExpectedZoomRatio has a value TInt aExpectedZoomRatio, // only for slider based zoom. = 0 for key based zoom. @@ -49,33 +61,74 @@ TPoint* apZoomFocus = NULL, TInt aRelativeZoomFactor = 0); - // Initialize + /** + * Initialize the Maths engine + * @ param aCenter: The center of the VP(View Port) + * @ param aScreenSize: Screensize of the device. + * @ param aImageSize: Size of the image. + * @ param aOriginalZoomedDimensions:The Original zoomed dimension. + * @ param aInitialZoomRatio:Initial zoom ratio. + */ void Initialize(TPoint& aCenter, TSize& aScreenSize, TSize& aImageSize, TSize& aOriginalZoomedDimensions, TUint8 aInitialZoomRatio); - void UpdatePanFactor(TTime& aPanTime); + /** + * UpdatePanFactor [Useful only in Key-based Panning] + */ + void UpdatePanFactor(); + /** + * Indicates change of orientation. + * @ param aNewScreenRect: New Screen size + */ // this can have a more generic name. but now it informs only abt screen orientation changes. and hence the name void OrientationChanged(const TRect& aNewScreenRect); + /** + * Retrieves the Image Virtual Size + */ TSize ImageVirtualSize(); + /** + * Retrieves the Image Virtual Size + */ TSize ScreenSize(); - TInt NewCenterCoordinate(TInt Center, - TInt Offset, - TUint16 HalfScreenDimension, - TInt MinimumCoordinate, - TInt MaximumCoordinate, + /** + * Retrieves the New Center Coordinate on one axis. + * Needs to be called twice for both axes. + * @ param aCenter: The Center of the VP. + * @ param aOffset: The offset along one axis if we have paned + * @ param aHalfScreenDimension: Half the screen dimension along this axis. + * @ param aMinimumCoordinate: Minimum possible coordinate along this axis. Usually 0. + * @ param aMaximumCoordinate: Maximum possible coordinate along this axis. + * @ param aLimitReached: Indicates if we have reached a limit while zooming/Panning. + */ + TInt NewCenterCoordinate(TInt aCenter, + TInt aOffset, + TUint16 aHalfScreenDimension, + TInt aMinimumCoordinate, + TInt aMaximumCoordinate, TBool *aLimitReached = NULL) ; + /** + * Begin the pan operation + */ void SetupPanOperation(); + /** + * Retrieves the latest ofset by which we panned + */ TPoint LastPanOffset(); + /** + * Retrieves the minimum zoom ratio with which we stay in zoomode + */ + TInt MinimumZoomRatio(); + private: /** @@ -105,13 +158,12 @@ // These are the thresholds TUint8 iMaxZoomRatio; - TUint8 iMinZoomRatio ; - TSize iInitialImageSize ; + TUint8 iMinZoomRatio; + TSize iInitialImageSize; // This is what our current zoom ratio is in percentage - TReal iZoomRatio; + TReal iZoomRatio; - TPoint iPanSpeed; // Pixels Panned per pan operation in vector form. TPoint iLastPanOffset; // Pixels Panned during the last pan operation. // [TODO]:Tsize might not be an exact match for this. using this only since it has exactly all the parameters that are required.