ij.gui
Class ImageCanvas
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Canvas
-
- ij.gui.ImageCanvas
-
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible
- Direct Known Subclasses:
- PlotCanvas
public class ImageCanvas extends java.awt.Canvas implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.lang.CloneableThis is a Canvas used to display images in a Window.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static booleanusePointer
-
Constructor Summary
Constructors Constructor and Description ImageCanvas(ImagePlus imp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description booleancursorOverImage()Returns 'true' if the cursor is over this image.voiddisablePopupMenu(boolean status)Disable/enable popup menu.voidfitToWindow()java.awt.PointgetCursorLoc()Returns the current cursor location in image coordinates.booleangetCustomRoi()java.util.VectorgetDisplayList()Deprecated.replaced by ImagePlus.getOverlay()static doublegetHigherZoomLevel(double currentMag)ImagePlusgetImage()Returns the ImagePlus object that is associated with this ImageCanvas.static doublegetLowerZoomLevel(double currentMag)doublegetMagnification()intgetModifiers()Returns the mouse event modifiers.OverlaygetOverlay()Use ImagePlus.getOverlay().booleangetPaintPending()java.awt.DimensiongetPreferredSize()booleangetScaleToFit()static java.awt.ColorgetShowAllColor()ObsoleteOverlaygetShowAllList()booleangetShowAllROIs()ObsoleteintgetSliceNumber(java.lang.String label)java.awt.RectanglegetSrcRect()booleanhideZoomIndicator(boolean hide)voidmouseClicked(java.awt.event.MouseEvent e)voidmouseDragged(java.awt.event.MouseEvent e)voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)intoffScreenX(int sx)Converts a screen x-coordinate to an offscreen x-coordinate.doubleoffScreenXD(int sx)Converts a screen x-coordinate to a floating-point offscreen x-coordinate.intoffScreenY(int sy)Converts a screen y-coordinate to an offscreen y-coordinate.doubleoffScreenYD(int sy)Converts a screen y-coordinate to a floating-point offscreen y-coordinate.voidpaint(java.awt.Graphics g)voidresetDoubleBuffer()booleanroiManagerSelect(Roi roi, boolean delete)intscreenX(int ox)Converts an offscreen x-coordinate to a screen x-coordinate.intscreenXD(double ox)Converts a floating-point offscreen x-coordinate to a screen x-coordinate.intscreenY(int oy)Converts an offscreen y-coordinate to a screen y-coordinate.intscreenYD(double oy)Converts a floating-point offscreen x-coordinate to a screen x-coordinate.static voidsetCursor(java.awt.Cursor cursor, int type)ExperimentalvoidsetCursor(int sx, int sy, int ox, int oy)Sets the cursor based on the current tool and cursor location.voidsetCustomRoi(boolean customRoi)Allows plugins (e.g., Orthogonal_Views) to create a custom ROI using a display list.voidsetDisplayList(Roi roi, java.awt.Color color)Deprecated.replaced by ImagePlus.setOverlay(Roi, Color, int, Color)voidsetDisplayList(java.awt.Shape shape, java.awt.Color color, java.awt.BasicStroke stroke)Deprecated.replaced by ImagePlus.setOverlay(Shape, Color, BasicStroke)voidsetDisplayList(java.util.Vector list)Deprecated.replaced by ImagePlus.setOverlay(ij.gui.Overlay)voidsetDrawingColor(int ox, int oy, boolean setBackground)Sets the foreground drawing color (or background color if 'setBackground' is true) to the color of the pixel at (ox,oy).voidsetDrawingSize(int width, int height)Obsolete; replaced by setSize()voidsetImageUpdated()ImagePlus.updateAndDraw calls this method to force the paint() method to update the image from the ImageProcessor.voidsetMagnification(double magnification)voidsetOverlay(Overlay overlay)Use ImagePlus.setOverlay(ij.gui.Overlay).voidsetPaintPending(boolean state)voidsetScaleToFit(boolean scaleToFit)static voidsetShowAllColor(java.awt.Color c)ObsoletevoidsetShowAllList(Overlay showAllList)voidsetShowAllROIs(boolean showAllROIs)ObsoletevoidsetShowCursorStatus(boolean status)Called by IJ.showStatus() to prevent status bar text from being overwritten until the cursor moves at least 12 pixels.voidsetSize(int width, int height)voidsetSourceRect(java.awt.Rectangle r)Sets the region of the image (in pixels) to be displayed.voidunzoom()Implements the Image/Zoom/Original Scale command.voidupdate(java.awt.Graphics g)voidzoom100Percent()Implements the Image/Zoom/View 100% command.voidzoomIn(int sx, int sy)Zooms in by making the window bigger.voidzoomOut(int sx, int sy)Zooms out by making the source rectangle (srcRect) larger and centering it on (x,y).-
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, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, 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, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
-
-
-
Constructor Detail
-
ImageCanvas
public ImageCanvas(ImagePlus imp)
-
-
Method Detail
-
setSourceRect
public void setSourceRect(java.awt.Rectangle r)
Sets the region of the image (in pixels) to be displayed.
-
getSrcRect
public java.awt.Rectangle getSrcRect()
-
setDrawingSize
public void setDrawingSize(int width, int height)Obsolete; replaced by setSize()
-
setSize
public void setSize(int width, int height)- Overrides:
setSizein classjava.awt.Component
-
setImageUpdated
public void setImageUpdated()
ImagePlus.updateAndDraw calls this method to force the paint() method to update the image from the ImageProcessor.
-
setPaintPending
public void setPaintPending(boolean state)
-
getPaintPending
public boolean getPaintPending()
-
update
public void update(java.awt.Graphics g)
- Overrides:
updatein classjava.awt.Canvas
-
paint
public void paint(java.awt.Graphics g)
- Overrides:
paintin classjava.awt.Canvas
-
getSliceNumber
public int getSliceNumber(java.lang.String label)
-
resetDoubleBuffer
public void resetDoubleBuffer()
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSizein classjava.awt.Component
-
getCursorLoc
public java.awt.Point getCursorLoc()
Returns the current cursor location in image coordinates.
-
cursorOverImage
public boolean cursorOverImage()
Returns 'true' if the cursor is over this image.
-
getModifiers
public int getModifiers()
Returns the mouse event modifiers.
-
getImage
public ImagePlus getImage()
Returns the ImagePlus object that is associated with this ImageCanvas.
-
setCursor
public void setCursor(int sx, int sy, int ox, int oy)Sets the cursor based on the current tool and cursor location.
-
offScreenX
public int offScreenX(int sx)
Converts a screen x-coordinate to an offscreen x-coordinate.
-
offScreenY
public int offScreenY(int sy)
Converts a screen y-coordinate to an offscreen y-coordinate.
-
offScreenXD
public double offScreenXD(int sx)
Converts a screen x-coordinate to a floating-point offscreen x-coordinate.
-
offScreenYD
public double offScreenYD(int sy)
Converts a screen y-coordinate to a floating-point offscreen y-coordinate.
-
screenX
public int screenX(int ox)
Converts an offscreen x-coordinate to a screen x-coordinate.
-
screenY
public int screenY(int oy)
Converts an offscreen y-coordinate to a screen y-coordinate.
-
screenXD
public int screenXD(double ox)
Converts a floating-point offscreen x-coordinate to a screen x-coordinate.
-
screenYD
public int screenYD(double oy)
Converts a floating-point offscreen x-coordinate to a screen x-coordinate.
-
getMagnification
public double getMagnification()
-
setMagnification
public void setMagnification(double magnification)
-
fitToWindow
public void fitToWindow()
-
getLowerZoomLevel
public static double getLowerZoomLevel(double currentMag)
-
getHigherZoomLevel
public static double getHigherZoomLevel(double currentMag)
-
zoomIn
public void zoomIn(int sx, int sy)Zooms in by making the window bigger. If it can't be made bigger, then makes the source rectangle (srcRect) smaller and centers it on the position in the image where the cursor was when zooming has started. Note that sx and sy are screen coordinates.
-
zoomOut
public void zoomOut(int sx, int sy)Zooms out by making the source rectangle (srcRect) larger and centering it on (x,y). If we can't make it larger, then make the window smaller. Note that sx and sy are screen coordinates.
-
unzoom
public void unzoom()
Implements the Image/Zoom/Original Scale command.
-
zoom100Percent
public void zoom100Percent()
Implements the Image/Zoom/View 100% command.
-
setDrawingColor
public void setDrawingColor(int ox, int oy, boolean setBackground)Sets the foreground drawing color (or background color if 'setBackground' is true) to the color of the pixel at (ox,oy).
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
disablePopupMenu
public void disablePopupMenu(boolean status)
Disable/enable popup menu.
-
setShowAllList
public void setShowAllList(Overlay showAllList)
-
getShowAllList
public Overlay getShowAllList()
-
setShowAllROIs
public void setShowAllROIs(boolean showAllROIs)
Obsolete
-
getShowAllROIs
public boolean getShowAllROIs()
Obsolete
-
getShowAllColor
public static java.awt.Color getShowAllColor()
Obsolete
-
setShowAllColor
public static void setShowAllColor(java.awt.Color c)
Obsolete
-
setCursor
public static void setCursor(java.awt.Cursor cursor, int type)Experimental
-
setOverlay
public void setOverlay(Overlay overlay)
Use ImagePlus.setOverlay(ij.gui.Overlay).
-
getOverlay
public Overlay getOverlay()
Use ImagePlus.getOverlay().
-
setDisplayList
public void setDisplayList(java.util.Vector list)
Deprecated. replaced by ImagePlus.setOverlay(ij.gui.Overlay)
-
setDisplayList
public void setDisplayList(java.awt.Shape shape, java.awt.Color color, java.awt.BasicStroke stroke)Deprecated. replaced by ImagePlus.setOverlay(Shape, Color, BasicStroke)
-
setDisplayList
public void setDisplayList(Roi roi, java.awt.Color color)
Deprecated. replaced by ImagePlus.setOverlay(Roi, Color, int, Color)
-
getDisplayList
public java.util.Vector getDisplayList()
Deprecated. replaced by ImagePlus.getOverlay()
-
setCustomRoi
public void setCustomRoi(boolean customRoi)
Allows plugins (e.g., Orthogonal_Views) to create a custom ROI using a display list.
-
getCustomRoi
public boolean getCustomRoi()
-
setShowCursorStatus
public void setShowCursorStatus(boolean status)
Called by IJ.showStatus() to prevent status bar text from being overwritten until the cursor moves at least 12 pixels.
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
roiManagerSelect
public boolean roiManagerSelect(Roi roi, boolean delete)
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
setScaleToFit
public void setScaleToFit(boolean scaleToFit)
-
getScaleToFit
public boolean getScaleToFit()
-
hideZoomIndicator
public boolean hideZoomIndicator(boolean hide)
-
-
DMelt 3.0 © DataMelt by jWork.ORG