public BorderPropertySet normalizedInstance(Rectangle bounds) { float factor = 1; // top factor = Math.min(factor, bounds.width / getSideWidth(_topLeft, _topRight, bounds.width)); // bottom factor = Math.min(factor, bounds.width / getSideWidth(_bottomRight, _bottomLeft, bounds.width)); // right factor = Math.min(factor, bounds.height / getSideWidth(_topRight, _bottomRight, bounds.height)); // left factor = Math.min(factor, bounds.height / getSideWidth(_bottomLeft, _bottomRight, bounds.height)); BorderPropertySet newPropSet = new BorderPropertySet( _top, _right, _bottom, _left, new BorderRadiusCorner( factor * _topLeft.getMaxLeft(bounds.height), factor * _topLeft.getMaxRight(bounds.width)), new BorderRadiusCorner( factor * _topRight.getMaxLeft(bounds.width), factor * _topRight.getMaxRight(bounds.height)), new BorderRadiusCorner( factor * _bottomRight.getMaxLeft(bounds.height), factor * _bottomRight.getMaxRight(bounds.width)), new BorderRadiusCorner( factor * _bottomLeft.getMaxLeft(bounds.width), factor * _bottomLeft.getMaxRight(bounds.height))); newPropSet._topColor = _topColor; newPropSet._rightColor = _rightColor; newPropSet._bottomColor = _bottomColor; newPropSet._leftColor = _leftColor; newPropSet._topStyle = _topStyle; newPropSet._rightStyle = _rightStyle; newPropSet._bottomStyle = _bottomStyle; newPropSet._leftStyle = _leftStyle; return newPropSet; }