// This returns Bounds2D-Padding. Note that Bounds2D includes local translation // (ie relative to parent) public static FixedBoxModelElement PaddedBounds(IBoxModelElement element, float fPadding) { AxisAlignedBox2f bounds = element.Bounds2D; bounds.Contract(fPadding); return(new FixedBoxModelElement(bounds)); }
// This returns ContentBounds with a padding offset public static AxisAlignedBox2f PaddedContentBounds(IBoxModelElement element, float fPadding) { AxisAlignedBox2f bounds = element.Bounds2D; bounds.Translate(-bounds.Center); bounds.Contract(fPadding); return(bounds); }