harness.checkPoint("createCompatibleDestRaster");
// Simple test
Raster src = Raster.createBandedRaster(DataBuffer.TYPE_INT, 25, 40, 3, new Point(5, 5));
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);
try
{
Raster dst = op.createCompatibleDestRaster(src);
harness.check(dst.getHeight(), src.getHeight());
harness.check(dst.getWidth(), src.getWidth());
harness.check(dst.getNumBands(), src.getNumBands());
harness.check(dst.getTransferType(), src.getTransferType());
harness.check(dst.getDataBuffer().getDataType(), src.getDataBuffer().getDataType());
harness.check(dst.getNumDataElements(), src.getNumDataElements());
}
catch (IllegalArgumentException e)
{
harness.check(false);
}
// Try a different type
src = Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 25, 40, 3, new Point(5, 5));
try
{
Raster dst = op.createCompatibleDestRaster(src);
harness.check(dst.getNumBands(), src.getNumBands());
harness.check(dst.getTransferType(), src.getTransferType());
harness.check(dst.getDataBuffer().getDataType(), src.getDataBuffer().getDataType());
harness.check(dst.getNumDataElements(), src.getNumDataElements());
}
catch (IllegalArgumentException e)
{
harness.check(false);
}
// Try a different number of bands
src = Raster.createBandedRaster(DataBuffer.TYPE_INT, 25, 40, 5, new Point(5, 5));
try
{
Raster dst = op.createCompatibleDestRaster(src);
harness.check(dst.getNumBands(), src.getNumBands());
harness.check(dst.getTransferType(), src.getTransferType());
harness.check(dst.getDataBuffer().getDataType(), src.getDataBuffer().getDataType());
harness.check(dst.getNumDataElements(), src.getNumDataElements());
}