Methods Summary |
---|
protected com.sun.perseus.j2d.Transform | appendTransform(com.sun.perseus.j2d.Transform tx, com.sun.perseus.j2d.Transform workTx)Apply this node's viewBox x/y translation if it is not (0,0).
if (viewBox == null
||
(viewBox[0][0] == 0 && viewBox[0][1] == 0)) {
return tx;
}
tx = recycleTransform(tx, workTx);
if (viewBox != null) {
tx.mTranslate(-viewBox[0][0], -viewBox[0][1]);
}
return tx;
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_SVG_RECT);
} else {
return super.createTraitAnimImpl(traitName);
}
|
public org.w3c.dom.svg.SVGRect | getBBox()
if (viewBox != null) {
Transform t = new Transform(1, 0, 0, 1, -viewBox[0][0],
-viewBox[0][1]);
return addBBox(null, t);
}
return addBBox(null, null);
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_SYMBOL_TAG;
|
org.w3c.dom.svg.SVGRect | getRectTraitImpl(java.lang.String name)Symbol handles the viewBox Rect trait.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE.equals(name)) {
return toSVGRect(viewBox);
} else {
return super.getRectTraitImpl(name);
}
|
public org.w3c.dom.svg.SVGMatrix | getScreenCTM()
SVGMatrix m = super.getScreenCTM();
if (m != null) {
if (viewBox != null) {
m = m.mTranslate(viewBox[0][0], viewBox[0][1]);
}
}
return m;
|
public java.lang.String | getTraitImpl(java.lang.String name)Symbol handles the viewBox trait.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
if (viewBox == null) {
return "";
} else {
return "" + viewBox[0][0] + SVGConstants.COMMA
+ viewBox[0][1] + SVGConstants.COMMA
+ viewBox[1][0] + SVGConstants.COMMA
+ viewBox[2][0];
}
} else {
return super.getTraitImpl(name);
}
|
public float[][] | getViewBox()
return viewBox;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype SymbolNode .
return new Symbol(doc);
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
setViewBox(value);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setRectTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGRect rect)Symbol handles the viewBox Rect trait.
// Note that here, we use equals because the string
// has not been interned.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE.equals(name)) {
if (rect == null) {
throw illegalTraitValue(name, null);
}
if (rect.getWidth() < 0 || rect.getHeight() < 0) {
throw illegalTraitValue(name, toStringTrait(new float[]
{rect.getX(),
rect.getY(),
rect.getWidth(),
rect.getHeight()}));
}
setViewBox(new float[][] {
new float[] {rect.getX(), rect.getY()},
new float[] {rect.getWidth()},
new float[] {rect.getHeight()}
});
} else {
super.setRectTraitImpl(name, rect);
}
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)Symbol handles the viewBox trait.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
setViewBox(toViewBox(name, value));
} else {
super.setTraitImpl(name, value);
}
|
public void | setViewBox(float[][] newViewBox)Sets a new value for the viewBox. If there viewBox is
not null, it should be of size 4
if (newViewBox != null) {
if (newViewBox.length != 3
||
newViewBox[0] == null
||
newViewBox[1] == null
||
newViewBox[2] == null
||
newViewBox[0].length != 2
||
newViewBox[1][0] < 0
||
newViewBox[2][0] < 0) {
throw new IllegalArgumentException();
}
}
modifyingNode();
if (viewBox == null) {
viewBox = new float[3][];
viewBox[0] = new float[2];
viewBox[1] = new float[1];
viewBox[2] = new float[1];
}
viewBox[0][0] = newViewBox[0][0];
viewBox[0][1] = newViewBox[0][1];
viewBox[1][0] = newViewBox[1][0];
viewBox[2][0] = newViewBox[2][0];
recomputeTransformState();
recomputeProxyTransformState();
computeCanRenderEmptyViewBoxBit(viewBox);
modifiedNode();
|
boolean | supportsTrait(java.lang.String traitName)Symbol handles the target trait.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
float[] vb = {value[0][0], value[0][1], value[1][0], value[2][0]};
return toStringTrait(vb);
} 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_VIEW_BOX_ATTRIBUTE == traitName) {
return ownerDocument.viewBoxParser.parseViewBox(value);
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|