xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Converset <pconver...@Qarbon.com>
Subject Re: Change fill color in a GraphicsNode
Date Tue, 08 Oct 2002 08:07:30 GMT

If your GraphicsNode is a ShapeNode, then you can use the 
setShapePainter() method.

Here is an example:

      FillShapePainter painter;

      painter = new FillShapePainter(shapeNode.getShape());

If you want to specify the stroke paint, then you can use 
StrokeShapePainter and if you want to specify the stroke and the fill 
paint at the same time, then you must use a CompositeShapePainter on 
which you add the two previous painters through the addShapePainter() 

Hope this helps.


Guanming Wu a écrit:

> Hi,
> I am new to batik-1.1.1. In one of my applications, I want to paint a 
> GraphicsNode with different colors at different places in a JPanel. In 
> my application, I cannot directly use JSVGComponent or JSVGCanvas, so 
> I embed a SVG in my graphics context by painting a GraphicsNode 
> directly on Graphics2D (Method: Graphics2D.paint(Graphics2D)).
> I just want if there is a way to set fill color after GraphicsNode is 
> built from SVG document.
> Thanks,
> Guanming

View raw message