Class VJViewerCanvas

All Implemented Interfaces:
javax.accessibility.Accessible, java.lang.Cloneable, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class VJViewerCanvas
extends ij.gui.ImageCanvas

This class is an interactive rendering viewer. The GUI allows the rendering to be scaled and rotated using the mouse. Copyright (c) 2001-2003, Michael Abramoff. All rights reserved.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
Field Summary
protected  long clickTime
          Some practical variables
protected static int FINETHRESHOLD
protected  boolean mouseIsDown
protected static float PIXELSDEGREES
          Mouse motion (in pixels) that stands for a single radian in rotation.
protected  VJRenderViewInteractive renderView
          The rendering viewer
protected  int startMouseX
protected  int startMouseY
Fields inherited from class ij.gui.ImageCanvas
count, crosshairCursor, defaultCursor, firstFrame, fps, frames, handCursor, imageHeight, imageUpdated, imageWidth, imp, moveCursor, srcRect, usePointer, xMouse, yMouse
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
VJViewerCanvas(ij.ImagePlus imp)
          Create a new VJViewerCanvas for imp.
Method Summary
protected  float distanceToAngle(int dx)
          Compute the angle corresponding to a mouse motion (in pixels) dx.
 void effectDragging(int dx, int dy)
          User pressed mouse button, moved mouse, and released.
 void mousePressed(java.awt.event.MouseEvent e)
          Process a mouse button down event.
 void mouseReleased(java.awt.event.MouseEvent e)
          Process a mouse button up event.
 void setRenderView(VJRenderViewInteractive renderView)
          Set the VJRenderViewInteractive instance to process actions.
Methods inherited from class ij.gui.ImageCanvas
, canEnlarge, getColor, getCursorLoc, getHigherZoomLevel, getLowerZoomLevel, getMagnification, getModifiers, getPreferredSize, getSrcRect, handlePopupMenu, handleRoiMouseDown, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, offScreenX, offScreenY, paint, resizeCanvas, screenX, screenY, scroll, setCursor, setDrawingColor, setDrawingSize, setImageUpdated, setMagnification, setRoiModState, setupScroll, showFrameRate, unzoom, update, updateImage, zoomIn, zoomOut
Methods inherited from class java.awt.Canvas
addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


protected static final int FINETHRESHOLD


protected static final float PIXELSDEGREES
Mouse motion (in pixels) that stands for a single radian in rotation.


protected VJRenderViewInteractive renderView
The rendering viewer


protected long clickTime
Some practical variables


protected boolean mouseIsDown


protected int startMouseX


protected int startMouseY
Constructor Detail


public VJViewerCanvas(ij.ImagePlus imp)
Create a new VJViewerCanvas for imp.
imp - the ImagePlus for which this canvas will be created.
Method Detail


public void setRenderView(VJRenderViewInteractive renderView)
Set the VJRenderViewInteractive instance to process actions. This Instance is not yet available at the creation of this canvas.


public void effectDragging(int dx,
                           int dy)
User pressed mouse button, moved mouse, and released. Change the view and start rendering.


protected float distanceToAngle(int dx)
Compute the angle corresponding to a mouse motion (in pixels) dx. Correct so that small movements result in tiny rotation for fine control.
dx - the amount of pixels the mouse has moved.
the angle in degrees corresponding to dx.


public void mousePressed(java.awt.event.MouseEvent e)
Process a mouse button down event.
mousePressed in class ij.gui.ImageCanvas
e - the MouseEvent with the parameters.


public void mouseReleased(java.awt.event.MouseEvent e)
Process a mouse button up event. This is where the rendering will be redrawn
mouseReleased in class ij.gui.ImageCanvas
e - the MouseEvent with the parameters.