List of usage examples for java.awt.image VolatileImage IMAGE_RESTORED
int IMAGE_RESTORED
To view the source code for java.awt.image VolatileImage IMAGE_RESTORED.
Click Source Link
From source file:net.sf.maltcms.chromaui.charts.FastHeatMapPlot.java
private void drawFromOffscreenBuffer(Graphics2D g, Image sourceImage, Rectangle sourceArea, Rectangle targetArea) {// w w w .j a v a 2s . co m // copying from the image (here, gScreen is the Graphics // object for the onscreen window) do { int returnCode = offscreenBuffer.validate(getGraphicsConfiguration()); if (returnCode == VolatileImage.IMAGE_RESTORED) { // Contents need to be restored drawOffscreenImage(sourceImage); // restore contents } else if (returnCode == VolatileImage.IMAGE_INCOMPATIBLE) { // old vImg doesn't work with new GraphicsConfig; re-create it offscreenBuffer = null; drawOffscreenImage(sourceImage); } int sx0, sx1, sy0, sy1, tx0, tx1, ty0, ty1; sx0 = sourceArea.x; // sx1 = sourceArea.x + sourceArea.width; sy0 = sourceArea.y; // sy1 = sourceArea.y + sourceArea.height; tx0 = targetArea.x; // tx1 = targetArea.x + targetArea.width; ty0 = targetArea.y; // ty1 = targetArea.y + targetArea.height; g.drawImage(offscreenBuffer.getSnapshot().getSubimage(sx0, sy0, sourceArea.width, sourceArea.height), tx0, ty0, targetArea.width, targetArea.height, null); } while (offscreenBuffer.contentsLost()); }