*
* @return BufferedImage, or null if the device frame buffer was only partially read
* @throws IOException
*/
public BufferedImage getImage() throws IOException {
RawImage rawImage = device.getScreenshot();
if (rawImage == null) {
// Indicates other problems, such as partial replies from the ADB frame-buffer,
// or an unsupported version of the image format for the current ddmlib
// (have to check log)
return null;
}
BufferedImage image = new BufferedImage(rawImage.width, rawImage.height, BufferedImage.TYPE_INT_ARGB);
int index = 0;
int indexInc = rawImage.bpp >> 3;
for (int y = 0; y < rawImage.height; y++) {
for (int x = 0; x < rawImage.width; x++, index += indexInc) {
int value = rawImage.getARGB(index);
image.setRGB(x, y, value);
}
}
if (imageFilters != null) {