// f: (int w, int h) -> BufferedImage static ImageSurface jcanvas(O f) { asertAWTThread(); final new ImageSurface is; onResize(is, r { awtLater(is, delay, r { BufferedImage img = is.getImage();# int w = is.getWidth(), h = is.getHeight(); if (img.getWidth() != w || img.getHeight() != h) is.setImage(toBufferedImage(callF(f, w, h))); }); }); }