@Test public void translation() throws Exception { System.out.println(" translation transform"); CoordinateTransform tr = CoordinateTransforms.translation(10, -10); Point pt = tr.worldToImage(100, 100, null); assertPoint(110, 90, pt); }
/** * Setting a default transform without having previously set the world * bounds should throw a JiffleException. */ @Test(expected=JiffleException.class) public void forgetTheWorldBeforeDefaultTransform() throws Exception { System.out.println(" forget to set the world before setting default transform"); JiffleDirectRuntime runtime = getRuntime("images {dest=write;} dest = 42;"); CoordinateTransform tr = CoordinateTransforms.translation(10, 10); runtime.setDefaultTransform(tr); }
/** * Setting an image with a transform without having previously set the world * bounds should throw a JiffleException. */ @Test(expected=JiffleException.class) public void forgetTheWorldBeforeImageWithTransform() throws Exception { System.out.println(" forget to set the world before setting image with transform"); JiffleDirectRuntime runtime = getRuntime("images {dest=write;} dest = 42;"); WritableRenderedImage destImage = ImageUtilities.createConstantImage(IMG_WIDTH, IMG_WIDTH, 0d); CoordinateTransform tr = CoordinateTransforms.translation(10, 10); runtime.setDestinationImage("dest", destImage, tr); }