Re: Rendering works, most of the time...
Dennis Hendriks <[email protected]>
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Organization | TU/e |
| Message-ID | <[email protected]> |
Hi Thomas, Thanks for the reply. > What you say 'canvas' do you mean the Batik JSVGCanvas? Or your > personsal SWT Canvas? I only have one canvas, a class derived from the SWT Canvas class. In it's paint listener I render the graphics node a BufferedImage, and use the results to draw it on that SWT canvas. > It is essential that you not modify the document while a paint is in > progress. If the renderer detects this condition it will generaly abort > since it's impossible to get a reasonable result. Is there a standard way to avoid rendering while updating? I tried using the update manager, but this did not solve the problems. Since the simulator is in a different thread than the SWT display, the drawing and updating happen in different threads. Does Batik offer something to solve this, or should I apply standard Java thread data sharing techniques? > The only other thing I can think of would be if the clip (or other > attributes) of the Graphics2D was weird. I don't manually change any clipping or related things. I assume there is no way these things change on their own. Also, it works most of the time, but not all the time, so I guess paint while updating would be the more likely candidate. Best regards, Dennis [email protected] wrote: > Hi Dennis, > > Dennis Hendriks <[email protected]> wrote on 05/10/2011 10:35:13 AM: > > > For a simulator I'm writing I'm using Batik to visualize the model being > > simulated. The simulator loads an SVG file and after each simulation > steps, > > it calls some hooks that update the SVG document, and after that it > redraws > > the canvas. The canvas paint event renders the graphics node to a > > BufferedImage, after which the data is passed to SWT to render it on the > > SWT canvas. > > What you say 'canvas' do you mean the Batik JSVGCanvas? Or your > personsal SWT Canvas? > > > Does anyone know what I might be doing wrong, that causes nothing to be > > drawn? Under what circumstances could graphicsNode.paint(g) have the > effect > > that nothing is drawn? > > It is essential that you not modify the document while a paint > is in > progress. If the renderer detects this condition it will generaly abort > since it's impossible to get a reasonable result. > > The only other thing I can think of would be if the clip (or other > attributes) of the Graphics2D was weird.