I’m creating an application that zooms a few shapes in and out. (The shapes are lines, circles, polygons and other simple shapes, no pictures are involved). I zoom by moving the points, a line ((2,2)-(4,5)) becomes a new line, ((4,4)-(8,10)) with 2x zoom so I simply have an image that I draw to all the time.
I’m creating an accelerated image like this:
BufferedImage image;
Graphics2D gImage;
…
gc = getGraphicsConfiguration();
image = gc.createCompatibleImage(w, h);
gImage = ((Graphics2D)image.getGraphics());
The problem is that I’m worried that the image won’t stay accelerated because I draw new shapes to it all the time. From the point of the user, no new shapes are drawn, the shapes that was there when the application started are still there, none are added, none are removed. But in fact, I redraw the shapes as the user changes the zoom factor.
Am I right about the image, that it won’t stay accelerated? If I am right, is there anything else I could do? Use a VolatileImage? BufferStrategy? Zoom without redrawing the shapes?
Thanks!