jm.jigl
Class ImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--jm.jigl.ImageCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ImageCanvas
extends java.awt.Canvas

ImageCanvas is a class made to facilitate the displaying of a JIGL image

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 boolean box_draw
          Used as a toggle on the ImageCanvas
protected  java.awt.Image image
          Java image
protected  Image jimage
          JIGL image
 boolean mouse_clicked
          Used as a toggle on the ImageCanvas
 int mouselx
          Lower x corner of the selection box
 int mousely
          Lower y corner of the selection box
 int mouseux
          Upper x corner of the selection box
 int mouseuy
          Upper y corner of the selection box
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageCanvas()
          Creates an empty ImageCanvas
ImageCanvas(ComplexImage img)
          Creates an ImageCanvas from a ComplexImage
ImageCanvas(GrayImage img)
          Creates an ImageCanvas from a GrayImage
ImageCanvas(Image img)
          Creates an ImageCanvas from a JIGL Image
ImageCanvas(RealGrayImage img)
          Creates an ImageCanvas from a RealGrayImage
ImageCanvas(java.lang.String fname)
          Creates an ImageCanvas from a file
 
Method Summary
 Image getImage()
          Returns the JIGL image
 java.awt.Image getImageFromFile(java.lang.String fname)
          Gets a JIGL image from a file.
 java.awt.Image getJavaImage()
          Returns the Java image
 java.awt.Image getJavaImage(Image img)
          Takes a jigl image as input, converts it to a java image, and returns the java image.
 int imHeight()
          Returns the image height
 int imWidth()
          Returns the image width
 void paint(java.awt.Graphics g)
          Overrides the paint method for smoother redraw
 void setDrawBox(boolean value)
          Sets the drawing of the Region of Interest box to true or false
 void setImage(java.awt.Image img)
          Sets the JIGL image to img and Java Image to null
 void setImage(Image img)
          Sets the JIGL Image and Java Image to img
 java.awt.Graphics setOffScreen()
          Returns an instance of Graphics that, when modified, modifies the Java image
 java.awt.Graphics setOffScreen(double xfactor, double yfactor)
          Returns an instance of Graphics that, when modified, modifies the Java image
 void setVisible(boolean b)
          Overrides Component.setVisible(boolean)
 void update(java.awt.Graphics g)
          Repaints the ImageCanvas (including the selection box).
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

image

protected java.awt.Image image
Java image


jimage

protected Image jimage
JIGL image


mouseux

public int mouseux
Upper x corner of the selection box


mouseuy

public int mouseuy
Upper y corner of the selection box


mouselx

public int mouselx
Lower x corner of the selection box


mousely

public int mousely
Lower y corner of the selection box


mouse_clicked

public boolean mouse_clicked
Used as a toggle on the ImageCanvas


box_draw

public boolean box_draw
Used as a toggle on the ImageCanvas

Constructor Detail

ImageCanvas

public ImageCanvas()
Creates an empty ImageCanvas


ImageCanvas

public ImageCanvas(java.lang.String fname)
            throws FileExtensionNotSupportedException,
                   BadImageException,
                   IllegalPBMFormatException,
                   java.lang.InterruptedException,
                   ImageNotSupportedException,
                   java.io.FileNotFoundException,
                   java.io.IOException
Creates an ImageCanvas from a file

Parameters:
fname - filename

ImageCanvas

public ImageCanvas(GrayImage img)
            throws BadImageException
Creates an ImageCanvas from a GrayImage

Parameters:
img - GrayImage

ImageCanvas

public ImageCanvas(RealGrayImage img)
            throws BadImageException
Creates an ImageCanvas from a RealGrayImage

Parameters:
img - RealGrayImage

ImageCanvas

public ImageCanvas(ComplexImage img)
            throws BadImageException
Creates an ImageCanvas from a ComplexImage

Parameters:
img - CpmplexImage

ImageCanvas

public ImageCanvas(Image img)
            throws BadImageException
Creates an ImageCanvas from a JIGL Image

Parameters:
img - JIGL Image
Method Detail

setDrawBox

public void setDrawBox(boolean value)
Sets the drawing of the Region of Interest box to true or false

Parameters:
value - sets the drawing of an xor box to true or false

setImage

public void setImage(java.awt.Image img)
Sets the JIGL image to img and Java Image to null


setImage

public void setImage(Image img)
              throws BadImageException
Sets the JIGL Image and Java Image to img

BadImageException

getImage

public Image getImage()
Returns the JIGL image


getJavaImage

public java.awt.Image getJavaImage()
Returns the Java image


setOffScreen

public java.awt.Graphics setOffScreen()
Returns an instance of Graphics that, when modified, modifies the Java image


setOffScreen

public java.awt.Graphics setOffScreen(double xfactor,
                                      double yfactor)
Returns an instance of Graphics that, when modified, modifies the Java image

Parameters:
xfactor - zoom of x axis
yfactor - zoom of y axis

setVisible

public void setVisible(boolean b)
Overrides Component.setVisible(boolean)

Overrides:
setVisible in class java.awt.Component

imHeight

public int imHeight()
Returns the image height


imWidth

public int imWidth()
Returns the image width


getJavaImage

public java.awt.Image getJavaImage(Image img)
                            throws BadImageException,
                                   java.lang.RuntimeException
Takes a jigl image as input, converts it to a java image, and returns the java image.

Parameters:
img - the JIGL image
BadImageException
java.lang.RuntimeException

getImageFromFile

public java.awt.Image getImageFromFile(java.lang.String fname)
                                throws FileExtensionNotSupportedException,
                                       BadImageException,
                                       IllegalPBMFormatException,
                                       java.lang.InterruptedException,
                                       ImageNotSupportedException,
                                       java.io.IOException,
                                       java.io.FileNotFoundException
Gets a JIGL image from a file. This currently supports Java files (.gif, .jpg), and PPM files (.ppm, .pgm, .pbm). The file extension must be one of the above, or it won't look at it.

Parameters:
fname - filename
FileExtensionNotSupportedException
BadImageException
IllegalPBMFormatException
java.lang.InterruptedException
ImageNotSupportedException
java.io.IOException
java.io.FileNotFoundException

update

public void update(java.awt.Graphics g)
Repaints the ImageCanvas (including the selection box). If drawBox is set to true then it will also draw the region of interest.

Overrides:
update in class java.awt.Canvas

paint

public void paint(java.awt.Graphics g)
Overrides the paint method for smoother redraw

Overrides:
paint in class java.awt.Canvas