} else {
rp = 0;
}
Path2D path = new Path2D.Float();
// top left outside, check that theres a radius to be had
if(leftRadius.getMaxRight(exteriorWidth) > 0) {
Point2D [][] leftCurvePoints = getSubCurve(1-lp,
new Point2D.Double( leftRadius.getMaxRight(exteriorWidth) + lco, tco),
new Point2D.Double( curveConstant*(leftRadius.getMaxRight(exteriorWidth)) + lco, tco),
new Point2D.Double( lco, tco+curveConstant*(leftRadius.getMaxLeft(exteriorHeight))),
new Point2D.Double( lco, tco+leftRadius.getMaxLeft(exteriorHeight)));
path.moveTo( (leftCurvePoints[0][3].getX()), (leftCurvePoints[0][3].getY()));
path.curveTo( leftCurvePoints[0][2].getX(), leftCurvePoints[0][2].getY(),
leftCurvePoints[0][1].getX(), leftCurvePoints[0][1].getY(),
leftCurvePoints[0][0].getX(), leftCurvePoints[0][0].getY());
} else {
path.moveTo( lco, tco);
}
// top right outside
if(rightRadius.getMaxLeft(exteriorWidth) > 0) {
Point2D [][] rightCurvePoints = getSubCurve(1-rp,
new Point2D.Double( sideWidth - rightRadius.getMaxLeft(exteriorWidth) - rco, tco),
new Point2D.Double( sideWidth - curveConstant*(rightRadius.getMaxLeft(exteriorWidth)) - rco, tco),
new Point2D.Double( sideWidth - rco, tco + curveConstant*(rightRadius.getMaxRight(exteriorHeight))),
new Point2D.Double( sideWidth - rco, tco + rightRadius.getMaxRight(exteriorHeight)));
path.lineTo( rightCurvePoints[0][0].getX(), rightCurvePoints[0][0].getY());
path.curveTo( rightCurvePoints[0][1].getX(), rightCurvePoints[0][1].getY(),
rightCurvePoints[0][2].getX(), rightCurvePoints[0][2].getY(),
(rightCurvePoints[0][3].getX()), (rightCurvePoints[0][3].getY()));
} else {
path.lineTo(sideWidth - rightRadius.getMaxLeft(exteriorWidth/2) - rco, tco);
}
// check if we draw the interior
if(drawInterior) {
// start drawing interior
tco = (1+scaledOffset)*topWidth;
lco = (1+scaledOffset)*leftWidth;
rco = (1+scaledOffset)*rightWidth;
// top right interior, check we have a radius
if(rightRadius.getMaxLeft(interiorWidth) > 0) {
Point2D [][] rightCurvePoints = getSubCurve(1-rp,
new Point2D.Double( sideWidth - rightRadius.getMaxLeft(interiorWidth) - rco, tco),
new Point2D.Double( sideWidth - curveConstant*(rightRadius.getMaxLeft(interiorWidth)) - rco, tco),
new Point2D.Double( sideWidth - rco, tco + curveConstant*(rightRadius.getMaxRight(interiorHeight))),
new Point2D.Double( sideWidth - rco, tco + rightRadius.getMaxRight(interiorHeight)));
path.lineTo((rightCurvePoints[0][3].getX()), (rightCurvePoints[0][3].getY()));
path.curveTo( rightCurvePoints[0][2].getX(), rightCurvePoints[0][2].getY(),
rightCurvePoints[0][1].getX(), rightCurvePoints[0][1].getY(),
rightCurvePoints[0][0].getX(), rightCurvePoints[0][0].getY());
} else {
path.lineTo(sideWidth - rco, tco);
}
// top left interior, check we have a radius
if(leftRadius.getMaxRight(interiorWidth) > 0) {
Point2D [][] leftCurvePoints = getSubCurve(1-lp,
new Point2D.Double( leftRadius.getMaxRight(interiorWidth) + lco, tco),
new Point2D.Double( curveConstant*(leftRadius.getMaxRight(interiorWidth)) + lco, tco),
new Point2D.Double( lco, tco + curveConstant*(leftRadius.getMaxLeft(interiorHeight))),
new Point2D.Double( lco, tco + leftRadius.getMaxLeft(interiorHeight)));
path.lineTo(leftCurvePoints[0][0].getX(), leftCurvePoints[0][0].getY());
path.curveTo( leftCurvePoints[0][1].getX(), leftCurvePoints[0][1].getY(),
leftCurvePoints[0][2].getX(), leftCurvePoints[0][2].getY(),
(leftCurvePoints[0][3].getX()), (leftCurvePoints[0][3].getY()));
} else {
path.lineTo(leftRadius.getMaxRight(interiorHeight) + lco, tco);
}
// only close the path if its a full 2d path. If its just the exterior line we leave it open
path.closePath();
}
// rotate and translate our border to the correct side.
path.transform(AffineTransform.getRotateInstance(rotation, 0, 0));
path.transform(AffineTransform.getTranslateInstance(bounds.x + xOffset, bounds.y + yOffset));
return path;
}