Hi,
I have a problem about converting java project to android. what makes
me confuse is the equivalent SampleModel, ColorModel, WritableRaster,
and TiledImage for android? here is the snipped code:
SampleModel sampleModel = RasterFactory.createBandedSampleModel(
DataBuffer.TYPE_BYTE, 4 * numXTiles, 4* numYTiles, 1);
ColorModel colorModel = PlanarImage.createColorModel(sampleModel);
WritableRaster decWRaster = RasterFactory.createWritableRaster(
sampleModel, null);
for (int j = 0; j < numYTiles; j++) {
for (int i = 0; i < numXTiles; i++) {
int indexEnc = disEnc.readByte();
if (indexEnc < 0) indexEnc = indexEnc + 128;
System.out.print(indexEnc + " ");
int[] codeWord = codeBook[indexEnc];
decWRaster.setPixels(i * 4, j * 4, 4, 4, codeWord);
}
}
TiledImage decTImage = new TiledImage(0, 0, 4 * numXTiles,
4 * numYTiles, 0, 0, sampleModel, colorModel);
decTImage.setData(decWRaster);
JAI.create("FileStore", decTImage, decPath + "test4.bmp",
"BMP");
this code is for creating an image with int[] as the input, and tiling
each pixel to 4x4 box which width is numXTiles*4 and height is
numYTiles*4.
can anyone help? many thx :)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en