xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: extending AbstractGraphics2D
Date Thu, 26 Aug 2004 11:05:28 GMT
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

> 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

> 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: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org

View raw message