Methods Summary |
---|
com.sun.perseus.j2d.Box | addNodeBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t)
return addTransformedBBox(bbox, x, y, width, height, t);
|
public boolean | contains(float x, float y, int fillRule)
if (aw == 0 && ah == 0) {
return x >= this.x &&
y >= this.y &&
x < this.x + width &&
y < this.y + height;
} else {
// This code is derived from the java.awt.geom.Rectangle2D and
// java.awt.geom.RoundRectangle2D
float rrx0 = this.x;
float rry0 = this.y;
float rrx1 = rrx0 + width;
float rry1 = rry0 + height;
// Check for trivial rejection - point is outside bounding rectangle
if (x < rrx0 || y < rry0 || x >= rrx1 || y >= rry1) {
return false;
}
float aw = Math.min(width, this.aw) / 2.0f;
float ah = Math.min(height, this.ah) / 2.0f;
// Check which corner point is in and do circular containment
// test - otherwise simple acceptance
if (x >= (rrx0 += aw) && x < (rrx0 = rrx1 - aw)) {
return true;
}
if (y >= (rry0 += ah) && y < (rry0 = rry1 - ah)) {
return true;
}
x = (x - rrx0) / aw;
y = (y - rry0) / ah;
return (x * x + y * y <= 1.0);
}
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)Rect handles x, y, rx, ry, width and height traits as
FloatTraitAnims
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_RX_ATTRIBUTE == traitName
||
SVGConstants.SVG_RY_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else {
return super.createTraitAnimImpl(traitName);
}
|
public void | drawShape(com.sun.perseus.j2d.RenderGraphics rg)
rg.drawRect(x, y, width, height, aw, ah);
|
public void | fillShape(com.sun.perseus.j2d.RenderGraphics rg)
rg.fillRect(x, y, width, height, aw, ah);
|
float | getFloatTraitImpl(java.lang.String name)Rect handles x, y, rx, ry, width and height traits.
Other attributes are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return x;
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return y;
} else if (SVGConstants.SVG_RX_ATTRIBUTE == name) {
return aw / 2;
} else if (SVGConstants.SVG_RY_ATTRIBUTE == name) {
return ah / 2;
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return width;
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return height;
} else {
return super.getFloatTraitImpl(name);
}
|
public float | getHeight()
return height;
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_RECT_TAG;
|
public java.lang.String[] | getRequiredTraits()
return REQUIRED_TRAITS;
|
public float | getRx()
return aw / 2;
|
public float | getRy()
return ah / 2;
|
java.lang.Object | getStrokedPath(com.sun.perseus.j2d.GraphicsProperties gp)Returns the stroked shape, using the given stroke properties.
if (aw > 0 || ah > 0) {
return PathSupport.getStrokedRect(x,
y,
width,
height,
aw,
ah,
gp);
}
return PathSupport.getStrokedRect(x,
y,
width,
height,
gp);
|
public java.lang.String[][] | getTraitAliases()
return new String[][] {
{SVGConstants.SVG_RX_ATTRIBUTE, SVGConstants.SVG_RY_ATTRIBUTE},
{SVGConstants.SVG_RY_ATTRIBUTE, SVGConstants.SVG_RX_ATTRIBUTE} };
|
public java.lang.String | getTraitImpl(java.lang.String name)Rect handles x, y, rx, ry, width and height traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return Float.toString(x);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return Float.toString(y);
} else if (SVGConstants.SVG_RX_ATTRIBUTE == name) {
return Float.toString(aw / 2);
} else if (SVGConstants.SVG_RY_ATTRIBUTE == name) {
return Float.toString(ah / 2);
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return Float.toString(width);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(height);
} else {
return super.getTraitImpl(name);
}
|
public float | getWidth()
return width;
|
public float | getX()
return x;
|
public float | getY()
return y;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype Rect .
return new Rect(doc);
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value[0][0]);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value[0][0]);
} else if (SVGConstants.SVG_RX_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setRx(value[0][0]);
} else if (SVGConstants.SVG_RY_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setRy(value[0][0]);
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setWidth(value[0][0]);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setHeight(value[0][0]);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)Rect handles x, y, rx, ry, width and height traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value);
} else if (SVGConstants.SVG_RX_ATTRIBUTE == name) {
checkPositive(name, value);
setRx(value);
} else if (SVGConstants.SVG_RY_ATTRIBUTE == name) {
checkPositive(name, value);
setRy(value);
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
checkPositive(name, value);
setWidth(value);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
checkPositive(name, value);
setHeight(value);
} else {
super.setFloatTraitImpl(name, value);
}
|
public void | setHeight(float height)
if (height < 0) {
throw new IllegalArgumentException();
}
if (this.height == height) {
return;
}
modifyingNode();
renderingDirty();
this.height = height;
computeCanRenderHeightBit(height);
modifiedNode();
|
public void | setRect(float x, float y, float width, float height)
if (width < 0 || height < 0) {
throw new IllegalArgumentException();
}
if (this.x == x
&& this.y == y
&& this.width == width
&& this.height == height) {
return;
}
modifyingNode();
renderingDirty();
this.x = x;
this.y = y;
this.width = width;
this.height = height;
computeCanRenderWidthBit(width);
computeCanRenderHeightBit(height);
modifiedNode();
|
public void | setRx(float rx)
if (rx < 0) {
throw new IllegalArgumentException();
}
if (2 * rx == aw) {
return;
}
modifyingNode();
renderingDirty();
if (rx > 0) {
aw = 2 * rx;
} else {
aw = 0;
}
modifiedNode();
|
public void | setRy(float ry)
if (ry < 0) {
throw new IllegalArgumentException();
}
if (2 * ry == ah) {
return;
}
modifyingNode();
renderingDirty();
if (ry > 0) {
ah = 2 * ry;
} else {
ah = 0;
}
modifiedNode();
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)Rect handles x, y, rx, ry, width and height traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(parseFloatTrait(name, value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(parseFloatTrait(name, value));
} else if (SVGConstants.SVG_RX_ATTRIBUTE == name) {
setRx(parsePositiveFloatTrait(name, value));
} else if (SVGConstants.SVG_RY_ATTRIBUTE == name) {
setRy(parsePositiveFloatTrait(name, value));
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
setWidth(parsePositiveFloatTrait(name, value));
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
setHeight(parsePositiveFloatTrait(name, value));
} else {
super.setTraitImpl(name, value);
}
|
public void | setWidth(float width)
if (width < 0) {
throw new IllegalArgumentException();
}
if (this.width == width) {
return;
}
modifyingNode();
renderingDirty();
this.width = width;
computeCanRenderWidthBit(width);
modifiedNode();
|
public void | setX(float x)
if (this.x == x) {
return;
}
modifyingNode();
renderingDirty();
this.x = x;
modifiedNode();
|
public void | setY(float y)
if (this.y == y) {
return;
}
modifyingNode();
renderingDirty();
this.y = y;
modifiedNode();
|
boolean | supportsTrait(java.lang.String traitName)Rect handles x, y, rx, ry, width and height traits.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_RX_ATTRIBUTE == traitName
||
SVGConstants.SVG_RY_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_X_ATTRIBUTE == name
||
SVGConstants.SVG_Y_ATTRIBUTE == name
||
SVGConstants.SVG_RX_ATTRIBUTE == name
||
SVGConstants.SVG_RY_ATTRIBUTE == name
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == name
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else {
return super.toStringTrait(name, value);
}
|
public float[][] | validateFloatArrayTrait(java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return new float[][] {{parseFloatTrait(traitName, value)}};
} else if (SVGConstants.SVG_RX_ATTRIBUTE == traitName
||
SVGConstants.SVG_RY_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return new float[][] {{parsePositiveFloatTrait(traitName, value)}};
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|