当前位置: 首页>>代码示例>>Java>>正文


Java SVGTransform类代码示例

本文整理汇总了Java中org.w3c.dom.svg.SVGTransform的典型用法代码示例。如果您正苦于以下问题:Java SVGTransform类的具体用法?Java SVGTransform怎么用?Java SVGTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SVGTransform类属于org.w3c.dom.svg包,在下文中一共展示了SVGTransform类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseType

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * 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 });
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:SVGAnimateTransformElementBridge.java

示例2: consolidate

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link SVGTransformList#consolidate()}.
 */
public SVGTransform consolidate() {
    revalidate();

    int size = itemList.size();
    if (size == 0) {
        return null;
    } else if (size == 1) {
        return getItem(0);
    }

    SVGTransformItem t = (SVGTransformItem) getItemImpl(0);
    AffineTransform at = (AffineTransform) t.affineTransform.clone();

    for (int i = 1; i < size; i++) {
        t = (SVGTransformItem) getItemImpl(i);
        at.concatenate(t.affineTransform);
    }
    SVGOMMatrix matrix = new SVGOMMatrix(at);
    return initialize(createSVGTransformFromMatrix(matrix));
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:AbstractSVGTransformList.java

示例3: setAnimatedValue

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * Sets the animated value to a list of transforms.
 */
protected void setAnimatedValue(Iterator it) {
    int size = itemList.size();
    int i = 0;
    while (i < size && it.hasNext()) {
        SVGTransformItem t = (SVGTransformItem) itemList.get(i);
        t.assign((SVGTransform) it.next());
        i++;
    }
    while (it.hasNext()) {
        appendItemImpl(new SVGTransformItem((SVGTransform) it.next()));
        i++;
    }
    while (size > i) {
        removeItemImpl(--size);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:SVGOMAnimatedTransformList.java

示例4: distanceTo

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:30,代码来源:AnimatableTransformListValue.java

示例5: distanceTo1

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:30,代码来源:AnimatableTransformListValue.java

示例6: distanceTo2

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:28,代码来源:AnimatableTransformListValue.java

示例7: distanceTo3

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:21,代码来源:AnimatableTransformListValue.java

示例8: checkItemType

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * Asserts that the given item is an {@link SVGTransformList}.
 */
protected void checkItemType(Object newItem) {
    if (!(newItem instanceof SVGTransform)) {
        createSVGException(SVGException.SVG_WRONG_TYPE_ERR,
                           "expected.transform", null);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:10,代码来源:AbstractSVGTransformList.java

示例9: createMatrix

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * Creates the {@link SVGMatrix} used to store the transform.
 */
protected SVGMatrix createMatrix() {
    return new AbstractSVGMatrix() {
        protected AffineTransform getAffineTransform() {
            return SVGTransformItem.this.affineTransform;
        }
        public void setA(float a) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setA(a);
            SVGTransformItem.this.resetAttribute();
        }
        public void setB(float b) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setB(b);
            SVGTransformItem.this.resetAttribute();
        }
        public void setC(float c) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setC(c);
            SVGTransformItem.this.resetAttribute();
        }
        public void setD(float d) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setD(d);
            SVGTransformItem.this.resetAttribute();
        }
        public void setE(float e) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setE(e);
            SVGTransformItem.this.resetAttribute();
        }
        public void setF(float f) throws DOMException {
            SVGTransformItem.this.type = SVGTransform.SVG_TRANSFORM_MATRIX;
            super.setF(f);
            SVGTransformItem.this.resetAttribute();
        }
    };
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:41,代码来源:AbstractSVGTransformList.java

示例10: getItem

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link SVGTransformList#getItem(int)}.
 */
public SVGTransform getItem(int index) throws DOMException {
    if (hasAnimVal) {
        return super.getItem(index);
    }
    return getBaseVal().getItem(index);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:10,代码来源:SVGOMAnimatedTransformList.java

示例11: initialize

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link SVGTransformList#initialize(SVGTransform)}.
 */
public SVGTransform initialize(SVGTransform newItem)
        throws DOMException, SVGException {
    throw element.createDOMException
        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
         "readonly.transform.list", null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:10,代码来源:SVGOMAnimatedTransformList.java

示例12: insertItemBefore

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGTransformList#insertItemBefore(SVGTransform, int)}.
 */
public SVGTransform insertItemBefore(SVGTransform newItem, int index)
        throws DOMException, SVGException {
    throw element.createDOMException
        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
         "readonly.transform.list", null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:11,代码来源:SVGOMAnimatedTransformList.java

示例13: replaceItem

import org.w3c.dom.svg.SVGTransform; //导入依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link
 * SVGTransformList#replaceItem(SVGTransform, int)}.
 */
public SVGTransform replaceItem(SVGTransform newItem, int index)
        throws DOMException, SVGException {
    throw element.createDOMException
        (DOMException.NO_MODIFICATION_ALLOWED_ERR,
         "readonly.transform.list", null);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:11,代码来源:SVGOMAnimatedTransformList.java


注:本文中的org.w3c.dom.svg.SVGTransform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。