static ImageSurface showImageWithSelections(MakesBufferedImage img, final Cl rects) { ret showImageWithSelections(img.getBufferedImage(), rects); } static ImageSurface showImageWithSelections(S title, BufferedImage img, Cl rects) { ret frameTitle(title, showImageWithSelections(img, rects)); } static ImageSurface showImageWithSelections(BufferedImage img, Cl rects) { ret showImageWithSelections(img, null, rects); } static ImageSurface showImageWithSelections(BufferedImage img, Rect... rects) { ret showImageWithSelections(img, asList(rects)); } // for callers to use static Var showImageWithSelections_highlighted; static ImageSurface showImageWithSelections(BufferedImage img, ImageSurface _is, Cl _rects) { final ImageSurface is = showImage(img, _is); final L rects = sortRectsBySize(_rects); final new Var highlighted; showImageWithSelections_highlighted = highlighted; is.overlay = voidfunc(Graphics2D g) { for (Rect r : rects) is.drawSelectionRect(g, r.getRectangle(), Color.blue, Color.white); if (highlighted.has()) fillRect(g, scaleRect(highlighted!, is.getZoomX(), is.getZoomY()), new Color(0, 0, 0, 0x30)); // semi-transparent black }; imageSurfaceOnMouseMove(is, voidfunc(Pt p) { repaintIf(is, setVarIfNeq(highlighted, smallestRectContaining(rects, p))); }); is.repaint(); ret is; }