ColorModel cm = xconf.getColorModel();
SampleModel sm;
DataBuffer db;
int scanlineStride, dataType;
int bpp = xImage.get_bits_per_pixel();
Int8Pointer dataPtr = xImage.get_data();
switch (bpp) {
case 32: {
dataType = DataBuffer.TYPE_INT;
scanlineStride = xImage.get_bytes_per_line() >> 2;
int size = scanlineStride * height;
// Create data buffer
int[] data = new int[size];
Utils.memaccess.getInt(dataPtr.lock(), data, xImage.get_xoffset(), size);
dataPtr.unlock();
db = new DataBufferInt(data, size);
break;
}
case 16: {
dataType = DataBuffer.TYPE_USHORT;
scanlineStride = xImage.get_bytes_per_line() >> 1;
int size = scanlineStride * height;
// Create data buffer
short[] data = new short[size];
Utils.memaccess.getShort(dataPtr.lock(), data, xImage.get_xoffset(), size);
dataPtr.unlock();
db = new DataBufferShort(data, size);
break;
}
case 8:
case 4:
case 2:
case 1: {
dataType = DataBuffer.TYPE_BYTE;
scanlineStride = xImage.get_bytes_per_line();
int size = scanlineStride * height;
// Create data buffer
byte[] data = new byte[size];
Utils.memaccess.getByte(dataPtr.lock(), data, xImage.get_xoffset(), size);
dataPtr.unlock();
db = new DataBufferByte(data, size);
break;
}
default: {