This is a Canvas used to display images in a Window.
| 48 | |
| 49 | /** This is a Canvas used to display images in a Window. */ |
| 50 | public class ImageCanvas extends Canvas implements MouseListener, MouseMotionListener, Cloneable { |
| 51 | |
| 52 | protected static Cursor defaultCursor = new Cursor(Cursor.DEFAULT_CURSOR); |
| 53 | protected static Cursor handCursor = new Cursor(Cursor.HAND_CURSOR); |
| 54 | protected static Cursor moveCursor = new Cursor(Cursor.MOVE_CURSOR); |
| 55 | protected static Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR); |
| 56 | |
| 57 | public static boolean usePointer = Prefs.usePointerCursor; |
| 58 | |
| 59 | protected ImagePlus imp; |
| 60 | protected boolean imageUpdated; |
| 61 | protected Rectangle srcRect; |
| 62 | protected int imageWidth, imageHeight; |
| 63 | protected int xMouse; // current cursor offscreen x location |
| 64 | protected int yMouse; // current cursor offscreen y location |
| 65 | |
| 66 | private boolean showCursorStatus = true; |
| 67 | private int sx2, sy2; |
| 68 | private boolean disablePopupMenu; |
| 69 | private static Color zoomIndicatorColor; |
| 70 | private static Font smallFont, largeFont; |
| 71 | private Font font; |
| 72 | private Rectangle[] labelRects; |
| 73 | private boolean maxBoundsReset; |
| 74 | @AstroImageJ(reason = "Control if the overlay should be shown; widen access to protected", modified = true) |
| 75 | protected Overlay showAllOverlay; |
| 76 | private static final int LIST_OFFSET = 100000; |
| 77 | private static Color showAllColor = Prefs.getColor(Prefs.SHOW_ALL_COLOR, new Color(0, 255, 255)); |
| 78 | private Color defaultColor = showAllColor; |
| 79 | private static Color labelColor, bgColor; |
| 80 | private int resetMaxBoundsCount; |
| 81 | private Roi currentRoi; |
| 82 | private int mousePressedX, mousePressedY; |
| 83 | private long mousePressedTime; |
| 84 | private boolean overOverlayLabel; |
| 85 | |
| 86 | /** If the mouse moves less than this in screen pixels, successive zoom operations are on the same image pixel */ |
| 87 | protected final static int MAX_MOUSEMOVE_ZOOM = 10; |
| 88 | /** Screen coordinates where the last zoom operation was done (initialized to impossible value) */ |
| 89 | protected int lastZoomSX = -9999999; |
| 90 | protected int lastZoomSY = -9999999; |
| 91 | /** Image (=offscreen) coordinates where the cursor was moved to for zooming */ |
| 92 | protected int zoomTargetOX = -1; |
| 93 | protected int zoomTargetOY; |
| 94 | |
| 95 | protected ImageJ ij; |
| 96 | protected double magnification; |
| 97 | protected int dstWidth, dstHeight; |
| 98 | |
| 99 | protected int xMouseStart; |
| 100 | protected int yMouseStart; |
| 101 | protected int xSrcStart; |
| 102 | protected int ySrcStart; |
| 103 | protected int flags; |
| 104 | |
| 105 | @AstroImageJ(reason = "Set but never used", lostImplementation = true) |
| 106 | public int xClicked = 0; |
| 107 | @AstroImageJ(reason = "Set but never used", lostImplementation = true) |