xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thierry Kormann" <tkorm...@ilog.fr>
Subject RE: [RE] Dynamic updating of a gradient
Date Tue, 03 Sep 2002 12:49:14 GMT


> >     Batik does not currently suppor the dynamic update of Gradients
> > (it did at one point then it was removed because it was causing memory
> > leaks).  Thierry was working on a new version of this but I don't know
> > where it stands right now.
> >
> > BM> Is this true for all elements within <defs></defs>, or even for
> > BM> all elements that can be referenced?
> >
> >     It is true for most elements that can be referenced.  The one
> > exception that comes to mind is 'tref' and 'image' (I think) but
> > generally speaking animation of referenced content doesn't work.

It's a difficult issue I am currently working on. The dependency graph is
really complex to create, maintain and update.

> What a pity. But thanks for the information!
> Would it work if I removed the referenced element and then recreated it?

You don't need to remove then add the element. You 'just' need to change the
'fill' property on the element that references the gradient (using
setAttribute("style", ...) for instance.

> Another question:
> I frequently change many attributes in the DOM tree using
> ECMAScript. I have
> one main update function which calls other functions which again can call
> other functions. Almost all of them use setAttributeNS(...). My
> question now
> is: When does Batik update the graphics? Immediately after each
> setAttributeNS(...) call, or when my main ECMAScript function returns?
> My application is getting slower and slower... and I do not know why :-)
> (Is getElementById() that slow (which I call rather often), or
> are the many
> setAttributeNS(...) calls the problem, or...)

After each setAttributeNS method call, the rendering tree is updated. The
implications are bad (changing a style attribute on a <text> element for
instance is really time consuming). The graphics then is updated once after
the execution of an EventHandler (your main method in your case).

This is also an issue I am working on.


To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message