You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Francisco Mariscal <fc...@hotmail.com> on 2005/10/13 21:28:41 UTC
How to render an Graphics2D Image directly to SVGGraphics2D
I am trying to use Batik for develop a new option to an existing drawing
program, this option will
let me export an already created Graphics2D image, to an external file in
SVG format.
My problem is this: I already have an image internally in the program, this
image was created by a
program, so I already have a Graphics2D object that contains my image, when
I see samples and
tutorials about using SVGGraphics2D, the rendering process becomes something
like
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
TestSVGGen test = new TestSVGGen();
test.paint(svgGenerator);
BUT how can I do the rendering of my already created image directly over the
newly created svgGenerator?
I feel that I am missing something basic about managing images on Java.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: How to render an Graphics2D Image directly to SVGGraphics2D
Posted by th...@kodak.com.
Hi Francisco,
"Francisco Mariscal" <fc...@hotmail.com> wrote on 10/13/2005
03:28:41 PM:
> I am trying to use Batik for develop a new option to an existing drawing
> program, this option will let me export an already created Graphics2D
> image, to an external file in SVG format.
When you say you have an already created Graphics2D image, are we
talking about a BufferedImage instance?
> My problem is this: I already have an image internally in the program,
this
> image was created by a program, so I already have a Graphics2D object
that
> contains my image, when I see samples and tutorials about using
SVGGraphics2D,
> the rendering process becomes something like
> SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
> TestSVGGen test = new TestSVGGen();
> test.paint(svgGenerator);
>
> BUT how can I do the rendering of my already created image directly over
the
> newly created svgGenerator?
If you really just have a BufferedImage then there is really no point
in
trying to transcode to SVG, you might as well write as JPEG or PNG (the
SVGGraphics2D can embed a raster image in an SVG file but the raster
content
will just be pixels it won't have any vector nature to it).
However if you have code somewhere that makes a whole bunch of calls
to a Graphics2D interface (drawline, drawtext, etc). The you should
create the SVGGraphics2D and substitute this for what ever the current
Graphics2D instance is (perhaps from a BufferedImage via createGraphics,
or something passed in from swing).
> I feel that I am missing something basic about managing images on Java.
I agree but I'd need more info about what you are currently doing
to create this 'Image' and what form that 'Image' takes in your
application,
before I can help much more than what I already have.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org