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 Michael Voyes <qm...@ocegr.fr> on 2004/10/26 15:23:32 UTC

gif image Auto-Scale

Ok, it is working with the command add-on concerning memory. 
Furthermore, the result is GOOD.
I'm therefore wondering if my code is good :

remember :

OutputStream outputStream = new FileOutputStream (outputFileName);
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(ostream);
SVGAbstractTranscoder transDoc = new SVGAbstractTranscoder();
transDoc.transcode((Document)doc, (OutputStream)outputFileName, output);
Filter f = transDoc.root.getGraphicsNodeRable(true);
curTxf = new AffineTransform();
RenderContext rc = new RenderContext(curTxf, null, null);
RenderedImage img = f.createRendering(rc);

you seem to not agree with this piece of code to Render the doc DOM. 
Again, if this code is causing the wrong result i described (and it 
seems to be the case), i'm asking what is your piece of code advise to 
get the good result taking a DOM in input ?


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


Re: gif image Auto-Scale

Posted by Thomas DeWeese <Th...@Kodak.com>.
Michael Voyes wrote:

> 
> Ok, it is working with the command add-on concerning memory. 
> Furthermore, the result is GOOD.
> I'm therefore wondering if my code is good :
> 
> remember :

    I would take the approach taken in 
contrib/tiledTranscoder/TiledImageTranscoder (which it looks like
you filched code from).  In particular I'm not sure the GVT tree
is good after 'transcode(...)' completes (the bridge context is
disposed of which _may_ be the source of your problems).

    So I would subclass SVGAbstractTranscoder and generate your
output in the transcode method.  Don't try and use anything from
the transcoder after the transcode method completes.

> OutputStream outputStream = new FileOutputStream (outputFileName);
> ByteArrayOutputStream ostream = new ByteArrayOutputStream();
> TranscoderOutput output = new TranscoderOutput(ostream);
> SVGAbstractTranscoder transDoc = new SVGAbstractTranscoder();
> transDoc.transcode((Document)doc, (OutputStream)outputFileName, output);
> Filter f = transDoc.root.getGraphicsNodeRable(true);
> curTxf = new AffineTransform();
> RenderContext rc = new RenderContext(curTxf, null, null);
> RenderedImage img = f.createRendering(rc);
> 
> you seem to not agree with this piece of code to Render the doc DOM. 
> Again, if this code is causing the wrong result i described (and it 
> seems to be the case), i'm asking what is your piece of code advise to 
> get the good result taking a DOM in input ?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 


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