List of utility methods to do Rectangle Grow
Rectangle2D | growRectByRelativeSize(Rectangle2D rect, double top, double right, double bottom, double left) grow Rect By Relative Size Rectangle2D r = new Rectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); growRectInPlaceByRelativeSize(r, top, right, bottom, left); return r; |
void | growRectInPlace(Rectangle2D rect, double top, double right, double bottom, double left) grow Rect In Place rect.setRect(rect.getX() - left, rect.getY() - top, rect.getWidth() + left + right, rect.getHeight() + top + bottom); |
Rectangle | growTheRect(Rectangle rect, int factor) Grow the rectangle; useful for GRID_SIZE_INT conversions return (new Rectangle(rect.x * factor, rect.y * factor, rect.width * factor, rect.height * factor)); |
Rectangle | shrink(Rectangle r, int h, int v, boolean clone) shrinks a Rectangle, the center is kept constant if (!clone) { r.x = r.x + v; r.width = r.width - v; r.y = r.y + h; r.height = r.height - h; return r; } else { return new Rectangle(r.x + v, r.width - v, r.y + h, r.height - h); ... |
Rectangle | shrinkSize(Rectangle r, Insets insets) shrink Size if (insets != null) { r = new Rectangle(r.x + insets.left, r.y + insets.top, r.width - insets.left - insets.right, r.height - insets.top - insets.bottom); if (r.width < 0) { r.width = 0; if (r.height < 0) { ... |