harness.checkPoint("(int, int, int, int, DataBuffer(UShort))");
SinglePixelPackedSampleModel m1 = new SinglePixelPackedSampleModel(
DataBuffer.TYPE_USHORT, 2, 3, new int[] { 0xFF00, 0x00FF }
);
short[] s = new short[] { (short) 0x1111, (short) 0x2222, (short) 0x3333, (short) 0x4444, (short) 0x5555, (short) 0x6666 };
DataBuffer db = new DataBufferUShort(s, 6);
// set a value
m1.setSample(0, 0, 0, 0x00CC, db);
m1.setSample(1, 0, 0, 0x00BB, db);
m1.setSample(0, 1, 0, 0x00AA, db);
m1.setSample(1, 1, 0, 0x0099, db);
m1.setSample(0, 2, 0, 0x0088, db);
m1.setSample(1, 2, 0, 0x0077, db);
m1.setSample(0, 0, 1, 0x0077, db);
m1.setSample(1, 0, 1, 0x0088, db);
m1.setSample(0, 1, 1, 0x0099, db);
m1.setSample(1, 1, 1, 0x00AA, db);
m1.setSample(0, 2, 1, 0x00BB, db);
m1.setSample(1, 2, 1, 0x00CC, db);
harness.check(db.getElem(0), 0xCC77);
harness.check(db.getElem(1), 0xBB88);
harness.check(db.getElem(2), 0xAA99);
harness.check(db.getElem(3), 0x99AA);
harness.check(db.getElem(4), 0x88BB);
harness.check(db.getElem(5), 0x77CC);
// set a value with non-standard scanline stride
SinglePixelPackedSampleModel m2 = new SinglePixelPackedSampleModel(
DataBuffer.TYPE_USHORT, 2, 2, 3, new int[] { 0xFF00, 0x00FF }
);
m2.setSample(0, 0, 0, 0x0044, db);
m2.setSample(1, 0, 0, 0x0033, db);
m2.setSample(0, 1, 0, 0x0022, db);
m2.setSample(1, 1, 0, 0x0011, db);
m2.setSample(0, 0, 1, 0x0011, db);
m2.setSample(1, 0, 1, 0x0022, db);
m2.setSample(0, 1, 1, 0x0033, db);
m2.setSample(1, 1, 1, 0x0044, db);
harness.check(db.getElem(0), 0x4411);
harness.check(db.getElem(1), 0x3322);
harness.check(db.getElem(3), 0x2233);
harness.check(db.getElem(4), 0x1144);
// set a value with x < 0
try
{
m1.setSample(-1, 0, 0, 0x0044, db);