public final class DisplayCanvas extends ImageCanvas implements KeyListener, MouseWheelListener
Modifier and Type | Class and Description |
---|---|
protected class |
DisplayCanvas.RepaintProperties |
class |
DisplayCanvas.Screenshot |
protected class |
DisplayCanvas.ScreenshotProperties |
Canvas.AccessibleAWTCanvas
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected static AffineTransform |
DEFAULT_AFFINE |
protected static BasicStroke |
DEFAULT_STROKE
Paints a handle on the offscreen x,y.
|
protected Point |
last_popup
In world coordinates.
|
crosshairCursor, defaultCursor, dstHeight, dstWidth, flags, handCursor, ij, imageHeight, imageUpdated, imageWidth, imp, lastZoomSX, lastZoomSY, magnification, MAX_MOUSEMOVE_ZOOM, moveCursor, srcRect, usePointer, xMouse, xMouseStart, xSrcStart, yMouse, yMouseStart, ySrcStart, zoomTargetOX, zoomTargetOY
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DisplayCanvas(Display display,
int width,
int height) |
Modifier and Type | Method and Description |
---|---|
void |
adjustDimensions()
Adjust srcRect and internal variables to the canvas' bounds.
|
void |
adjustSrcRect(int new_width,
int new_height)
Adjust srcRect to new dimensions.
|
protected void |
animateBrowsing(int dx,
int dy)
Smoothly move the canvas from x0,y0,layer0 to x1,y1,layer1
|
boolean |
animateBrowsing(Rectangle target_,
Layer target_layer)
Smoothly move the canvas from its current position until the given rectangle is included within the srcRect.
|
boolean |
applyTransform() |
void |
cancelTransform() |
void |
center(Rectangle r,
double magn)
Show the given r as the srcRect (or as much of it as possible) at the given magnification.
|
protected Point |
consumeLastPopupPoint() |
void |
destroy() |
static void |
drawHandle(Graphics2D g,
double x,
double y,
Rectangle srcRect,
double magnification) |
static void |
drawHandle(Graphics g,
int x,
int y,
double magnification)
Paints a handle on the screen coords.
|
static void |
drawScreenHandle(Graphics g,
int x,
int y)
Paints a handle at x,y screen coords.
|
void |
flush()
Release offscreen images and stop threads.
|
Display |
getDisplay() |
List<Displayable> |
getDisplayablesUnderMouse()
|
List<Displayable> |
getDisplayablesUnderMouse(MouseEvent me)
Return the list of Displayable objects under the mouse,
sorted by proper stack order.
|
ij.ImagePlus |
getFakeImagePlus()
CAREFUL: the ImageProcessor of the returned ImagePlus is fake, that is, a 4x4 byte array; but the dimensions that it returns are those of the host LayerSet.
|
protected double |
getHigherZoomLevel2(double currentMag) |
protected double |
getLowerZoomLevel2(double currentMag)
Enable zooming out up to the point where the display becomes 10 pixels in width or height.
|
void |
handlePopupMenu()
Overriding to disable it.
|
protected void |
invalidateVolatile() |
boolean |
isDragging() |
boolean |
isInputEnabled() |
boolean |
isTransforming() |
void |
keyPressed(KeyEvent ke) |
void |
keyReleased(KeyEvent ke) |
void |
keyTyped(KeyEvent ke) |
void |
mouseDragged(MouseEvent me) |
void |
mouseEntered(MouseEvent me) |
void |
mouseExited(MouseEvent me) |
void |
mouseMoved(MouseEvent me) |
void |
mousePressed(MouseEvent me) |
void |
mouseReleased(MouseEvent me) |
void |
mouseWheelMoved(MouseWheelEvent mwe)
Key/Mouse bindings like:
- ij.gui.StackWindow: wheel to scroll slices (in this case Layers)
- Inkscape: control+wheel to zoom (apple+wheel in macosx, since control+wheel zooms desktop)
|
void |
paint(Graphics g) |
BufferedImage |
paintOffscreen(Layer active_layer,
int g_width,
int g_height,
Rectangle srcRect,
double magnification,
Displayable active,
int c_alphas,
Rectangle clipRect,
Loader loader,
HashMap<Color,Layer> hm,
ArrayList<LayerPanel> blending_list,
int mode,
GraphicsSource graphics_source,
boolean prepaint,
ArrayList<Displayable> al_top)
Deprecated.
|
BufferedImage |
paintOffscreen(Layer active_layer,
List<Layer> layers,
ArrayList<Displayable> al_paint,
Displayable active,
int g_width,
int g_height,
int c_alphas,
Loader loader,
HashMap<Color,Layer> hm,
ArrayList<LayerPanel> blending_list,
int mode,
GraphicsSource graphics_source,
boolean prepaint,
int first_non_patch) |
BufferedImage |
paintOffscreen(Layer active_layer,
List<Layer> layers,
int g_width,
int g_height,
Rectangle srcRect,
double magnification,
Displayable active,
int c_alphas,
Rectangle clipRect,
Loader loader,
HashMap<Color,Layer> hm,
ArrayList<LayerPanel> blending_list,
int mode,
GraphicsSource graphics_source,
boolean prepaint,
ArrayList<Displayable> al_top,
boolean preload)
This method uses data only from the arguments, and changes none.
|
void |
repaint()
Overridden to multithread.
|
void |
repaint(boolean update_graphics)
Repaint everything, updating offscreen graphics if so specified.
|
void |
repaint(Displayable d)
Repaint as much as the bounding box around the given Displayable.
|
void |
repaint(Displayable displ,
int extra)
Repaint as much as the bounding box around the given Displayable plus the
extra padding.
|
void |
repaint(Displayable displ,
int extra,
boolean update_graphics) |
void |
repaint(HashSet<Displayable> hs)
Repaint the clip corresponding to the sum of all boundingboxes of
Displayable objects in the hashset.
|
void |
repaint(int x,
int y,
int width,
int height)
Overridden to multithread.
|
void |
repaint(Rectangle r,
int extra)
Repaint the given offscreen Rectangle after transforming its data on the fly to the
srcRect and magnification of this DisplayCanvas.
|
void |
repaint(Rectangle box,
int extra,
boolean update_graphics)
Repaint the given Rectangle after transforming its data on the fly to the
srcRect and magnification of this DisplayCanvas.
|
protected void |
scroll(int sx,
int sy) |
void |
setCursor(int sx,
int sy,
int ox,
int oy)
Sets the cursor based on the current tool and cursor location.
|
void |
setDimensions(double width,
double height)
Does not repaint.
|
void |
setDrawingSize(int new_width,
int new_height) |
protected void |
setInitialMagnification(double mag)
Used to constrain magnification so that only snapshots are used for painting when opening a new, large and filled Display.
|
void |
setMagnification(double mag) |
void |
setReceivesInput(boolean b) |
protected void |
setSrcRect(int x,
int y,
int width,
int height)
Set the srcRect - used by the DisplayNavigator.
|
void |
setup(double mag,
Rectangle srcRect)
Used for restoring properties from the database.
|
void |
setUpdateGraphics(boolean b) |
void |
showCentered(Rectangle r)
Center the srcRect around the given object(s) bounding box, zooming if necessary,
so that the given r becomes a rectangle centered in the srcRect and zoomed out by a factor of 2.
|
void |
update(Graphics g) |
void |
waitForRepaint() |
void |
zoomIn()
Zoom in using the current mouse position, or the center if the mouse is out.
|
void |
zoomIn(int x,
int y)
Overriding to repaint the DisplayNavigator as well.
|
void |
zoomOut()
Zoom out using the current mouse position, or the center if the mouse is out.
|
void |
zoomOut(int x,
int y)
Overriding to repaint the DisplayNavigator as well.
|
void |
zoomToFit() |
canEnlarge, cursorOverImage, disablePopupMenu, fitToWindow, getCursorLoc, getCustomRoi, getDisplayList, getHigherZoomLevel, getImage, getLowerZoomLevel, getMagnification, getModifiers, getOverlay, getPaintPending, getPreferredSize, getScaleToFit, getShowAllColor, getShowAllList, getShowAllROIs, getSliceNumber, getSrcRect, handlePopupMenu, handleRoiMouseDown, hideZoomIndicator, mouseClicked, offScreenX, offScreenX2, offScreenXD, offScreenY, offScreenY2, offScreenYD, repaintOverlay, resetDoubleBuffer, roiManagerSelect, screenX, screenXD, screenY, screenYD, setCursor, setCustomRoi, setDisplayList, setDisplayList, setDisplayList, setDrawingColor, setImageUpdated, setOverlay, setPaintPending, setScaleToFit, setShowAllColor, setShowAllList, setShowAllROIs, setShowCursorStatus, setSize, setSourceRect, setupScroll, unzoom, zoom100Percent
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, 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
protected static BasicStroke DEFAULT_STROKE
protected static AffineTransform DEFAULT_AFFINE
protected Point last_popup
public DisplayCanvas(Display display, int width, int height)
protected void invalidateVolatile()
public Display getDisplay()
protected void setInitialMagnification(double mag)
public void setup(double mag, Rectangle srcRect)
public void setDimensions(double width, double height)
public void handlePopupMenu()
public final void update(Graphics g)
update
in class ImageCanvas
public void setMagnification(double mag)
setMagnification
in class ImageCanvas
public void paint(Graphics g)
paint
in class ImageCanvas
public void waitForRepaint()
public static void drawHandle(Graphics g, int x, int y, double magnification)
public static void drawScreenHandle(Graphics g, int x, int y)
public static void drawHandle(Graphics2D g, double x, double y, Rectangle srcRect, double magnification)
protected Point consumeLastPopupPoint()
public void mousePressed(MouseEvent me)
mousePressed
in interface MouseListener
mousePressed
in class ImageCanvas
public void mouseDragged(MouseEvent me)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class ImageCanvas
public void mouseReleased(MouseEvent me)
mouseReleased
in interface MouseListener
mouseReleased
in class ImageCanvas
public void mouseEntered(MouseEvent me)
mouseEntered
in interface MouseListener
mouseEntered
in class ImageCanvas
public void mouseExited(MouseEvent me)
mouseExited
in interface MouseListener
mouseExited
in class ImageCanvas
public void setCursor(int sx, int sy, int ox, int oy)
setCursor
in class ImageCanvas
protected void setSrcRect(int x, int y, int width, int height)
public void setDrawingSize(int new_width, int new_height)
setDrawingSize
in class ImageCanvas
public void adjustDimensions()
public void adjustSrcRect(int new_width, int new_height)
protected double getLowerZoomLevel2(double currentMag)
protected double getHigherZoomLevel2(double currentMag)
public List<Displayable> getDisplayablesUnderMouse()
public List<Displayable> getDisplayablesUnderMouse(MouseEvent me)
public boolean isDragging()
public void mouseMoved(MouseEvent me)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class ImageCanvas
public void zoomIn()
public void zoomIn(int x, int y)
zoomIn
in class ImageCanvas
public void zoomOut()
public void zoomOut(int x, int y)
zoomOut
in class ImageCanvas
public void showCentered(Rectangle r)
public void center(Rectangle r, double magn)
public void repaint(Displayable d)
public void repaint(Displayable displ, int extra)
public void repaint(Displayable displ, int extra, boolean update_graphics)
public void repaint(HashSet<Displayable> hs)
public void repaint(Rectangle r, int extra)
public void repaint(Rectangle box, int extra, boolean update_graphics)
box
- The rectangle to repaintextra
- The extra outbound padding to add to the rectangleupdate_graphics
- Whether to recreate the offscreen images or notpublic void repaint(boolean update_graphics)
public void repaint()
public void repaint(int x, int y, int width, int height)
public void setUpdateGraphics(boolean b)
public void flush()
public void destroy()
public boolean applyTransform()
public boolean isTransforming()
public void cancelTransform()
public void keyPressed(KeyEvent ke)
keyPressed
in interface KeyListener
public void keyTyped(KeyEvent ke)
keyTyped
in interface KeyListener
public void keyReleased(KeyEvent ke)
keyReleased
in interface KeyListener
public void zoomToFit()
public void setReceivesInput(boolean b)
public boolean isInputEnabled()
public ij.ImagePlus getFakeImagePlus()
public void mouseWheelMoved(MouseWheelEvent mwe)
mouseWheelMoved
in interface MouseWheelListener
@Deprecated public BufferedImage paintOffscreen(Layer active_layer, int g_width, int g_height, Rectangle srcRect, double magnification, Displayable active, int c_alphas, Rectangle clipRect, Loader loader, HashMap<Color,Layer> hm, ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, ArrayList<Displayable> al_top)
public BufferedImage paintOffscreen(Layer active_layer, List<Layer> layers, int g_width, int g_height, Rectangle srcRect, double magnification, Displayable active, int c_alphas, Rectangle clipRect, Loader loader, HashMap<Color,Layer> hm, ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, ArrayList<Displayable> al_top, boolean preload)
public BufferedImage paintOffscreen(Layer active_layer, List<Layer> layers, ArrayList<Displayable> al_paint, Displayable active, int g_width, int g_height, int c_alphas, Loader loader, HashMap<Color,Layer> hm, ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, int first_non_patch)
protected void scroll(int sx, int sy)
scroll
in class ImageCanvas
protected void animateBrowsing(int dx, int dy)
Copyright © 2015–2021 Fiji. All rights reserved.