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);
}