public void draw(Graphics2D graphics){
AffineTransform at = graphics.getTransform();
ShapePainter.paint(this, graphics);
PictureData data = getPictureData();
if (data instanceof Bitmap){
BufferedImage img = null;
try {
img = ImageIO.read(new ByteArrayInputStream(data.getData()));
}
catch (Exception e){
logger.log(POILogger.WARN, "ImageIO failed to create image. image.type: " + data.getType());
return;
}
Rectangle anchor = getAnchor();
Image scaledImg = img.getScaledInstance(anchor.width, anchor.height, Image.SCALE_SMOOTH);
graphics.drawImage(scaledImg, anchor.x, anchor.y, null);
} else {
logger.log(POILogger.WARN, "Rendering of metafiles is not yet supported. image.type: " + (data == null ? "NA" : data.getClass().getName()));
}
graphics.setTransform(at);
}