You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Philippe Converset <pc...@Qarbon.com> on 2002/03/15 15:48:30 UTC

How to get the BridgeContext?

Hi,

I've got a Document created from a JSVGCanvas and I want to call 
BridgeContext.getBridge() on a specific element.
Where can I retrieve a BridgeContext? I see nothing in Document, JSVGCanvas 
or GVTTreeBuilder to access their own bridgeContext.

Any help appreciated

Philippe


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: How to get the BridgeContext?

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "PC" == Philippe Converset <pc...@qarbon.com> writes:

PC> The basic idea is to read an SVG file, retrieve a specific paint
PC> element (through a known id), transform it to a java.awt.Paint
PC> object and apply it to a pure java Shape. The BridgeContext is
PC> needed to convert the SVG paint element to the pure Java paint
PC> object via the batik.bridge.PaintServer.convertFillPaint() method.

    I don't know what sort of paints you are looking for, but the
gradients are fairly easy to construct independent of GVT.  Patterns
are a bit harder :)

>> Then, the good news for today is that all members of the JSVGCanvas
>> and its superclasses are protected so, right now, it's easy to
>> subclass the JSVGCanvas to get access to its BridgeContext and add
>> the getBridgeContext method you need.

PC> I saw that. I'm currently using JSVGCanvas because it's really
PC> convenient but as the SVG file I use is not meant to be rendered
PC> (it is just kindof a description file), I'll try to use something
PC> else more straightforward. If this is the only way to get a
PC> bridgeContext, I'm ok to subclass the JSVGCanvas for now.

    Take a look at ...batik.apps.slideshow.Main it reads and parses
SVG w/o the canvas and as a bonus you get direct access to the
BridgeContex.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: How to get the BridgeContext?

Posted by Thierry Kormann <tk...@ilog.fr>.
> I saw that. I'm currently using JSVGCanvas because it's really convenient
> but as the SVG file I use is not meant to be rendered (it is just
> kindof a
> description file), I'll try to use something else more
> straightforward. If
> this is the only way to get a bridgeContext, I'm ok to subclass the
> JSVGCanvas for now.

it's the only way to get a BridgeContext if you are using the canvas.
Otherwise, you can create your own (see the ImageTranscoder that does all
the steps, 1 by 1 from the Document to the BufferedImage).

PS: All transformation tricks are for the transcoder parameters and can be
ignored probably in your case.

Thierry.



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: How to get the BridgeContext?

Posted by Philippe Converset <pc...@Qarbon.com>.
At 12:07 17/03/2002 +0100, you wrote:

> > I've got a Document created from a JSVGCanvas and I want to call
> > BridgeContext.getBridge() on a specific element.
> > Where can I retrieve a BridgeContext? I see nothing in Document,
> > JSVGCanvas
> > or GVTTreeBuilder to access their own bridgeContext.
> >
> > Any help appreciated
>
>Well, can you tell me a bit more about why you need the BridgeContext.
>Depending on the use case, we might add a getBridgeContext method on the
>canvas.

The basic idea is to read an SVG file, retrieve a specific paint element 
(through a known id), transform it to a java.awt.Paint object and apply it 
to a pure java Shape. The BridgeContext is needed to convert the SVG paint 
element to the pure Java paint object via the 
batik.bridge.PaintServer.convertFillPaint() method.

>Then, the good news for today is that all members of the JSVGCanvas and its
>superclasses are protected so, right now, it's easy to subclass the
>JSVGCanvas to get access to its BridgeContext and add the getBridgeContext
>method you need.

I saw that. I'm currently using JSVGCanvas because it's really convenient 
but as the SVG file I use is not meant to be rendered (it is just kindof a 
description file), I'll try to use something else more straightforward. If 
this is the only way to get a bridgeContext, I'm ok to subclass the 
JSVGCanvas for now.


Philippe


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: How to get the BridgeContext?

Posted by Thierry Kormann <tk...@ilog.fr>.
> I've got a Document created from a JSVGCanvas and I want to call
> BridgeContext.getBridge() on a specific element.
> Where can I retrieve a BridgeContext? I see nothing in Document,
> JSVGCanvas
> or GVTTreeBuilder to access their own bridgeContext.
>
> Any help appreciated

Well, can you tell me a bit more about why you need the BridgeContext.
Depending on the use case, we might add a getBridgeContext method on the
canvas.

Then, the good news for today is that all members of the JSVGCanvas and its
superclasses are protected so, right now, it's easy to subclass the
JSVGCanvas to get access to its BridgeContext and add the getBridgeContext
method you need.

Thierry.



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org