transformPath method
dynamic
transformPath(
- dynamic path,
- dynamic m
Implementation
transformPath(path, m) {
transfVec2(v2) {
tempV3.set(v2.x, v2.y, 1).applyMatrix3(m);
v2.set(tempV3.x, tempV3.y);
}
var isRotated = isTransformRotated(m);
var subPaths = path.subPaths;
for (var i = 0, n = subPaths.length; i < n; i++) {
var subPath = subPaths[i];
var curves = subPath.curves;
for (var j = 0; j < curves.length; j++) {
var curve = curves[j];
if (curve is LineCurve) {
transfVec2(curve.v1);
transfVec2(curve.v2);
} else if (curve.isCubicBezierCurve) {
transfVec2(curve.v0);
transfVec2(curve.v1);
transfVec2(curve.v2);
transfVec2(curve.v3);
} else if (curve.isQuadraticBezierCurve) {
transfVec2(curve.v0);
transfVec2(curve.v1);
transfVec2(curve.v2);
} else if (curve.isEllipseCurve) {
if (isRotated) {
print(
'SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented.');
}
tempV2.set(curve.aX, curve.aY);
transfVec2(tempV2);
curve.aX = tempV2.x;
curve.aY = tempV2.y;
curve.xRadius *= getTransformScaleX(m);
curve.yRadius *= getTransformScaleY(m);
}
}
}
}