"Eric Hamacher" <[EMAIL PROTECTED]> wrote on 03/12/2008 03:11:43 PM:

My application outputs PDFs using Batik (via PrintTranscoder).  As I
use my application, the message “Graphics2D from BufferedImage lacks
BUFFERED_IMAGE hint” keeps appearing on my console in ever
increasing numbers (it now prints about 50 times).  I either want to
fix this problem or prevent it from printing.  What is this
referring to?


Hi Eric,

I stumbled upon that message when rendering a BATIK GraphicsNode (svgRoot below) upon a Graphics2D object (igfx below) associated to a BufferedImage (image below). In that case, you can just set the appropriate rendering hint yourself:

// fixes "Graphics2D from BufferedImage lacks BUFFERED_IMAGE hint" - part 1
final Object oldBufferedImage = igfx.getRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE); igfx.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, new WeakReference(image));

svgRoot.paint(igfx);

// fixes "Graphics2D from BufferedImage lacks BUFFERED_IMAGE hint" - part 2
if (oldBufferedImage != null) {
igfx.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, oldBufferedImage);
} else {
  igfx.getRenderingHints().remove(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE);
}


Alternatively, BATIK 1.7 allows you to turn of the warning, if you want to silently ignore it (in case you do not see any adverse effects). To do this, set the system property "org.apache.batik.warn_destination" to "false".


Kind regards, Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to