Hello Felicia,

The first time you use the rasterizer, a lot of the time goes into class loading and that slows down your initial rendering. Given that you get a consisten rendering after that, I do not think there is anything else funky going on.

Regards,
Vincent.

Felicia Ionascu wrote:
Hello Batik Users,

I have a weird behaviour with a TIFF transcoder.
I have a Document created by parsing a SVG file.  I did time
measurements and saw that the first time when launching the application,
the whole operation takes about 5 seconds. Then, time decreases to 1
second and it stays there.
The rasterization operation is the most time-consuming, and I observed
that the time spent in it decreases about 7 times. Why?!

I am pleased with the behaviour but I fear it hides something dangerous
:-)

Here are the involved code fragments. First call parse, then rasterize.
mDocument is declared at class level like this:

 private Document  mDocument = null;

 public void parse (String fileName) {
   try {
      String parser = XMLResourceDescriptor.getXMLParserClassName();
      SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);

      mDocument = factory.createDocument(fileName);
    } catch (IOException ex) {
    }
 }

 public void rasterize (String outputFileName){
     byte[] myByteArray;
     TIFFTranscoder t = new TIFFTranscoder();

       TranscoderInput input = new TranscoderInput(mDocument);
      try {
          ByteArrayOutputStream ostream = new ByteArrayOutputStream();
          TranscoderOutput output = new TranscoderOutput(ostream);
          t.transcode(input, output);
          ostream.flush();
          ostream.close();

          myByteArray = ostream.toByteArray();
          ByteArrayInputStream istream = new
ByteArrayInputStream(myByteArray);
          //read the ARGB TIFF in memory and write it in RGB on the disk
to change the transparency property:
          transformImage (istream, outputFileName);
          istream.close();
       } catch (FileNotFoundException ex) {
       } catch (IOException ex) {
       } catch (TranscoderException ex) {
       }
}


Best Regards,
Felicia




--
------------------------------------------------------------
 Felicia IONASCU                 Oc� Print Logic Technologies
 mailto:[EMAIL PROTECTED]             1, rue Jean Lemoine
 phone : +33 (0)1 48 98 81 99    94015 Cr�teil cedex, France
 fax:    +33 (0)1 48 98 54 50    http://www.oce.com/
------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to