com.vistech.imageviewer
Class Lens
java.lang.Object
|
+--com.vistech.imageviewer.Lens
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
- public class Lens
- extends java.lang.Object
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Implements a lens that can be interactively moved over an image drawn on a canvas.
The Lens class has several properties to set the attributes of the movable lens.
These include the lense size and the magnification factor. This class uses the Zoom class for
magnifying portion of displayed image covered under the lens.
- Version:
- 1.0 1 Dec 1999
- Author:
- Lawrence Rodrigues
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
imageCanvas
protected ImageManipulator imageCanvas
lensSize
protected java.awt.Dimension lensSize
prevPoint
protected java.awt.Point prevPoint
lensOn
protected boolean lensOn
sizeIncrement
protected int sizeIncrement
magIncrement
protected double magIncrement
lensMag
protected double lensMag
zoom
protected Zoom zoom
Lens
public Lens(ImageManipulator c)
- Parameters:
imagecanvas
- the component on which the image is drawn.
init
public void init()
setLensSize
public void setLensSize(java.awt.Dimension d)
getLensSize
public java.awt.Dimension getLensSize()
setLensMag
public void setLensMag(double mag)
getLensMag
public double getLensMag()
setLensMagIncrement
public void setLensMagIncrement(int incr)
getLensMagIncrement
public double getLensMagIncrement()
setLensSizeIncrement
public void setLensSizeIncrement(int incr)
getLensSizeIncrement
public int getLensSizeIncrement()
setLensOn
public void setLensOn(boolean onOff)
getLensOn
public boolean getLensOn()
drawLens
public void drawLens(int x,
int y)
- Draws an oval-shaped lens.
- Parameters:
the
- x coordinate of the lens center.the
- y coordinate of the lens center.
incrementLensSize
public void incrementLensSize()
decrementLensSize
public void decrementLensSize()
incrementLensMag
public void incrementLensMag()
decrementLensMag
public void decrementLensMag()
reset
public void reset()
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener