當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。