Sorry, forgot the subject line the first time
-----Original Message-----
From: Carlos Rodriguez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 03, 2001 10:46 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject:
Hi:
I'm hoping you guys can help me a bit with the following. I have a 16-bit
grayscale image that I want to store in a BufferedImage. For reasons of
performance, I want to put it into an array of ints instead of USHORTS.
This is because I'm informed that AffineTransforms are hopelessly broken
when dealing with USHORT_GRAY. Anyway, once I have my array of ints
(represneting 16bit grayscale) I try the following:
//
//arr is the array of ints
//
DataBuffer dbuff = new DataBufferInt(arr,arr.length);
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
ColorModel cm = new ComponentColorModel(cs, new int[]{16}, false, false,
Transparency.OPAQUE,
DataBuffer.TYPE_INT);
int[] band = {0};
SampleModel sm = new PixelInterleavedSampleModel( dbuff.getDataType(),
width,
height,
1,
height,
band);
WritableRaster raster = Raster.createWritableRaster(sm,dbuff,new
Point(0,0));
BufferedImage bf = new BufferedImage(cm,raster,true,null);
However it comes out all white!
Can anyone shed some light on this? How would you go about it?
Carlos M. Rodriguez, Senior Systems Engineer
Wellogic Inc.
222 Third St. Suite. 2220. Cambridge, MA 02142 Ph: 617-621-9775 x.19
"I look forward to a long period of immaturity followed by death"
-Dave Barry
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".