Hi Thomas,

 

Thanks very much for the answers.  That has covered what I was looking for.

 

In addition though, is it possible for some degree of multi-threading to
happen within a single SVG?  That is, can two or more scripts or animations
be executed simultaneously?  Say if one button starts an animation and then
clicking another button starts a further animation before the first
animation has completed etc.?  Or is it that once one animation or script
starts then no other one can start concurrently?

 

Cheers,

 

John

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 26 August 2008 20:15
To: [email protected]
Cc: [email protected]
Subject: Re: Some basic questions about Batik and SVG functions

 


Hi Ozemale,

"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 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 language)' 
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: 
        http://www.mozilla.org/rhino/ScriptingJava.html 

   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. 

Reply via email to