Package org.apache.batik.dom.svg

Examples of org.apache.batik.dom.svg.SVGOMTransform


                type = ft.getType();
            }
            if (type == tt.getType()) {
                AbstractSVGTransform t;
                if (res.transforms.isEmpty()) {
                    t = new SVGOMTransform();
                    res.transforms.add(t);
                } else {
                    t = (AbstractSVGTransform) res.transforms.elementAt(index);
                    if (t == null) {
                        t = new SVGOMTransform();
                        res.transforms.setElementAt(t, index);
                    }
                }
                float x, y, r = 0;
                switch (type) {
                    case SVGTransform.SVG_TRANSFORM_SKEWX:
                    case SVGTransform.SVG_TRANSFORM_SKEWY:
                        r = ft.getAngle();
                        r += interpolation * (tt.getAngle() - r);
                        if (type == SVGTransform.SVG_TRANSFORM_SKEWX) {
                            t.setSkewX(r);
                        } else if (type == SVGTransform.SVG_TRANSFORM_SKEWY) {
                            t.setSkewY(r);
                        }
                        break;
                    case SVGTransform.SVG_TRANSFORM_SCALE: {
                        SVGMatrix fm = ft.getMatrix();
                        SVGMatrix tm = tt.getMatrix();
                        x = fm.getA();
                        y = fm.getD();
                        x += interpolation * (tm.getA() - x);
                        y += interpolation * (tm.getD() - y);
                        t.setScale(x, y);
                        break;
                    }
                    case SVGTransform.SVG_TRANSFORM_ROTATE: {
                        x = ft.getX();
                        y = ft.getY();
                        x += interpolation * (tt.getX() - x);
                        y += interpolation * (tt.getY() - y);
                        r = ft.getAngle();
                        r += interpolation * (tt.getAngle() - r);
                        t.setRotate(r, x, y);
                        break;
                    }
                    case SVGTransform.SVG_TRANSFORM_TRANSLATE: {
                        SVGMatrix fm = ft.getMatrix();
                        SVGMatrix tm = tt.getMatrix();
                        x = fm.getE();
                        y = fm.getF();
                        x += interpolation * (tm.getE() - x);
                        y += interpolation * (tm.getF() - y);
                        t.setTranslate(x, y);
                        break;
                    }
                }
            }
        } else {
            AbstractSVGTransform ft =
                (AbstractSVGTransform) transforms.lastElement();
            AbstractSVGTransform t =
                (AbstractSVGTransform) res.transforms.elementAt(index);
            if (t == null) {
                t = new SVGOMTransform();
                res.transforms.setElementAt(t, index);
            }
            t.assign(ft);
        }

View Full Code Here


            (AbstractSVGTransform) value2.transforms.lastElement();

        AbstractSVGTransform t =
            (AbstractSVGTransform) res.transforms.elementAt(index);
        if (t == null) {
            t = new SVGOMTransform();
            res.transforms.setElementAt(t, index);
        }

        int type = ft1.getType();
View Full Code Here

            (AbstractSVGTransform) value3.transforms.lastElement();

        AbstractSVGTransform t =
            (AbstractSVGTransform) res.transforms.elementAt(index);
        if (t == null) {
            t = new SVGOMTransform();
            res.transforms.setElementAt(t, index);
        }

        float x, y, r;
        r = ft1.getAngle();
View Full Code Here

        if (i != len) {
            return null;
        }

        SVGOMTransform t = new SVGOMTransform();
        switch (type) {
            case SVGTransform.SVG_TRANSFORM_TRANSLATE:
                if (count == 2) {
                    t.setTranslate(val1, val2);
                } else {
                    t.setTranslate(val1, 0f);
                }
                break;
            case SVGTransform.SVG_TRANSFORM_SCALE:
                if (count == 2) {
                    t.setScale(val1, val2);
                } else {
                    t.setScale(val1, val1);
                }
                break;
            case SVGTransform.SVG_TRANSFORM_ROTATE:
                if (count == 3) {
                    t.setRotate(val1, val2, val3);
                } else {
                    t.setRotate(val1, 0f, 0f);
                }
                break;
            case SVGTransform.SVG_TRANSFORM_SKEWX:
                t.setSkewX(val1);
                break;
            case SVGTransform.SVG_TRANSFORM_SKEWY:
                t.setSkewY(val1);
                break;
        }
        return new AnimatableTransformListValue(target, t);
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.dom.svg.SVGOMTransform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.