On Thu, 2002-05-23 at 20:48, Paul Reavis wrote:
> This is probably a question for the batik list, but I'm not on that at
> present so thought I'd ask here. 

I'm sure they would know better...

> What's the best way to get an SVG loaded so I can draw it to a
> buffered image? I basically want to load an SVG and turn it into a
> raster icon. I'm trying to use JSVGComponent but the loading is so
> multithreaded I can't figure it out at all. Just trying to listen does
> nothing - I wait forever for a loaded event.
> 
>  It seems similar to the annoying Java default image loading
> behavior where it incrementally loads images - great for web-like
> incremental drawing effects, but annoying if you just want to load an
> image, right now, no questions.
> 
> I think it might be waiting on something - a paint() command or
> similar - to actually load - lazy loading, in other words.

As far as I know the JSVGCanvas is really for viewing the document. This
means it also sets up a bunch of event handlers and threads.

This is the sort of code that you need (without error handling and other
things).

GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(userAgent);
GraphicsNode root = builder.build(ctx, doc);
float w = (float)ctx.getDocumentSize().getWidth();
float h = (float)ctx.getDocumentSize().getHeight();
Graphics2D graphics = create graphic from buffered image...
root.paint(graphics);





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to