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

Field Summary
protected  ImageManipulator imageCanvas
           
protected  double lensMag
           
protected  boolean lensOn
           
protected  java.awt.Dimension lensSize
           
protected  double magIncrement
           
protected  java.awt.Point prevPoint
           
protected  int sizeIncrement
           
protected  Zoom zoom
           
 
Constructor Summary
Lens(ImageManipulator c)
           
 
Method Summary
 void decrementLensMag()
           
 void decrementLensSize()
           
 void drawLens(int x, int y)
          Draws an oval-shaped lens.
 double getLensMag()
           
 double getLensMagIncrement()
           
 boolean getLensOn()
           
 java.awt.Dimension getLensSize()
           
 int getLensSizeIncrement()
           
 void incrementLensMag()
           
 void incrementLensSize()
           
 void init()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void reset()
           
 void setLensMag(double mag)
           
 void setLensMagIncrement(int incr)
           
 void setLensOn(boolean onOff)
           
 void setLensSize(java.awt.Dimension d)
           
 void setLensSizeIncrement(int incr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

Lens

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

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