Drawing HiDPI component to BufferedImage

Hendrik Schreiber hs at tagtraum.com
Fri Jan 24 00:05:10 PST 2014


Hey,

to animate a component, I usually draw it to a BufferedImage and then draw that image to the glass pane, where I can easily move it around without having to completely re-render the component all the time. Unfortunately, this technique does not work well on Retina/HiDPI displays, as I can't seem to be able to convince any components to render in high resolution to a BufferedImage.

Is there a way to paint components to BufferedImages in high resolution?
I'd like something like:

        final Image image = component.createImage(component.getWidth(), component.getHeight());
        component.paint(image.getGraphics());
        // then go on to use the image...

to work properly.

Thanks,

-hendrik


More information about the macosx-port-dev mailing list