Duplicate :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode) A DESCRIPTION OF THE PROBLEM : Create a child raster by createWritableChild with an x-offset and contains the bottom-right pixel. Then AffineTransformOp filter produce an ImagingOpException. If x-offset is 0 or the child raster doesn't contains the bottom-right pixel, the filter works well. ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.awt.image.ImagingOpException: Unable to transform src image at java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:358) at TestAffineOp3.main(TestAffineOp3.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.geom.AffineTransform; import java.awt.image.*; public class TestAffineOp3 { public static void main(String args[]) { WritableRaster srcRaster, dstRaster; DataBuffer db; AffineTransform at = new AffineTransform(); at.setToScale(4.0, 4.0); AffineTransformOp ato = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); // UShort pixels short[] shortPixels = { 1001, 1002, 1003, 1004, 2001, 2002, 2003, 2004, 3001, 3002, 3003, 3004, 4001, 4002, 4003, 4004 }; System.out.println(shortPixels.length); for (int j = 0, k = 0; j < 4; j++) { for (int i = 0; i < 4; i++, k++) System.out.print(shortPixels[k] + "\t"); System.out.println(); } // source raster db = new DataBufferUShort(shortPixels, shortPixels.length); int[] offsets = {0}; srcRaster = Raster.createInterleavedRaster(db, 4, 4, 4, 1, offsets, null); // writable child raster srcRaster = srcRaster.createWritableChild(1, 1, 3, 3, 0, 0, null); // destination raster dstRaster = ato.filter(srcRaster, null); db = dstRaster.getDataBuffer(); shortPixels = ((DataBufferUShort)db).getData(); System.out.println(shortPixels.length); for (int j = 0, k = 0; j < 12; j++) { for (int i = 0; i < 12; i++, k++) System.out.print(shortPixels[k] + "\t"); System.out.println(); } } } ---------- END SOURCE ----------
|