Large Performance Gap: AWT <-> SWT

Help
Leon
2010-09-06
2013-04-17
  • Leon

    Leon - 2010-09-06

    Hi,

    we are implementing a small project using the JPod(+Render) Library. Probably the best open source pdf library, you did a really good job.

    We just observed a large performance gap between the SWT and AWT rendering process. The CwtSwtGraphicsContext outperforms the CwtAwtGraphicsContext by more than one magnitude.
    Did we mess something up with our AWT(Swing) implementation?
    Or is there really a huge performance difference between the  SWT and AWT rendering process?

     
  • Elfi Heck

    Elfi Heck - 2010-09-08

    Truth is, I have no idea. AWT rendering performance *should* be in the same range as SWT but as our own product uses SWT we are concentrating on this. Last time we used the AWT rendering we didn't observe any huge performance problems.

     
  • Leon

    Leon - 2010-09-08

    yeah, could be.
    We'll try to figure it out… and post our experience.

     
  • Martin Tschirsich

    Hi,

    here it is, our experience: working on the same project as basicnik, we tried to convert any image read from the pdf with a ColorCOnvertOp, as mentioned in the other thread.

    We simply modified the getBufferedImage()-method in ImageConverterPdf2Awt:

    public BufferedImage getBufferedImage() {
        if (bufferedImage == null) {
            bufferedImage = createBufferedImage();
    
            // BEGIN MODIFICATION
            BufferedImage bufferedImageConverted = new BufferedImage(
                bufferedImage.getWidth(),
                bufferedImage.getHeight(),
                BufferedImage.TYPE_INT_ARGB);
    
            ColorConvertOp op = new ColorConvertOp(null);
                    op.filter(bufferedImage, bufferedImageConverted);    
                
            bufferedImage = bufferedImageConverted;
            // END MODIFICATION
        }
        return bufferedImage;
    }
    

    The results were as expected - after the modification, there was no real difference between the SWT and AWT implementation (there might be more elegant ways to achieve this, though).

     
  • Martin Tschirsich

    Just for clarification: The code above is only suitable for testing, since not all conversions are supported.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks