Hi Nigel, Nigel MOTTE <[EMAIL PROTECTED]> wrote on 05/08/2006 12:48:12 PM:
> I'm making a little whiteboard app based on svg, and I would like to > know if I could display an SVGGraphics2D into an SVGCanvas without > using the SVGDocument generated which means as a classic Graphics > context. The short answer is not really. The longer answer is that if you construct an SVGGraphics2D with the canvas's document you can use 'SVGGraphics2D.getRoot(canvas.getSVGDocument.getRootElement())' to append your drawing to the canvas. The resultant document will be fairly ugly but it should mostly work. But to be honest I think if you are doing a whiteboard app you will probably be better served constructing the SVG elements directly (it's not hard) as this will give you a bit more control/understanding of what is happening. > I also would like to know if is possible to copy the content of an > SVGCanvas as an Image in order to display it into a classic Graphics > context. The Canvas does all of it's rendering from the 'GVT' tree. You can get this from the Canvas and the GraphicsNode's have a 'paint(Graphics2D)' method that you can use to draw the GVT tree to any Graphics2D. You can also use the transcoders to convert the document to a JPEG or PNG image. Finally you can grab the offscreen BufferedImage that the canvas uses for display updates. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
