srecord noeq G22VisualizeMeshes(WidthAndHeight originalImage, L meshes) { delegate Anchor, Curve to G22Mesh. // can also include alpha settable Color anchorColor = withAlpha(0.5, Color.red); settable int anchorSize = 5; // can also include alpha settable Color curveColor = Color.blue; BufferedImage get() { var markedImage = whiteImage(imageSize(originalImage)); drawOn(createGraphics(markedImage)); ret markedImage; } void drawOn(Graphics2D g) { for (mesh : meshes) for (curve : mesh.curves()) drawCurve(g, curve); for (mesh : meshes) for (p : mesh.anchorPts()) drawAnchor(g, p); } void drawCurve(Graphics2D g, Curve curve) { drawPixels(g, curve.path().pointIterator(), curveColor); } void drawAnchor(Graphics2D g, Pt p) { fillRect(g, p.x-anchorSize/2, p.y-anchorSize/2, anchorSize, anchorSize, anchorColor); } }