AbstractMultiLevelSource implements MultiLevelSource { @Deprecated public static Rectangle getImageRectangle(int minX, int minY, int width, int height, double scale) { final float scaleFactor = (float) (1.0 / scale); final RenderedOp c = ConstantDescriptor.create((float) width, (float) height, new Float[]{0.0f}, null); final RenderedOp s1 = ScaleDescriptor.create(c, 1.0F, 1.0F, (float) minX, (float) minY, null, null); final RenderedOp s2 = ScaleDescriptor.create(s1, scaleFactor, scaleFactor, 0.0F, 0.0F, null, null); return new Rectangle(s2.getMinX(), s2.getMinY(), s2.getWidth(), s2.getHeight()); } protected  AbstractMultiLevelSource(MultiLevelModel multiLevelModel); @Override MultiLevelModel getModel(); @Override synchronized RenderedImage getImage(int level); @Override Shape getImageShape(int level); @Override synchronized void reset(); @Deprecated static Dimension getImageDimension(int width, int height, double scale); @Deprecated static Rectangle getImageRectangle(int minX, int minY, int width, int height, double scale);  }
@Test public void testImageRectangle() throws Exception { assertEquals(new Rectangle(20, 40, 1024, 512), AbstractMultiLevelSource.getImageRectangle(10, 20, 512, 256, 0.5)); assertEquals(new Rectangle(2000, -120, 768, 994), AbstractMultiLevelSource.getImageRectangle(1000, -60, 384, 497, 0.5)); assertEquals(new Rectangle(0, 248, 192, 249), AbstractMultiLevelSource.getImageRectangle(0, 497, 384, 497, 2.0)); }