> If you just want to convert SVG to buffered images you could look
> at the 'slideshow' application as this is what it does.
I'll have a look and see if I can make some progress.
> I'm not sure I follow you here (what you mean by 'too late'), but
> the JSVGCanvas has events that you can listen to, in particular the
> 'GVTTreeRenderer' events include the 'BufferedImage' in the completed
> event. This is how I would get the results of the rendering.
Yes, I know about the events - I am using them, see my SVGUtils class.
But the creation of the svgCanvas object seems to place the Load,
Build, Render processes on a low priority thread that doesn't start until
after all other threads are finished. So, when I create the svgCanvas
object
I cannot figure out how to force it to start the Load, Build, Render
processes
so that I can wait until the bufImg is non-NULL and can be added to the
layeredPane.
Down stream processes expect to find a non-NULL bufImg so that they can do
things
like pane sizing, etc.
> Is there a reason you can't just add the JSVGCanvas to the JLayered
> Pane and bypass all this buffered image nonsense?
Yes, right now my app is BufferedImage centric and it will take many hours
to convert it to being centered around the JSVGCanvas. A worthwhile goal,
but I need to walk before I crawl.
Thanks for your patience with this newbie.
--BobC
-----Original Message-----
From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Sent: Friday, February 20, 2004 12:16 PM
To: Batik Users
Subject: Re: JSVGCanvas Thread Timing Problem
Bob Carpenter wrote:
> I need some help getting my head around how best to convert my app to use
> SVG files.
>
> I have a Swing client that currently uses BufferedImages that are
generated
> from DXF files. These images are typically floor plans. There are other
> bufImgs that are icons that get dropped on a floor plan. All images are
> placed in a JLayeredPane - on various layers - which is then added to a
> JPanel. I want to quit using DXF files and start using SVG files.
>
> To get started down the conversion path I thought I could simply create a
> JSVGCanvas of the floorplan.svg and call svgCanvas.getOffScreen() to grab
> the bufImg, and place that in the layeredPane.
If you just want to convert SVG to buffered images you could look
at the 'slideshow' application as this is what it does.
> But I'm having a thread
> timing problem. The svgCanvas doesn't start rendering the bufImg until
after
> it has been added to the layeredPane. I've tried using a sleep thread that
> wakes up to see if the tree build is done, but the svgCanvas thread
doesn't
> start until it's too late to grab the bufImg.
I'm not sure I follow you here (what you mean by 'too late'), but
the JSVGCanvas has events that you can listen to, in particular the
'GVTTreeRenderer' events include the 'BufferedImage' in the completed
event. This is how I would get the results of the rendering.
Is there a reason you can't just add the JSVGCanvas to the JLayered
Pane and bypass all this buffered image nonsense?
>
> I'd appreciate any help to solve this timing problem, or a suggestion on a
> better approach to do the conversion.
---------------------------------------------------------------------
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]