@Test public void unitBounds() throws Exception { System.out.println(" unit bounds transform"); Rectangle r = new Rectangle(-100, 100, 1000, 2000); CoordinateTransform tr = CoordinateTransforms.unitBounds(r); assertPoint(r.x, r.y, tr.worldToImage(0, 0, null)); assertPoint(r.x + r.width, r.y + r.height, tr.worldToImage(1, 1, null)); }
public void runScriptWithBuilder(String script, String destVar, WritableRenderedImage destImage) throws JiffleException { // Image bounds are taken from the destination image Rectangle imageBounds = new Rectangle( destImage.getMinX(), destImage.getMinY(), destImage.getWidth(), destImage.getHeight()); // The world bounds are the unit rectangle Rectangle2D worldBounds = new Rectangle2D.Double(0, 0, 1, 1); CoordinateTransform transform = CoordinateTransforms.unitBounds(imageBounds); JiffleBuilder builder = new JiffleBuilder(); // Set the processing area (world units) builder.worldAndNumPixels(worldBounds, destImage.getWidth(), destImage.getHeight()); // Set the script and the destination image with its transform builder.script(script).dest(destVar, destImage, transform); // This executes the script and writes the results into destImage builder.run(); } // docs end builder method
CoordinateTransform transform = CoordinateTransforms.unitBounds(imageBounds);
CoordinateTransform tr = CoordinateTransforms.unitBounds(imageBounds); runtime.setDefaultTransform(tr);