xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Jolif <cjo...@ilog.fr>
Subject Re: Use SVGGraphics2D Document as TranscoderInput to JPEGTranscoder?
Date Fri, 24 Aug 2001 08:23:11 GMT
Randall,

I have two answers:

- the first one is: if you don't need to manipulate the DOM between the
drawing primitives on the Graphics2D and the JPEG image, you don't need
Batik at all and the right solution is to use a JPEG Graphics2D as the
one provided with Java 2.
- the second is (if you have to manipulate the DOM), you just have to do
something like:
 
 Document doc = ...
 SVGGraphics2D dst = new SVGGraphics2D(doc);
 // dst.xxx drawing primitives
 Element elmt = dst.getRoot();
 doc.appendChild(elmt);

Then you have a 'doc' Document populated with the result of your
drawings that you can manipulate and then send to the JPEGTranscoder.

Hope this helps.
 

Randall Parker wrote:
> 
> The goal I'm trying to achieve is to make up an SVG DOM tree by making a series of calls
to
> SVGGraphics2D. Then while the data for the image is still in the DOM tree (ie still in
the
> org.w3c.dom.Document) I'd like to give it to JPEGTranscoder.
> 
> In other words, I'd like to avoid the overhead of streaming out the DOM tree. I'd like
to go directly to
> JPEG after making all the SVGGraphics2D calls.
> 
> It looks like it might be possible to use the Document tree originally given to the constructor
of the
> SVGGraphics2D object as the input to the constructor for org.apache.batik.transcoder.TranscoderInput.
> Then it seems like it ought to be possible to call  org.apache.batik.transcoder.image.JPEGTranscoder
> object with that TranscoderInput object using the transcode method it inherits from:
>    org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(TranscoderInput input,
> TranscoderOutput output)
> 
> First of all, is this supposed to be possible to do?
> 
> Secondly, do I need to perform any manipulation to the Document object before giving
it to the
> TranscoderInput constructor?
> 
> I ask the second question because SVGGraphics2D.stream(Element svgRoot, Writer writer,
boolean
> useCss) adds an svgRoot to svgDocument before trying to stream it out. So I'm wondering
whether
> adding that would be a good or bad or indifferent thing to do before trying to generate
a JPEG from the
> Docuiment.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org

-- 
Christophe

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message