}
public void testBig()
{
{
final RGBFormat f = new RGBFormat(new java.awt.Dimension(4, 4), 16, Format.intArray, 1.3414634f, 32, 0xff, 0xff00, 0xff0000, 1, 4, 0, -1);
assertEquals(f.getLineStride(), 4);
assertEquals(f.getPixelStride(), 1);
assertEquals(f.getEndian(), -1);
assertEquals(f.getFlipped(), 0);
final BufferToImage b2i = new BufferToImage(f);
final Buffer buffer = new Buffer();
buffer.setFormat(f);
buffer.setData(new int[] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
final BufferedImage i = (BufferedImage) b2i.createImage(buffer);
assertTrue(i != null);
assertEquals(i.getWidth(), f.getSize().width);
assertEquals(i.getHeight(), f.getSize().height);
assertEquals(i.getColorModel().getColorSpace().getType(), ColorSpace.TYPE_RGB);
assertEquals(i.getType(), BufferedImage.TYPE_INT_BGR);
final int[][] target = new int[][] {new int[] {0,0,0},new int[] {1,0,0},new int[] {2,0,0},new int[] {3,0,0},new int[] {4,0,0},new int[] {5,0,0},new int[] {6,0,0},new int[] {7,0,0},new int[] {8,0,0},new int[] {9,0,0},new int[] {10,0,0},new int[] {11,0,0},new int[] {12,0,0},new int[] {13,0,0},new int[] {14,0,0},new int[] {15,0,0},};
for (int y = 0; y < f.getSize().height; ++y)
{
for (int x = 0; x < f.getSize().width; ++x)
{
final int[] pix = i.getRaster().getPixel(x, y, (int[]) null);
assertEquals(pix[0], target[x + y * f.getSize().width][0]);
assertEquals(pix[1], target[x + y * f.getSize().width][1]);
assertEquals(pix[2], target[x + y * f.getSize().width][2]);
}
}
}
{
final RGBFormat f = new RGBFormat(new java.awt.Dimension(4, 4), 16, Format.intArray, 1.3414634f, 32, 0xff0000, 0xff00, 0xff, 1, 4, 0, -1);
assertEquals(f.getLineStride(), 4);
assertEquals(f.getPixelStride(), 1);
assertEquals(f.getEndian(), -1);
assertEquals(f.getFlipped(), 0);
final BufferToImage b2i = new BufferToImage(f);
final Buffer buffer = new Buffer();
buffer.setFormat(f);
buffer.setData(new int[] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15});
final BufferedImage i = (BufferedImage) b2i.createImage(buffer);
assertTrue(i != null);
assertEquals(i.getWidth(), f.getSize().width);
assertEquals(i.getHeight(), f.getSize().height);
assertEquals(i.getColorModel().getColorSpace().getType(), ColorSpace.TYPE_RGB);
assertEquals(i.getType(), BufferedImage.TYPE_INT_RGB);
final int[][] target = new int[][] {new int[] {0,0,0},new int[] {0,0,1},new int[] {0,0,2},new int[] {0,0,3},new int[] {0,0,4},new int[] {0,0,5},new int[] {0,0,6},new int[] {0,0,7},new int[] {0,0,8},new int[] {0,0,9},new int[] {0,0,10},new int[] {0,0,11},new int[] {0,0,12},new int[] {0,0,13},new int[] {0,0,14},new int[] {0,0,15},};
for (int y = 0; y < f.getSize().height; ++y)
{
for (int x = 0; x < f.getSize().width; ++x)
{
final int[] pix = i.getRaster().getPixel(x, y, (int[]) null);
assertEquals(pix[0], target[x + y * f.getSize().width][0]);
assertEquals(pix[1], target[x + y * f.getSize().width][1]);
assertEquals(pix[2], target[x + y * f.getSize().width][2]);
}
}
}
}