sclass PatchworkImage extends AbstractWAndH is MakesBufferedImage { new L patches; settable Color backgroundColor = grayToColor(0.9); class Patch { Rect bounds; BufferedImage image; settable A userValue; *(Rect *bounds, BufferedImage *image) {} } *() {} *(int w, int h) { super(w, h); } void addPatch(BufferedImage image, Pt etc p, A userValue) { addPatch(p, image, userValue); } void addPatch(Pt etc p, BufferedImage image, A userValue) { patches.add(new Patch( rect(p.x, p.y, image.getWidth(), image.getHeight()), image) .userValue(userValue)); } public BufferedImage getBufferedImage() { BufferedImage out = newBufferedImage(w(), h(), backgroundColor); for (patch : patches) copyBufferedImage(patch.image, out, topLeft(patch.bounds)); ret out; } }