please include function showImageWithSelections. static ImageSurface showImageWithRecognizedTexts(BufferedImage img, ImageSurface _is, final L rects) { final ImageSurface is = showImage(img, _is); final new Var highlighted; showImageWithSelections_highlighted = highlighted; is.overlay = voidfunc(Graphics2D g) { for (RecognizedText r : rects) { is.drawSelectionRect(g, r.r.getRectangle(), Color.blue, blendColor(Color.black, Color.white, r.score())); // TODO: text } 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(collect(rects, 'r), p))); }); ret repaint(is); }