Bibek Sahu wrote:
Speaking of dragging, though (and since we're on the topic of text): how do I get text painted (quickly) into a BufferedImage?
When I tried simply creating a BufferedImage and telling the
relevant GraphicsNodes to paint into its Graphics2D context, I got
messages about how certain keys weren't set and I should use some Batik
methods to create such an image.
Yes, this is in fact fairly important for some cases.
When I used the aforementioned Batik methods to create the BufferedImage, then anytime I painted a GraphicsNode into it, the JSVGComponent thought it needed to be re-rendered, which killed performance.
The JSVGComponent will only think it needs to be re-rendered if you 'change something' in the Graphics Node. So for example if you set the transform or adjust the rendering properties for the Node (or the associated DOM element) it will mark it's self as dirty and the UpdateManager will trigger a repaint.
If you can't figure out what is triggering the repaint you could
register a GraphicsNodeChangeListener with the RootGraphicsNode. Then
just use: 'new Exception("Change").printStackTrace()' to figure out
who is causing the change events to be generated.The other thing I've done is get outlines of the relevant
GraphicsNodes and draw those while moving. This is fine 90% of the time,
but when I try dragging around the "Henry V" example from the Batik
Samples, I sometimes wait more than a minute for it to generate the
outline -- and at least 20 seconds for it to render it -- on a fast
computer. Which is to be expected, I suppose. But... I have no
need/desire to use the node's official outline; I just want to show the
user something along the lines of what they're moving.
Well you could walk the tree yourself and do this, it wouldn't be
too hard but it would involve being aware of most of the Graphics Node types in Batik.
A 'getShape()' or 'draw()' or whatnot that /didn't/ tell the JSVGComponent to re-render would be fine with me... ;-)
GraphicsNode.paint does not tell the component to re-render.
Thanks! - Bob
So is it 'Bob' or 'Bibek' (is 'Bob' an Americization of 'Bibek'?).
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
