com.vistech.imageviewer
Interface ImageDisplay

All Known Subinterfaces:
ImageManipulator
All Known Implementing Classes:
ImageCanvas

public interface ImageDisplay

Specifies methods that describe behavior of an image canvas. It has methods to set and get both the AWT Image and BufferedImage objects.

Version:
1.0 1 No 1999
Author:
Larry Rodrigues

Field Summary
static int TYPE_AWT_IMAGE
          Type AWT Image
static int TYPE_BUFFERED_IMAGE
          Type BufferedImage
 
Method Summary
 void addMouseListener(java.awt.event.MouseListener ml)
          Adds a mouse listener object.
 void addMouseMotionListener(java.awt.event.MouseMotionListener e)
          Adds a mouse motion listener object.
 void addPropertyChangeListener(java.beans.PropertyChangeListener pc)
          Adds a PropertyChangeListener object.
 void addVetoableChangeListener(java.beans.VetoableChangeListener vl)
          Adds a VetoableChangeListener object.
 void draw(java.awt.Shape shape)
          Draws the specified shape on the destination image
 java.awt.Image getAWTImage()
          Returns the image property.
 java.awt.image.BufferedImage getBufferedImage()
          Returns the BufferedImage property.
 java.awt.image.BufferedImage getDisplayedImage()
          Returns the image displayed on the canvas.
 int getDisplayMode()
          Returns the display mode.
 int getFlipMode()
          Returns the flip mode.
 java.awt.Dimension getImageSize()
          Returns the image size.
 int getImageType()
          Returns the image type property.
 boolean getInvert()
          Returns the invert mode.
 java.awt.image.BufferedImage getOffScreenImage()
          Returns the off screen image.
 boolean paintImage()
          This method paints the current image i.e.; the image set by the setImage() method.
 void removeMouseListener(java.awt.event.MouseListener ml)
          Removes a mouse listener object.
 void removeMouseMotionListener(java.awt.event.MouseMotionListener ml)
          Removes a mouse motion listener object.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pc)
          Removes a PropertyChangeListener object.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener vl)
          Removes a VetoableChangeListener object.
 void setAWTImage(java.awt.Image image)
          Sets the image property.
 void setBufferedImage(java.awt.image.BufferedImage image)
          Sets the BufferedImage property.
 void setClip(java.awt.Shape clipshape)
          Sets the clip shape on the destination image
 void setCursor(java.awt.Cursor cursor)
          Sets the cursor.
 void setDisplayImage(java.awt.image.BufferedImage image)
          Sets the image to be displayed on the canvas.
 void setDisplayMode(int dispMode)
          Sets the display mode.
 void setFlipMode(int flipMode)
          Sets the flip mode.
 void setImageType(int imageType)
          Sets the image type property.
 void setInvert(boolean onOrOff)
          Sets the invert mode property.
 void setOffScreenImage(java.awt.image.BufferedImage image)
          Sets the off screen image.
 

Field Detail

TYPE_AWT_IMAGE

public static final int TYPE_AWT_IMAGE
Type AWT Image

TYPE_BUFFERED_IMAGE

public static final int TYPE_BUFFERED_IMAGE
Type BufferedImage
Method Detail

setAWTImage

public void setAWTImage(java.awt.Image image)
Sets the image property. If the input parameter is not null, the it becomes the current image. This is a bound property.
Parameters:
image - the image object

getAWTImage

public java.awt.Image getAWTImage()
Returns the image property.
Returns:
the image object

getImageSize

public java.awt.Dimension getImageSize()
Returns the image size.
Returns:
the image size.

setBufferedImage

public void setBufferedImage(java.awt.image.BufferedImage image)
Sets the BufferedImage property. If the input parameter is not null, the it becomes the current image. This is a bound property.
Parameters:
BufferedImage - the image object

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Returns the BufferedImage property. If the image loaded is of Image type, this method creates a BufferedImage from the original image object.
Returns:
the BufferedImage object

setImageType

public void setImageType(int imageType)
Sets the image type property.
Parameters:
imageType - the image type.

getImageType

public int getImageType()
Returns the image type property.
Returns:
the image type.

setDisplayMode

public void setDisplayMode(int dispMode)
Sets the display mode. This is a bound property . The input parameter can be one of NORMAL, ORIG_SIZE, TO_FIT, SCALED. These constants are defined in the DisplayMode class. Call to this method would reset the viewport and the image is redarwn with new display mode.
Parameters:
dispMode - the display mode

getDisplayMode

public int getDisplayMode()
Returns the display mode.
Returns:
the current display mode.

setFlipMode

public void setFlipMode(int flipMode)
Sets the flip mode. This is a bound property . The input parameter can be one of NORMAL, LEFT_RIGHT, TOP_BOTTOM, LEFT_RIGHT_TOP_BOTTON. These constants are defined in the FlipMode class. Call to this method would reset the viewport and the image is redraw with new flip mode.
Parameters:
flipMode - the flip mode

getFlipMode

public int getFlipMode()
Returns the flip mode.
Returns:
the current flip mode.

setInvert

public void setInvert(boolean onOrOff)
Sets the invert mode property. It fires the propertyChange events because it is a bound property. If set true, it inverts the image.
Parameters:
onOrOff - the invert mode.

getInvert

public boolean getInvert()
Returns the invert mode.
Returns:
the invert mode

setOffScreenImage

public void setOffScreenImage(java.awt.image.BufferedImage image)
Sets the off screen image.
Parameters:
image - the off screen image.

getOffScreenImage

public java.awt.image.BufferedImage getOffScreenImage()
Returns the off screen image.
Returns:
the off screen imge.

setDisplayImage

public void setDisplayImage(java.awt.image.BufferedImage image)
Sets the image to be displayed on the canvas. When an image is set this way, it is not saved. This method needs to be used for temporory display only.The correct way to set the image is to call the setAWTImage() or setBufferedImage() methods.
Parameters:
image - the image to be displayed.

getDisplayedImage

public java.awt.image.BufferedImage getDisplayedImage()
Returns the image displayed on the canvas.
Returns:
the displayed imge.

paintImage

public boolean paintImage()
This method paints the current image i.e.; the image set by the setImage() method. While painting it applies the current display and flip mode policies. Call to this method will reset the panOffset and magFactor properties to default values. This method is called whenever the display and flip modes are changed.

addMouseListener

public void addMouseListener(java.awt.event.MouseListener ml)
Adds a mouse listener object.
Parameters:
ml - the MouseListener.

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener e)
Adds a mouse motion listener object.
Parameters:
ml - the MouseMotionListener.

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener ml)
Removes a mouse listener object.
Parameters:
ml - the MouseLister.

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener ml)
Removes a mouse motion listener object.
Parameters:
ml - the MouseMotionLister.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pc)
Adds a PropertyChangeListener object.
Parameters:
pc - the PropertyChangeListener object.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener vl)
Adds a VetoableChangeListener object.
Parameters:
vl - the VetoableChangeListener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pc)
Removes a PropertyChangeListener object.
Parameters:
pc - the PropertyChangeListener object.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener vl)
Removes a VetoableChangeListener object.
Parameters:
ml - the VetoableChangeListener object.

setCursor

public void setCursor(java.awt.Cursor cursor)
Sets the cursor.
Parameters:
cursor - the Cursor object.

setClip

public void setClip(java.awt.Shape clipshape)
Sets the clip shape on the destination image
Parameters:
clipshape - the shape of the clipping area

draw

public void draw(java.awt.Shape shape)
Draws the specified shape on the destination image
Parameters:
shape - the shape to be drawn