com.vistech.imageviewer
Class Zoom
java.lang.Object
|
+--com.vistech.imageviewer.Zoom
- All Implemented Interfaces:
- java.io.Serializable, ZoomController
- public class Zoom
- extends java.lang.Object
- implements ZoomController, java.io.Serializable
Zooms an image displayed on a canvas.
The canvas object must implement the ImageManipulator interface.
- Version:
- 1.0 18 Nov 1999
- Author:
- Lawrence Rodrigues
- See Also:
- Serialized Form
|
Method Summary |
void |
applyTransform(java.awt.geom.AffineTransform atx)
|
double |
getMagFactor()
Gets the magFactor property. |
double |
getMagFactorX()
|
double |
getMagFactorY()
|
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 |
magnify(int magCenterX,
int magCenterY,
double magFacX,
double magFacY)
|
void |
paintImage(int magCenterX,
int magCenterY,
double mag)
This method magnifies the image with (magCenterX, magCenterY) as the
center of magnification. |
void |
paintImage(int magCenterX,
int magCenterY,
double magX,
double magY)
|
void |
reset()
|
void |
resetAndScale(double magOffsetX,
double magOffsetY,
double magX,
double magY)
|
void |
scale(double magOffsetX,
double magOffsetY,
double magX,
double magY)
|
void |
setImageManipulator(ImageManipulator imageCanvas)
|
void |
setMagFactor(double magFactor)
Sets the magFactor property. |
void |
setMagFactorX(double magFactorX)
|
void |
setMagFactorY(double magFactorY)
|
void |
setMagOn(boolean onOff)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
atx
protected java.awt.geom.AffineTransform atx
magOn
protected boolean magOn
magFactor
protected double magFactor
magFactorX
protected double magFactorX
magFactorY
protected double magFactorY
magCenterX
protected int magCenterX
magCenterY
protected int magCenterY
zoomOffset
protected java.awt.Point zoomOffset
imageCanvas
protected ImageManipulator imageCanvas
Zoom
public Zoom()
Zoom
public Zoom(ImageManipulator imageCanvas)
- Parameters:
imagecanvas - the component on which the image is drawn.
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.
setMagFactorX
public void setMagFactorX(double magFactorX)
setMagFactorY
public void setMagFactorY(double magFactorY)
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.
getMagFactorX
public double getMagFactorX()
getMagFactorY
public double getMagFactorY()
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.
magnify
public void magnify(int magCenterX,
int magCenterY,
double magFacX,
double magFacY)
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.
paintImage
public void paintImage(int magCenterX,
int magCenterY,
double magX,
double magY)
scale
public void scale(double magOffsetX,
double magOffsetY,
double magX,
double magY)
resetAndScale
public void resetAndScale(double magOffsetX,
double magOffsetY,
double magX,
double magY)
applyTransform
public void applyTransform(java.awt.geom.AffineTransform atx)
reset
public void reset()