本文整理汇总了Java中org.w3c.dom.svg.SVGTransform.SVG_TRANSFORM_ROTATE属性的典型用法代码示例。如果您正苦于以下问题:Java SVGTransform.SVG_TRANSFORM_ROTATE属性的具体用法?Java SVGTransform.SVG_TRANSFORM_ROTATE怎么用?Java SVGTransform.SVG_TRANSFORM_ROTATE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.dom.svg.SVGTransform
的用法示例。
在下文中一共展示了SVGTransform.SVG_TRANSFORM_ROTATE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseType
/**
* Returns the parsed 'type' attribute from the animation element.
*/
protected short parseType() {
String typeString = element.getAttributeNS(null, SVG_TYPE_ATTRIBUTE);
if (typeString.equals("translate")) {
return SVGTransform.SVG_TRANSFORM_TRANSLATE;
} else if (typeString.equals("scale")) {
return SVGTransform.SVG_TRANSFORM_SCALE;
} else if (typeString.equals("rotate")) {
return SVGTransform.SVG_TRANSFORM_ROTATE;
} else if (typeString.equals("skewX")) {
return SVGTransform.SVG_TRANSFORM_SKEWX;
} else if (typeString.equals("skewY")) {
return SVGTransform.SVG_TRANSFORM_SKEWY;
}
throw new BridgeException
(ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] { SVG_TYPE_ATTRIBUTE, typeString });
}
示例2: distanceTo
/**
* Returns the absolute distance between this value and the specified other
* value.
*/
public float distanceTo(AnimatableValue other) {
AnimatableTransformListValue o = (AnimatableTransformListValue) other;
if (transforms.isEmpty() || o.transforms.isEmpty()) {
return 0f;
}
AbstractSVGTransform t1 = (AbstractSVGTransform) transforms.lastElement();
AbstractSVGTransform t2 = (AbstractSVGTransform) o.transforms.lastElement();
short type1 = t1.getType();
if (type1 != t2.getType()) {
return 0f;
}
SVGMatrix m1 = t1.getMatrix();
SVGMatrix m2 = t2.getMatrix();
switch (type1) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
return Math.abs(m1.getE() - m2.getE()) + Math.abs(m1.getF() - m2.getF());
case SVGTransform.SVG_TRANSFORM_SCALE:
return Math.abs(m1.getA() - m2.getA()) + Math.abs(m1.getD() - m2.getD());
case SVGTransform.SVG_TRANSFORM_ROTATE:
case SVGTransform.SVG_TRANSFORM_SKEWX:
case SVGTransform.SVG_TRANSFORM_SKEWY:
return Math.abs(t1.getAngle() - t2.getAngle());
}
return 0f;
}
示例3: distanceTo1
/**
* Returns the distance between this value's first component and the
* specified other value's first component.
*/
public float distanceTo1(AnimatableValue other) {
AnimatableTransformListValue o = (AnimatableTransformListValue) other;
if (transforms.isEmpty() || o.transforms.isEmpty()) {
return 0f;
}
AbstractSVGTransform t1 = (AbstractSVGTransform) transforms.lastElement();
AbstractSVGTransform t2 = (AbstractSVGTransform) o.transforms.lastElement();
short type1 = t1.getType();
if (type1 != t2.getType()) {
return 0f;
}
SVGMatrix m1 = t1.getMatrix();
SVGMatrix m2 = t2.getMatrix();
switch (type1) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
return Math.abs(m1.getE() - m2.getE());
case SVGTransform.SVG_TRANSFORM_SCALE:
return Math.abs(m1.getA() - m2.getA());
case SVGTransform.SVG_TRANSFORM_ROTATE:
case SVGTransform.SVG_TRANSFORM_SKEWX:
case SVGTransform.SVG_TRANSFORM_SKEWY:
return Math.abs(t1.getAngle() - t2.getAngle());
}
return 0f;
}
示例4: distanceTo2
/**
* Returns the distance between this value's second component and the
* specified other value's second component.
*/
public float distanceTo2(AnimatableValue other) {
AnimatableTransformListValue o = (AnimatableTransformListValue) other;
if (transforms.isEmpty() || o.transforms.isEmpty()) {
return 0f;
}
AbstractSVGTransform t1 = (AbstractSVGTransform) transforms.lastElement();
AbstractSVGTransform t2 = (AbstractSVGTransform) o.transforms.lastElement();
short type1 = t1.getType();
if (type1 != t2.getType()) {
return 0f;
}
SVGMatrix m1 = t1.getMatrix();
SVGMatrix m2 = t2.getMatrix();
switch (type1) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
return Math.abs(m1.getF() - m2.getF());
case SVGTransform.SVG_TRANSFORM_SCALE:
return Math.abs(m1.getD() - m2.getD());
case SVGTransform.SVG_TRANSFORM_ROTATE:
return Math.abs(t1.getX() - t2.getX());
}
return 0f;
}
示例5: distanceTo3
/**
* Returns the distance between this value's third component and the
* specified other value's third component.
*/
public float distanceTo3(AnimatableValue other) {
AnimatableTransformListValue o = (AnimatableTransformListValue) other;
if (transforms.isEmpty() || o.transforms.isEmpty()) {
return 0f;
}
AbstractSVGTransform t1 = (AbstractSVGTransform) transforms.lastElement();
AbstractSVGTransform t2 = (AbstractSVGTransform) o.transforms.lastElement();
short type1 = t1.getType();
if (type1 != t2.getType()) {
return 0f;
}
if (type1 == SVGTransform.SVG_TRANSFORM_ROTATE) {
return Math.abs(t1.getY() - t2.getY());
}
return 0f;
}
示例6: assign
/**
* Copies the values from the given {@link SVGTransform} into this
* {@link SVGTransformItem}.
*/
public void assign(SVGTransform transform) {
type = transform.getType();
SVGMatrix matrix = transform.getMatrix();
switch (type) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
setTranslate(matrix.getE(), matrix.getF());
break;
case SVGTransform.SVG_TRANSFORM_SCALE:
setScale(matrix.getA(), matrix.getD());
break;
case SVGTransform.SVG_TRANSFORM_ROTATE:
if (matrix.getE() == 0.0f) {
rotate(transform.getAngle());
} else {
angleOnly = false;
if (matrix.getA() == 1.0f) {
setRotate(transform.getAngle(),
matrix.getE(), matrix.getF());
} else if (transform instanceof AbstractSVGTransform) {
AbstractSVGTransform internal =
(AbstractSVGTransform) transform;
setRotate(internal.getAngle(),
internal.getX(), internal.getY());
} else {
// XXX Should extract the angle, x and y from the
// matrix.
}
}
break;
case SVGTransform.SVG_TRANSFORM_SKEWX:
setSkewX(transform.getAngle());
break;
case SVGTransform.SVG_TRANSFORM_SKEWY:
setSkewY(transform.getAngle());
break;
case SVGTransform.SVG_TRANSFORM_MATRIX:
setMatrix(matrix);
break;
}
}
示例7: getStringValue
/**
* Returns the string representation of this transform.
*/
protected String getStringValue(){
StringBuffer buf = new StringBuffer();
switch(type) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
buf.append("translate(");
buf.append((float) affineTransform.getTranslateX());
if (!xOnly) {
buf.append(' ');
buf.append((float) affineTransform.getTranslateY());
}
buf.append(')');
break;
case SVGTransform.SVG_TRANSFORM_ROTATE:
buf.append("rotate(");
buf.append(angle);
if (!angleOnly) {
buf.append(' ');
buf.append(x);
buf.append(' ');
buf.append(y);
}
buf.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SCALE:
buf.append("scale(");
buf.append((float) affineTransform.getScaleX());
if (!xOnly) {
buf.append(' ');
buf.append((float) affineTransform.getScaleY());
}
buf.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SKEWX:
buf.append("skewX(");
buf.append(angle);
buf.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SKEWY:
buf.append("skewY(");
buf.append(angle);
buf.append(')');
break;
case SVGTransform.SVG_TRANSFORM_MATRIX:
buf.append("matrix(");
double[] matrix = new double[6];
affineTransform.getMatrix(matrix);
for(int i = 0; i < 6; i++) {
if (i != 0) {
buf.append(' ');
}
buf.append((float) matrix[i]);
}
buf.append(')');
break;
}
return buf.toString();
}
示例8: toStringRep
/**
* Returns the CSS text representation of the value.
*/
public String toStringRep() {
StringBuffer sb = new StringBuffer();
Iterator i = transforms.iterator();
while (i.hasNext()) {
AbstractSVGTransform t = (AbstractSVGTransform) i.next();
if (t == null) {
sb.append("null");
} else {
SVGMatrix m = t.getMatrix();
switch (t.getType()) {
case SVGTransform.SVG_TRANSFORM_TRANSLATE:
sb.append("translate(");
sb.append(m.getE());
sb.append(',');
sb.append(m.getF());
sb.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SCALE:
sb.append("scale(");
sb.append(m.getA());
sb.append(',');
sb.append(m.getD());
sb.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SKEWX:
sb.append("skewX(");
sb.append(t.getAngle());
sb.append(')');
break;
case SVGTransform.SVG_TRANSFORM_SKEWY:
sb.append("skewY(");
sb.append(t.getAngle());
sb.append(')');
break;
case SVGTransform.SVG_TRANSFORM_ROTATE:
sb.append("rotate(");
sb.append(t.getAngle());
sb.append(',');
sb.append(t.getX());
sb.append(',');
sb.append(t.getY());
sb.append(')');
break;
}
}
if (i.hasNext()) {
sb.append(' ');
}
}
return sb.toString();
}