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]