BufferedImageAdapter extends PlanarImage { public Raster getData() { final WritableRaster raster = image.getRaster(); if(raster.getParent() != null) { return image.getData(new Rectangle(0, 0, raster.getWidth(), raster.getHeight())); } else { return raster; } } BufferedImageAdapter(BufferedImage image); @Override Raster getTile(int tileX, int tileY); Raster getData(); Raster getData(Rectangle rect); WritableRaster copyData(WritableRaster raster);  }
@Test public void testGetData() { BufferedImage bi = new BufferedImage(768, 768, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D graphics = bi.createGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(512, 512, 256, 256); graphics.dispose(); BufferedImage solidSubimage = bi.getSubimage(512, 512, 256, 256); assertSolidTile(solidSubimage, 255); BufferedImage transparentSubimage = bi.getSubimage(256, 256, 256, 256); assertSolidTile(transparentSubimage, 0); }