}
public void testCopyArea() {
GraphicsConfiguration gconf =
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
VolatileImage vim = gconf.createCompatibleVolatileImage(20, 20);
Graphics2D g2 = (Graphics2D) vim.getGraphics();
g2.setColor(Color.WHITE);
g2.fillRect(0,0,20,20);
g2.setColor(Color.RED);
g2.fillRect(2,2,1,1);
g2.copyArea(2,2,1,1,2,4);
int pix[] = vim.getSnapshot().getRaster().getPixel(4,6,(int [])null);
assertEquals("copyArea failed for untranslated graphics", pix[0],255);
assertEquals("copyArea failed for untranslated graphics", pix[1],0);
assertEquals("copyArea failed for untranslated graphics", pix[2],0);
g2.setTransform(AffineTransform.getTranslateInstance(2,2));
g2.copyArea(0,0,1,1,4,8);
pix = vim.getSnapshot().getRaster().getPixel(6,10,(int [])null);
assertEquals("copyArea failed for translated graphics", pix[0],255);
assertEquals("copyArea failed for translated graphics", pix[1],0);
assertEquals("copyArea failed for translated graphics", pix[2],0);
}