// Test all the default color models
private void colorModelTest(TestHarness harness)
{
Kernel kern = new Kernel(3, 3, new float[] {1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f});
ConvolveOp op = new ConvolveOp(kern, ConvolveOp.EDGE_NO_OP, null);
int[] types = {BufferedImage.TYPE_INT_RGB,
BufferedImage.TYPE_INT_ARGB,
BufferedImage.TYPE_INT_ARGB_PRE,
BufferedImage.TYPE_3BYTE_BGR,
BufferedImage.TYPE_4BYTE_ABGR,
BufferedImage.TYPE_4BYTE_ABGR_PRE,
BufferedImage.TYPE_USHORT_565_RGB,
BufferedImage.TYPE_USHORT_555_RGB,
BufferedImage.TYPE_BYTE_GRAY,
BufferedImage.TYPE_USHORT_GRAY};
// Skipped types that are not implemented yet:
// TYPE_CUSTOM, TYPE_INT_BGR, TYPE_BYTE_BINARY, TYPE_BYTE_INDEXED
for (int i = 0; i < types.length; i++)
{
int type = types[i];
harness.checkPoint("type: " + type);
BufferedImage img = new BufferedImage(25, 40, type);
BufferedImage dest = op.createCompatibleDestImage(img, null);
// Unlike most Ops, this one creates a clone of the original image
harness.check(dest.getColorModel().getPixelSize(),
img.getColorModel().getPixelSize());