
/* @(#) ImageDisplay.java 1.1 99/01/11
 * Copyright (c) 1999 Lawrence Rodrigues
 */
package com.vistech.imageviewer;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
import java.beans.*;

/** 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
 */
public interface ImageDisplay {
    /** Type AWT Image */
    public static final int TYPE_AWT_IMAGE = 1;

    /** Type BufferedImage */
    public static final int TYPE_BUFFERED_IMAGE = 2;

    /** Sets the image property. If the input parameter is not null, the
      * it becomes the current image. This is a bound property.
      * @param image the image object
      */
    public void setAWTImage(Image image);

    /** Returns the image property.
      * @return the image object
      */
    public Image getAWTImage();

    /** Returns the image size.
     * @return the image size.
     */
    public Dimension getImageSize();

    /** Sets the BufferedImage property. If the input parameter is not null, the
      * it becomes the current image. This is a bound property.
      * @param BufferedImage the image object
      */
    public void setBufferedImage(BufferedImage image);

    /** Returns the BufferedImage property. If the image loaded is of Image type,
      * this method creates a BufferedImage from the original image object.
      * @return the BufferedImage object
      */
    public BufferedImage getBufferedImage();

    /** Sets the image type property.
      * @param imageType the image type.
      */
    public void setImageType(int imageType);

    /** Returns the image type property.
      * @return the image type.
      */
    public int getImageType();

    /** 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.
      * @param dispMode the display mode
      */
    public void setDisplayMode(int dispMode);

    /** Returns the display mode.
      * @return the current display mode.
      */
    public int getDisplayMode();

    /** 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.
      * @param flipMode the flip mode
      */
    public void setFlipMode(int flipMode);

    /** Returns the flip mode.
      * @return the current flip mode.
      */
    public int getFlipMode();

    /** Sets the invert mode property. It fires the propertyChange events because it
      * is a bound property. If set true, it inverts the image.
      * @param onOrOff the invert mode.
      */
    public void setInvert(boolean onOrOff);

    /** Returns the invert mode.
      * @return the invert mode
      */
    public boolean getInvert();

    /** Sets the off screen image.
      * @param image the off screen image.
      */
    public void setOffScreenImage(BufferedImage image);
    /** Returns the off screen image.
      * @return the off screen imge.
      */
    public BufferedImage getOffScreenImage();

    /** 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.
     * @param image the image to be displayed.
     */
    public void setDisplayImage(BufferedImage image);

    /** Returns the image displayed on the canvas.
      * @return the displayed imge.
      */
    public BufferedImage getDisplayedImage();

    /** 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.
      */
    public boolean paintImage();

    /** Adds a mouse listener object.
      * @param ml the MouseListener.
      */
    public void addMouseListener(MouseListener ml);

    /** Adds a mouse motion listener object.
      * @param ml the MouseMotionListener.
      */
    public void addMouseMotionListener(MouseMotionListener e);

    /** Removes a mouse listener object.
      * @param ml the MouseLister.
      */
    public void removeMouseListener(MouseListener ml);

    /** Removes a mouse motion listener object.
      * @param ml the MouseMotionLister.
      */
    public void removeMouseMotionListener(MouseMotionListener ml);

    /** Adds a PropertyChangeListener object.
      * @param pc the PropertyChangeListener object.
      */
    public void addPropertyChangeListener(PropertyChangeListener pc);

    /** Adds a VetoableChangeListener object.
      * @param vl the VetoableChangeListener.
      */
    public void addVetoableChangeListener(VetoableChangeListener vl);

    /** Removes a PropertyChangeListener object.
      * @param pc the PropertyChangeListener object.
      */
    public void removePropertyChangeListener(PropertyChangeListener pc);

    /** Removes a VetoableChangeListener object.
      * @param ml the VetoableChangeListener object.
      */
    public void removeVetoableChangeListener(VetoableChangeListener vl);

    /** Sets the cursor.
      * @param cursor the Cursor object.
      */
    public void setCursor(Cursor cursor);

    /** Sets the clip shape on the destination image
      * @param clipshape the shape of the clipping area
      */
    public void setClip(Shape clipshape);

    /** Draws the specified shape on the destination image
      * @param shape the shape to be drawn
      */
    public void draw(Shape shape);
}
