xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Some basic questions about Batik and SVG functions
Date Tue, 26 Aug 2008 10:14:49 GMT
Hi Ozemale,

"ozemale@ozemail.com.au" <ozemale@ozemail.com.au> wrote on 08/25/2008 
10:55:38 PM:

> Could someone please answer the following basic questions I have 
> about Batik and SVG in general.
> 1. Is it possible for different "sections" or regions of an SVG to 
> be displayed at different zoom levels, either by initiating the zoom
> from Batik functionality or perhaps by scripting in the SVG itself? 
> If yes, could you offer an example?

   I'm not really sure what you mean by having different
sections displayed at a different zoom level.  Any group can have
a transform attribute with 'scale', which in some sense changes
the zoom level for that group.  You can also use the same content
in several places and each use can have a diffent scale transform.

> 2. Is it possible to invoke functions declared in the ECMAScript 
> inside an SVG from a Java program that uses Batik?  If yes, could 
> you offer an example?

    If you get the BridgeContext from the Canvas, then you can 
find the Interpreter in use 'BridgeContext.getInterpreter(String 
and then you can call 'Interpreter.evaluate(string script)'.
Make sure to do this in the UpdateManager's RunnableQueue.

> 3. Conversely, is it possible for the ECMAScript inside an SVG to 
> invoke methods in a surrounding Java program that uses Batik?  If 
> yes, could you offer an example?

   You have two options.  First we use Mozilla's Rhino so if you 
look at Rhino's project pages it has info on accessing Java classes:

   The other option would be to use 
'Interpreter.bindObject(string name, Object obj)' to bind a java
object as a global in the JavaScript interpreter where you can
call methods on it.

> I am very impressed with Batik - it appears to be the best SVG 
> viewing environment around and is also great for SVG manipulations. 
> Surprisingly I cannot see any significant performance difference 
> between scripting in Batik when compared to say ASV in a web browser.

   Batik is a very good SVG viewer, however for some things Batik
is definitely slower than some other viewers, in particular Text
tends to be on the slow side in Batik.

View raw message