basic question: BufferedImage to PlanarImage
I encounter some difficulties in getting a PlanarImage from a BufferedImage.
I have a BufferedImage bi which is a subimage of a previous one.
To create the PlanarImage, I do:
ParameterBlockJAI pb = new ParameterBlockJAI("AWTImage");
PlanarImage planarSource=(PlanarImage)JAI.create("AWTImage", pbttt);
I think that should be good, but, I encounter some problems when using it.
When printing bi and planarSource, I get:
bi : BufferedImage@14d7745: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width
= 555 height = 325 #Bands = 3 xOff = -745 yOff = -162 dataOffset 259945
planarSource : PlanarImage[minX=0 minY=0 width=0 height=0 tileGridXOffset=0 tileGridYOffset=0 tileWidth=0 tileHeight=0 sampleModel=null col
So somehing went wrong and I don't know what.
I tried others ways like :
PlanarImage planarSource=(PlanarImage)AWTImageDescriptor.create((Image)bi, null);
but it is the same.
On this Forum, it has been said :
RenderedOp image = JAI.create("AWTImage", someImage);
but at runtime, JAI says this operation requires a ParameterBlock
Any idea on what's wrong with my code?