Hi John, "John C. Turnbull" <[EMAIL PROTECTED]> wrote on 08/26/2008 09:07:30 AM:
> 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? Assuming you mean SMIL animation rather than scripted animations then more or less yes. > Say if one button starts an animation and then clicking another > button starts a further animation before the first animation has > completed etc.? Multiple SMIL animations can be initiated at the same time. > Or is it that once one animation or script starts then no other one can > start concurrently? While a script is actually executing nothing else can occur (including rendering) Otherwise you would have to worry about locking and unlocking critical sections etc. Typically scripts get around this with the 'setTimeout' method which allows you to register a function to be called later. Which is effectively a simple form of cooperative multi-tasking. Also what Archie says is also true but from a more Java centric view (you can have multiple Java threads that 'interact' with the SVG document but they must serialize access through the UpdateManager's RunnableQueue). > 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.
