/** * Creates a new {@link Rectangle} within <code>bounds</code>, using * <code>spans</code> to create some insets. * @param bounds the boundaries to shrink * @param node the node to evaluate * @return the smaller boundaries */ public Rectangle modifyBounds( Rectangle bounds, SpanSplitNode node ){ Span[] spans = node.getSpans(); if( spans == null ){ return bounds; } Rectangle copy = new Rectangle( bounds ); int left = spans[LEFT].getSize(); int right = spans[RIGHT].getSize(); int top = spans[TOP].getSize(); int bottom = spans[BOTTOM].getSize(); copy.x += left; copy.width -= left + right; copy.y += top; copy.height -= top + bottom; return copy; } }
/** * Creates a new {@link Rectangle} within <code>bounds</code>, using * <code>spans</code> to create some insets. * @param bounds the boundaries to shrink * @param node the node to evaluate * @return the smaller boundaries */ public Rectangle modifyBounds( Rectangle bounds, SpanSplitNode node ){ Span[] spans = node.getSpans(); if( spans == null ){ return bounds; } Rectangle copy = new Rectangle( bounds ); int left = spans[LEFT].getSize(); int right = spans[RIGHT].getSize(); int top = spans[TOP].getSize(); int bottom = spans[BOTTOM].getSize(); copy.x += left; copy.width -= left + right; copy.y += top; copy.height -= top + bottom; return copy; } }