Methods Summary |
---|
public boolean | animationsPaused()
throw new Error("NOT IMPLEMENTED");
|
protected com.sun.perseus.j2d.Transform | appendTransform(com.sun.perseus.j2d.Transform tx, com.sun.perseus.j2d.Transform workTx)Appends the viewBox to viewport transform, if there is a viewBox.
if (viewBox == null) {
return tx;
}
tx = recycleTransform(tx, workTx);
Viewport vp = (Viewport) getOwnerDocument();
float w = vp.getWidth();
float h = vp.getHeight();
getFittingTransform(viewBox[0][0], viewBox[0][1],
viewBox[1][0], viewBox[2][0],
0, 0, w, h, align, tx);
return tx;
|
void | applyUserTransform()Uses currentScale, currentRotate, tx and ty to compute the
owner document's transform.
if (ownerDocument.zoomAndPan == Viewport.ZOOM_PAN_MAGNIFY) {
Transform txf = new Transform(currentScale, 0,
0, currentScale,
tx, ty);
txf.mRotate(currentRotate);
ownerDocument.setTransform(txf);
} else {
if (ownerDocument.getTransform() != null) {
// ownerDocument's transform has been touched
// so, set it to identity
ownerDocument.setTransform(new Transform(null));
}
}
|
public org.w3c.dom.svg.SVGMatrix | createSVGMatrixComponents(float a, float b, float c, float d, float e, float f)This
object can be used to modify value of traits which are compatible with
{@link org.w3c.dom.svg.SVGMatrix SVGMatrix} type using {@link
org.w3c.dom.svg.SVGElement#setMatrixTrait setMatrixTrait} method. The
internal representation of the matrix is as follows:
[ a c e ]
[ b d f ]
[ 0 0 1 ]
return new Transform(a, b, c, d, e, f);
|
public org.w3c.dom.svg.SVGPath | createSVGPath()
return new Path();
|
public org.w3c.dom.svg.SVGRGBColor | createSVGRGBColor(int red, int green, int blue)
if (red < 0
|| red > 255
|| green < 0
|| green > 255
|| blue < 0
|| blue > 255) {
throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR, null);
}
return new RGB(red, green, blue);
|
public org.w3c.dom.svg.SVGRect | createSVGRect()
return new Box(0, 0, 0, 0);
|
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 int | getAlign()
return align;
|
public float | getCurrentRotate()
return currentRotate;
|
public float | getCurrentScale()
return currentScale;
|
public float | getCurrentTime()
return ownerDocument.timeContainerRootSupport
.lastSampleTime.value / 1000f + currentTimeDelta;
|
public org.w3c.dom.svg.SVGPoint | getCurrentTranslate()The initial values for currentTranslate is SVGPoint(0,0).
return this;
|
public java.lang.String[][] | getDefaultTraits()The default value for the width trait and the height trait
is '100%'.
return new String[][] { {SVGConstants.SVG_WIDTH_ATTRIBUTE, "100%"},
{SVGConstants.SVG_HEIGHT_ATTRIBUTE, "100%"}};
|
float | getFloatTraitImpl(java.lang.String name)SVG handles width and height float traits.
Other attributes are handled by the super class.
if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return getWidth();
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return getHeight();
} else {
return super.getFloatTraitImpl(name);
}
|
public float | getHeight()
return this.height;
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_SVG_TAG;
|
org.w3c.dom.svg.SVGRect | getRectTraitImpl(java.lang.String name)SVG handles the viewBox Rect trait.
if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE.equals(name)) {
return toSVGRect(viewBox);
} else {
return super.getRectTraitImpl(name);
}
|
public java.lang.String | getTraitImpl(java.lang.String name)SVG handles the version, baseProfile, viewBox and zoomAndPan traits.
if (SVGConstants.SVG_VERSION_ATTRIBUTE == name) {
return SVGConstants.SVG_VERSION_1_1_VALUE;
} else 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 if (SVGConstants.SVG_ZOOM_AND_PAN_ATTRIBUTE == name) {
switch (ownerDocument.zoomAndPan) {
case Viewport.ZOOM_PAN_MAGNIFY:
return SVGConstants.SVG_MAGNIFY_VALUE;
case Viewport.ZOOM_PAN_DISABLE:
return SVGConstants.SVG_DISABLE_VALUE;
default:
throw new Error();
}
} else if (SVGConstants.SVG_BASE_PROFILE_ATTRIBUTE == name) {
return SVGConstants.SVG_BASE_PROFILE_TINY_VALUE;
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return Float.toString(getWidth());
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(getHeight());
} else if (SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE == name) {
return alignToStringTrait(align);
} else {
return super.getTraitImpl(name);
}
|
public float[][] | getViewBox()
return viewBox;
|
public org.w3c.dom.svg.SVGRect | getViewport() The object itself and its contents are both readonly. {@link
org.w3c.dom.DOMException DOMException} with error code
NO_MODIFICATION_ALLOWED_ERR is raised if attempt is made to modify
it. The returned SVGRect object is "live", i.e. its x, y, width, height
is automatically updated if viewport size or position changes.
throw new Error("NOT IMPLEMENTED");
|
public float | getWidth()
return this.width;
|
public float | getX()Returns the x component of the point.
return tx;
|
public float | getY()Returns the y component of the point.
return ty;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype SVG .
return new SVG(doc);
|
public void | pauseAnimations()Pauses animation timeline. If user agent has pause/play control that
control is changed to paused state. Has no effect if timeline already
paused.
throw new Error("NOT IMPLEMENTED");
|
public void | setAlign(int newAlign)
if (newAlign != ALIGN_XMIDYMID
&&
newAlign != ALIGN_NONE) {
throw new IllegalArgumentException();
}
if (newAlign == align) {
return;
}
modifyingNode();
this.align = newAlign;
recomputeTransformState();
modifiedNode();
|
public void | setCurrentRotate(float value)
currentRotate = value;
applyUserTransform();
|
public void | setCurrentScale(float value)
if (value == 0) {
throw new DOMException
(DOMException.INVALID_ACCESS_ERR,
Messages.formatMessage
(Messages.ERROR_INVALID_PARAMETER_VALUE,
new String[] {"SVGSVGElement",
"setCurrentScale",
"value",
Float.toString(value)}));
} else {
currentScale = value;
applyUserTransform();
}
|
public void | setCurrentTime(float seconds)
currentTimeDelta = seconds - ((long) (seconds * 1000)) / 1000f;
ownerDocument.timeContainerRootSupport.seekTo
(new Time((long) (seconds * 1000)));
ownerDocument.applyAnimations();
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
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 if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
setViewBox(value);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)SVG handles width and height traits.
Other traits are handled by the super class.
try {
if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
setWidth(value);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
setHeight(value);
} else {
super.setFloatTraitImpl(name, value);
}
} catch (IllegalArgumentException iae) {
throw illegalTraitValue(name, Float.toString(value));
}
|
public void | setHeight(float newHeight)Sets the viewport height.
if (newHeight < 0) {
throw new IllegalArgumentException();
}
if (newHeight == height) {
return;
}
modifyingNode();
this.height = newHeight;
computeCanRenderHeightBit(height);
modifiedNode();
|
public void | setRectTraitImpl(java.lang.String name, org.w3c.dom.svg.SVGRect rect)SVG 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)SVG handles the version, baseProfile, viewBox and zoomAndPan traits.
if (SVGConstants.SVG_VERSION_ATTRIBUTE == name) {
checkWriteLoading(name);
if (!SVGConstants.SVG_VERSION_1_1_VALUE.equals(value)
&&
!SVGConstants.SVG_VERSION_1_2_VALUE.equals(value)) {
throw illegalTraitValue(name, value);
}
} else if (SVGConstants.SVG_BASE_PROFILE_ATTRIBUTE == name) {
checkWriteLoading(name);
if (!SVGConstants.SVG_BASE_PROFILE_TINY_VALUE.equals(value)) {
throw illegalTraitValue(name, value);
}
} else if (SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == name) {
setViewBox(toViewBox(name, value));
} else if (SVGConstants.SVG_ZOOM_AND_PAN_ATTRIBUTE == name) {
if (SVGConstants.SVG_MAGNIFY_VALUE.equals(value)) {
ownerDocument.setZoomAndPan(Viewport.ZOOM_PAN_MAGNIFY);
applyUserTransform();
} else if (SVGConstants.SVG_DISABLE_VALUE.equals(value)) {
ownerDocument.setZoomAndPan(Viewport.ZOOM_PAN_DISABLE);
applyUserTransform();
} else {
throw illegalTraitValue(name, value);
}
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
checkWriteLoading(name);
setWidth(parsePositiveLengthTrait(name, value, true));
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
checkWriteLoading(name);
setHeight(parsePositiveLengthTrait(name, value, false));
} else if (SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE == name) {
checkWriteLoading(name);
if (SVGConstants
.SVG_SVG_PRESERVE_ASPECT_RATIO_DEFAULT_VALUE.equals(value)) {
setAlign(ALIGN_XMIDYMID);
} else if (SVGConstants.SVG_NONE_VALUE.equals(value)) {
setAlign(ALIGN_NONE);
} else {
throw illegalTraitValue(name, value);
}
} else {
super.setTraitImpl(name, value);
}
|
public void | setViewBox(float[][] newViewBox)Sets a new value for the viewBox.
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();
}
}
if (equal(newViewBox, viewBox)) {
return;
}
modifyingNode();
if (newViewBox == null) {
viewBox = null;
} else {
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();
computeCanRenderEmptyViewBoxBit(viewBox);
modifiedNode();
|
public void | setWidth(float newWidth)Sets the viewport width.
if (newWidth < 0) {
throw new IllegalArgumentException();
}
if (newWidth == width) {
return;
}
modifyingNode();
this.width = newWidth;
computeCanRenderWidthBit(width);
modifiedNode();
|
public void | setX(float value)Sets the x component of the point to the specified float value.
tx = value;
applyUserTransform();
|
public void | setY(float value)Sets the y component of the point to the specified float value.
ty = value;
applyUserTransform();
|
boolean | supportsTrait(java.lang.String traitName)SVG handles the version, baseProfile, viewBox, zoomAndPan,
width, height and preserveAspectRatio traits.
if (SVGConstants.SVG_BASE_PROFILE_ATTRIBUTE == traitName
||
SVGConstants.SVG_VERSION_ATTRIBUTE == traitName
||
SVGConstants.SVG_VIEW_BOX_ATTRIBUTE == traitName
||
SVGConstants.SVG_ZOOM_AND_PAN_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName
||
SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else 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 void | unpauseAnimations()Resumes animation timeline. If user agent has pause/play control that
control is changed to playing state. Has no effect if timeline is already
playing.
throw new Error("NOT IMPLEMENTED");
|
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 if (SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return new float[][] {
{parsePositiveLengthTrait(traitName, value, false)}
};
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|