I need to prepare screenshots of my application. I choosed batik to generate those screenshots using SVGGraphics2D and
drawing lines, circles etc on it. Everything was just fine, until now. I need to load one svg file, combine it with lines, circles etc
and save it in the svg format. I thought it will be simple, create JSVGCanvas and call paintComponent(svggraphicsgc). I got my lines, circles
etc but no loaded svg image. Then I realized that batik uses different threads to load and process svg. So I added listeners and
combinanation of wait/notify to wait until image will be ready. It didn't help, I still don't see svg image. The question is how can I load
svg file, resize it a bit and save with other graphics into new svg file?
Could someone give an advise?
Thanks! Sergiy
--- listener ---
logo.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
/**
* Called when a rendering started.
*/
public void gvtRenderingStarted(GVTTreeRendererEvent e) {
System.out.println("gvtRenderingStarted");
} /**
* Called when a rendering was completed.
*/
public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
System.out.println("gvtRenderingCompleted");
synchronized (logo) {
logo.notify();
}
}
});---- saving ----
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
GenerateScr test = new GenerateScr();
test.paintComponent(svgGenerator);
test.paintSvgLogo(svgGenerator);
test.waitWhenRenderingComplete();
boolean useCSS = true;
try {
Writer out = new OutputStreamWriter(System.out, "UTF-8");
svgGenerator.stream(out, useCSS);
} catch (UnsupportedEncodingException e) {
e.printStackTrace(System.err);
} catch (SVGGraphics2DIOException e) {
e.printStackTrace(System.err);
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
