EVALUATION
The idea of this fix is to force png reader to create buffered image of
some standard type for pngs of color type RGB or RGBAlpha and bit depth
8.
I suggest to add appropriate standard image types to the list of image
types constructed by the reader. Namely:
* for RGB color type we add TYPE_3BYTE_BGR, TYPE_INT_RGB and
TYPE_INT_BGR.
* for RGBAlpha color type we add TYPE_4BYTE_ABGR and TYPE_INT_RGB.
Also we need to override getRawImageType() method to keep custom
image type as a raw one.
Note that destination types based on InteherInterleaveRaster (TYPE_INT_RGB, TYPE_INT_BGR, TYPE_INT_ARGB) may cause performance
degradation. It is because ByteInterleavedRaster provides optimized
setRect() routine if argument is raster of same type. However IntegerInterleasvedRaster does not provide optimized setRect()
implementation and uses generic one inherited from WritableRaster class.
It seems to me that we get some improvements if we will use
getPixel()/setPixel() approach instead of setRect() for raster differ
form ByteInterleavedRaster.
|