@Test public void testHasExplicitDestinationParamWithDestinationOffset() { ImageReadParam param = new ImageReadParam(); param.setDestinationOffset(new Point(42, 42)); assertTrue(ImageReaderBase.hasExplicitDestination(param)); }
@Test public void testHasExplicitDestinationParamWithDestinationOffsetOrigin() { ImageReadParam param = new ImageReadParam(); param.setDestinationOffset(new Point(0, 0)); assertFalse(ImageReaderBase.hasExplicitDestination(param)); } }
@SuppressWarnings("ConstantConditions") @Test public void testSetDestinationOffsetNull() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); try { param.setDestinationOffset(null); fail("Null offset not allowed"); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().toLowerCase().contains("offset")); } reader.dispose(); }
@Test public void testSetDestinationOffset() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); Point point = new Point(37, 42); param.setDestinationOffset(point); BufferedImage image = reader.read(0, param); assertNotNull(image); assertEquals(reader.getWidth(0) + point.x, image.getWidth()); assertEquals(reader.getHeight(0) + point.y, image.getHeight()); reader.dispose(); }
ImageReadParam param = reader.getDefaultReadParam(); param.setDestination(img); for (int i = 0; i++; i < n) { param.setDestinationOffset(new Point(w * i, 0); reader.read(i, param); }
irp.setDestinationOffset(new Point(dstOffX, dstOffY));
public void testSetDestinationOffsetNull() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); try { param.setDestinationOffset(null); fail("Null offset not allowed"); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().toLowerCase().contains("offset")); } }
@Test public void testHasExplicitDestinationParamWithDestinationOffsetOrigin() { ImageReadParam param = new ImageReadParam(); param.setDestinationOffset(new Point(0, 0)); assertFalse(ImageReaderBase.hasExplicitDestination(param)); } }
/** Makes a copy of the incoming parameters into the parameter that is used for the nested image reader */ protected void copyReadParam(ImageReadParam src, ImageReadParam dst) { dst.setDestination(src.getDestination()); dst.setSourceRegion(src.getSourceRegion()); dst.setSourceSubsampling(src.getSourceXSubsampling(), src .getSourceYSubsampling(), src.getSubsamplingXOffset(), src .getSubsamplingYOffset()); dst.setDestinationOffset(src.getDestinationOffset()); if (ImageReaderFactory.getInstance().needsImageTypeSpecifier(tsuid)) { dst.setDestinationType(createImageTypeSpecifier()); } //if lossy jpeg2000 and using the jai j2k reader //a workaround for http://java.net/jira/browse/JAI_IMAGEIO_CORE-175 if(J2KIMAGE_READ_PARAM_CLASS != null && J2KIMAGE_READ_PARAM_CLASS.isAssignableFrom(dst.getClass())) { try { J2KIMAGE_READ_PARAM_SET_RESOLUTION.invoke(dst, Integer.MAX_VALUE); } catch (Exception e) { log.info("A Failure occurred attempting to set the resolution for a jai J2KImageReadParam. This may result in degraded image quality.", e); } } }
@Test public void testHasExplicitDestinationParamWithDestinationOffset() { ImageReadParam param = new ImageReadParam(); param.setDestinationOffset(new Point(42, 42)); assertTrue(ImageReaderBase.hasExplicitDestination(param)); }
@SuppressWarnings("ConstantConditions") @Test public void testSetDestinationOffsetNull() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); try { param.setDestinationOffset(null); fail("Null offset not allowed"); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().toLowerCase().contains("offset")); } }
public void testSetDestinationOffset() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); Point point = new Point(37, 42); param.setDestinationOffset(point); BufferedImage image = reader.read(0, param); assertNotNull(image); assertEquals(reader.getWidth(0) + point.x, image.getWidth()); assertEquals(reader.getHeight(0) + point.y, image.getHeight()); }
param.setDestinationOffset(org); BufferedImage bi = reader.read(imageIndex, param); WritableRaster ras = bi.getRaster();
param.setDestinationOffset(org); BufferedImage bi = reader.read(imageIndex, param); WritableRaster ras = bi.getRaster();
@Test public void testSetDestinationOffset() throws IOException { final ImageReader reader = createReader(); TestData data = getTestData().get(0); reader.setInput(data.getInputStream()); ImageReadParam param = reader.getDefaultReadParam(); Point point = new Point(37, 42); param.setDestinationOffset(point); BufferedImage image = reader.read(0, param); assertNotNull(image); assertEquals(reader.getWidth(0) + point.x, image.getWidth()); assertEquals(reader.getHeight(0) + point.y, image.getHeight()); }
param.setDestination(bi); param.setDestinationBands(bmpParam.getDestinationBands()); param.setDestinationOffset(bmpParam.getDestinationOffset()); param.setSourceBands(bmpParam.getSourceBands()); param.setSourceRegion(bmpParam.getSourceRegion());
param.setDestination(bi); param.setDestinationBands(bmpParam.getDestinationBands()); param.setDestinationOffset(bmpParam.getDestinationOffset()); param.setSourceBands(bmpParam.getSourceBands()); param.setSourceRegion(bmpParam.getSourceRegion());
Point p = this.getDestinationOffset(); if (p != null) { param.setDestinationOffset((Point) p.clone());
newParam.setDestinationOffset(param.getDestinationOffset());
Point p = this.getDestinationOffset(); if (p != null) { param.setDestinationOffset((Point) p.clone());