// delete pen and brush
protected void writeImage(RenderedImage image, AffineTransform xform,
Color bkg) throws IOException {
os.writeTag(new SaveDC());
AffineTransform imageTransform = new AffineTransform(
1.0, 0.0, 0.0, -1.0, 0.0, image.getHeight());
imageTransform.preConcatenate(xform);
writeTransform(imageTransform);
BufferedImage bufferedImage = ImageUtilities.createBufferedImage(
image, null, null);
AlphaBlend alphaBlend = new AlphaBlend(
imageBounds,
toUnit(0),
toUnit(0),
toUnit(image.getWidth()),
toUnit(image.getHeight()),
new AffineTransform(),
bufferedImage,
bkg);
os.writeTag(alphaBlend);
os.writeTag(new RestoreDC());