Hi Thomas
Thanks for that. I see I should be specifying fill-opacity and not opacity.
When I specify fill-opacity like this:
<circle cx='225' cy='250' r='100' style="fill:green" fill-opacity="0.5"/>
my override of AbstractGraphics2D.draw( Shape ) is called, which is progress, but the alpha channel (from AbstractGraphics2D.getColor()) is always 255. I suspect I should be telling Batik that I can support alpha values - can you point me to where this is done ?
I attempted to solve this myself using the source and seeing how the pdf-transcoder.jar which comes which Batik 1.5.1 works, but the Batik source distribution does not seem to include the source for pdf-transcoder.jar.
Thanks
John
----- Original Message ----- From: "Thomas DeWeese" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 2004 11:05 PM
Subject: Re: extending AbstractGraphics2D
Hi John,
john farrow wrote:
I am writing a PDF transcoder, including extending org.apache.batik.ext.awt.g2d. AbstractGraphics2D.
Using some SVG like this:
<circle cx='200' cy='200' r='100' stroke='red' stroke-width='3' fill="green" opacity=".1"/>
When a shape is rendered, if it has no opacity attribute then AbstractGraphics2D.drawShape is and I can render the shape to PDF ok. But if the shape has an opacity attribute then AbstractGraphics2D.drawImage is called instead, whereas I would like to have drawShape() also called and I handle the opacity within the PDF.
There is no way to communicate group opacity through the Graphics2D interface.
I have a feeling this is a configuration setting or similar, and was wondering if anyone can tell me why this happens, before I spend a day installing the source and wading through it myself.
It is important to distinguish between group opacity and fill/stroke opacity. In group opacity the stroke and the fill are composited together opaquely and the result is applied to the canvas with opacity. So in your example you can't see any fill under the 'inside' part of the stroke, but you can see through to content under the shape.
Batik will render fill/stroke opacity as 'draw shape' with opacity, through the Graphics2D interface it can't do the same for group opacity.
Thanks for your help
John Farrow
* Visual Programming Ltd * mail PO Box 22-222, Khandallah, Wellington, New Zealand site Level 2, 2 Ganges Road, Khandallah, Wellington, New Zealand phone +64 4 479 1738 fax +64 4 479 1294 web http://www.xmlpdf.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]