w = SVGUtilities.svgToUserSpace(svgElement,
ATTR_WIDTH, s,
uctx,
UnitProcessor.HORIZONTAL_LENGTH);
if (w < 0) {
throw new IllegalAttributeValueException(
Messages.formatMessage("rect.width.negative", null));
}
}
// parse the height attribute (required and must be positive)
s = svgElement.getAttributeNS(null, ATTR_HEIGHT);
float h;
if (s.length() == 0) {
throw new MissingAttributeException(
Messages.formatMessage("rect.height.required", null));
} else {
h = SVGUtilities.svgToUserSpace(svgElement,
ATTR_HEIGHT, s,
uctx,
UnitProcessor.VERTICAL_LENGTH);
if (h < 0) {
throw new IllegalAttributeValueException(
Messages.formatMessage("rect.height.negative", null));
}
}
// parse the rx attribute (must be positive if any)
s = svgElement.getAttributeNS(null, ATTR_RX);
boolean rxs = s.length() != 0;
float rx = 0;
if (s.length() != 0) {
rx = SVGUtilities.svgToUserSpace(svgElement,
ATTR_RX, s,
uctx,
UnitProcessor.HORIZONTAL_LENGTH);
if (rx < 0) {
throw new IllegalAttributeValueException(
Messages.formatMessage("rect.rx.negative", null));
}
}
rx = (rx > w / 2) ? w / 2 : rx;
// parse the ry attribute (must be positive if any)
s = svgElement.getAttributeNS(null, ATTR_RY);
boolean rys = s.length() != 0;
float ry = 0;
if (s.length() != 0) {
ry = SVGUtilities.svgToUserSpace(svgElement,
ATTR_RY, s,
uctx,
UnitProcessor.VERTICAL_LENGTH);
if (ry < 0) {
throw new IllegalAttributeValueException(
Messages.formatMessage("rect.ry.negative", null));
}
}
ry = (ry > h / 2) ? h / 2 : ry;
Shape shape = null;