com.vistech.imageviewer
Class Zoom

java.lang.Object
  |
  +--com.vistech.imageviewer.Zoom
All Implemented Interfaces:
ZoomController

public class Zoom
extends java.lang.Object
implements ZoomController

Zooms an image displayed on a canvas. The canvas object must implement the ImageManipulator interface.

Version:
1.0 18 Nov 1999
Author:
Lawrence Rodrigues

Field Summary
protected  java.awt.geom.AffineTransform atx
           
protected  ImageManipulator imageCanvas
           
protected  int magCenterX
           
protected  int magCenterY
           
protected  double magFactor
           
protected  boolean magOn
           
protected  java.awt.Point zoomOffset
           
 
Constructor Summary
Zoom()
           
Zoom(ImageManipulator imageCanvas)
           
 
Method Summary
 void applyTransform(java.awt.geom.AffineTransform atx)
           
 double getMagFactor()
          Gets the magFactor property.
 boolean getMagOn()
           
 void magnify(int magCenterX, int magCenterY)
          This method magnifies the image with (magCenterX, magCenterY) as the center of magnification.
 void magnify(int magCenterX, int magCenterY, double magFac)
          This method magnifies the image by mag with (magCenterX, magCenterY) as the center of magnification.
 void paintImage(int magCenterX, int magCenterY, double mag)
          This method magnifies the image with (magCenterX, magCenterY) as the center of magnification.
 void reset()
           
 void resetAndScale(double magOffsetX, double magOffsetY, double mag)
           
 void scale(double magOffsetX, double magOffsetY, double mag)
           
 void setImageManipulator(ImageManipulator imageCanvas)
           
 void setMagFactor(double magFactor)
          Sets the magFactor property.
 void setMagOn(boolean onOff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atx

protected java.awt.geom.AffineTransform atx

magOn

protected boolean magOn

magFactor

protected double magFactor

magCenterX

protected int magCenterX

magCenterY

protected int magCenterY

zoomOffset

protected java.awt.Point zoomOffset

imageCanvas

protected ImageManipulator imageCanvas
Constructor Detail

Zoom

public Zoom()

Zoom

public Zoom(ImageManipulator imageCanvas)
Parameters:
imagecanvas - the component on which the image is drawn.
Method Detail

setImageManipulator

public void setImageManipulator(ImageManipulator imageCanvas)
Parameters:
imagecanvas - the component on which the image is drawn.

setMagOn

public void setMagOn(boolean onOff)

getMagOn

public boolean getMagOn()

setMagFactor

public void setMagFactor(double magFactor)
Description copied from interface: ZoomController
Sets the magFactor property.
Specified by:
setMagFactor in interface ZoomController
Following copied from interface: com.vistech.imageviewer.ZoomController
Parameters:
magFactor - the magnification factor.

getMagFactor

public double getMagFactor()
Description copied from interface: ZoomController
Gets the magFactor property.
Specified by:
getMagFactor in interface ZoomController
Following copied from interface: com.vistech.imageviewer.ZoomController
Returns:
the magFactor.

magnify

public void magnify(int magCenterX,
                    int magCenterY)
Description copied from interface: ZoomController
This method magnifies the image with (magCenterX, magCenterY) as the center of magnification. The mag value is obtained from the magFactor property.
Specified by:
magnify in interface ZoomController
Following copied from interface: com.vistech.imageviewer.ZoomController
Parameters:
magCenterX - the x coordiante of the mag center.
magCenterY - the y coordiante of the mag center.

magnify

public void magnify(int magCenterX,
                    int magCenterY,
                    double magFac)
Description copied from interface: ZoomController
This method magnifies the image by mag with (magCenterX, magCenterY) as the center of magnification. As a side effect, the magFactor property is set to mag.
Specified by:
magnify in interface ZoomController
Following copied from interface: com.vistech.imageviewer.ZoomController
Parameters:
magCenterX - the x coordiante of the mag center.
magCenterY - the y coordiante of the mag center.
mag - the mag factor.

paintImage

public void paintImage(int magCenterX,
                       int magCenterY,
                       double mag)
Description copied from interface: ZoomController
This method magnifies the image with (magCenterX, magCenterY) as the center of magnification. As a side effect, the magFactor is set to mag. The magnified image becomes the new current image. Subsequent calls to this method will magnify this current image. The difference between magnify() and this method is that magnify() doesnot change the current image. This means that subsequent calls to magnify() will produce the same result if it is invoked with the same arguments. On the other hand, subsequent calls to paintImage() with the same mag value will result in "zoom in" or "zoom out" depending on whether the mag is greater or less than 1.0.
Specified by:
paintImage in interface ZoomController
Following copied from interface: com.vistech.imageviewer.ZoomController
Parameters:
magCenterX - the x coordiante of the mag center.
magCenterY - the y coordiante of the mag center.
mag - the mag factor.

scale

public void scale(double magOffsetX,
                  double magOffsetY,
                  double mag)

resetAndScale

public void resetAndScale(double magOffsetX,
                          double magOffsetY,
                          double mag)

applyTransform

public void applyTransform(java.awt.geom.AffineTransform atx)

reset

public void reset()