static BufferedImage renderBackgroundPlusBoxes(int w, int h, BackgroundPlusBoxes s) { BufferedImage bi = newBufferedImage(w, h, toColor(s.background)); Graphics2D g = imageGraphics(bi); for (BoxWithColor e : s.boxes) { int x1 = min(e.a.x, e.b.x), y1 = min(e.a.y, e.b.y); int x2 = max(e.a.x, e.b.x), y2 = max(e.a.y, e.b.y); fillRect(g, x1, y1, x2-x1+1, y2-y1+1, toColor(e.color)); } g.dispose(); ret bi; } static BufferedImage renderBackgroundPlusBoxes(int w, int h, Color background, Color boxColor, L rects) { ret renderBackgroundPlusBoxes(w, h, BackgroundPlus(background, map(rects, r -> BoxWithColor(r, boxColor)))); }