I was reusing the AWTSWTImageUtils class in another project and noticed an 
inconsistency.

The createBufferedImage method consists of:

    /** Create a buffered image that can be be converted to SWTland later */
    public static BufferedImage createBufferedImage( int w, int h ) {
        //AWTSWTImageUtils.checkAccess();
        return new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR_PRE);
    }


But the createImagerData method is optimised for TYPE_3BYTE_BGR.

The consequence of this is that we are using a for loop to copy bytes over from 
the BufferedImage to an SWT image one at a time. Changing over to BGR did not 
actually help (the result lacked transparency and came out all black). I had 
always assumed that this optimisation was intended for windows or linux or 
something - but in testing today it is not used on Windows either.

So chances are there is some performance left on the ground here we could 
really use.

Jesse do you remember if it is possible to set up a BufferedImage we can 
cleanly use for ImageData? Or am I missing the point here.


-- 
Jody Garnett

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to