@Test public void testBounds() { GeneralPath gp = new GeneralPath(); gp.moveTo(0f, 0f); gp.lineTo(1, 0.3); gp.lineTo(0f, 0.6f); gp.closePath(); AffineTransform at = AffineTransform.getScaleInstance(1.5, 1.5); TransformedShape ts = new TransformedShape(gp, at); assertEquals(new Rectangle(0, 0, 2, 1), ts.getBounds()); }
public Rectangle getBounds() { Rectangle2D rect = getBounds2D(); int minx = (int) Math.floor(rect.getMinX()); int miny = (int) Math.floor(rect.getMinY()); int maxx = (int) Math.ceil(rect.getMaxX()); int maxy = (int) Math.ceil(rect.getMaxY()); return new Rectangle(minx, miny, maxx - minx, maxy - miny); }
TransformedShape extends AffineTransform implements Shape { public Rectangle getBounds() { Rectangle2D rect = getBounds2D(); int minx = (int) Math.floor(rect.getMinX()); int miny = (int) Math.floor(rect.getMinY()); int maxx = (int) Math.ceil(rect.getMaxX()); int maxy = (int) Math.ceil(rect.getMaxY()); return new Rectangle(minx, miny, maxx - minx, maxy - miny); } }
TransformedShape extends AffineTransform implements Shape { public Rectangle getBounds() { Rectangle2D rect = getBounds2D(); int minx = (int) Math.floor(rect.getMinX()); int miny = (int) Math.floor(rect.getMinY()); int maxx = (int) Math.ceil(rect.getMaxX()); int maxy = (int) Math.ceil(rect.getMaxY()); return new Rectangle(minx, miny, maxx - minx, maxy - miny); } TransformedShape();  TransformedShape(Shape shape, AffineTransform at); }
TransformedShape extends AffineTransform implements Shape { public Rectangle getBounds() { Rectangle2D rect = getBounds2D(); int minx = (int) Math.floor(rect.getMinX()); int miny = (int) Math.floor(rect.getMinY()); int maxx = (int) Math.ceil(rect.getMaxX()); int maxy = (int) Math.ceil(rect.getMaxY()); return new Rectangle(minx, miny, maxx - minx, maxy - miny); } TransformedShape();  TransformedShape(Shape shape, AffineTransform at); void getMatrix(final float[] matrix, int offset); void setTransform(final float[] matrix, int offset); void setTransform(final double[] matrix); void scale(final double s); boolean contains(double x, double y); boolean contains(final Point2D p); boolean contains(double x, double y, double width, double height); boolean contains(final Rectangle2D r); boolean intersects(double x, double y, double width, double height); boolean intersects(final Rectangle2D r); Rectangle getBounds(); Rectangle2D getBounds2D(); PathIterator getPathIterator(AffineTransform at); PathIterator getPathIterator(AffineTransform at, final double flatness); }
TransformedShape extends AffineTransform implements Shape { public Rectangle getBounds() { Rectangle2D rect = getBounds2D(); int minx = (int) Math.floor(rect.getMinX()); int miny = (int) Math.floor(rect.getMinY()); int maxx = (int) Math.ceil(rect.getMaxX()); int maxy = (int) Math.ceil(rect.getMaxY()); return new Rectangle(minx, miny, maxx - minx, maxy - miny); } TransformedShape();  TransformedShape(Shape shape, AffineTransform at); void getMatrix(final float[] matrix, int offset); void setTransform(final float[] matrix, int offset); void setTransform(final double[] matrix); void scale(final double s); boolean contains(double x, double y); boolean contains(final Point2D p); boolean contains(double x, double y, double width, double height); boolean contains(final Rectangle2D r); boolean intersects(double x, double y, double width, double height); boolean intersects(final Rectangle2D r); Rectangle getBounds(); Rectangle2D getBounds2D(); PathIterator getPathIterator(AffineTransform at); PathIterator getPathIterator(AffineTransform at, final double flatness); public Shape shape; }