MCPcopy Index your code
hub / github.com/benfry/processing4 / parseTransform

Method parseTransform

core/src/processing/core/PShapeSVG.java:1069–1084  ·  view source on GitHub ↗

Parse the specified SVG matrix into a PMatrix2D. Note that PMatrix2D is rotated relative to the SVG definition, so parameters are rearranged here. More about the transformation matrices in this section of the SVG documentation. @p

(String matrixStr)

Source from the content-addressed store, hash-verified

1067 * @return a good old-fashioned PMatrix2D
1068 */
1069 static protected PMatrix2D parseTransform(String matrixStr) {
1070 matrixStr = matrixStr.trim();
1071 PMatrix2D outgoing = null;
1072 int start = 0;
1073 int stop = -1;
1074 while ((stop = matrixStr.indexOf(')', start)) != -1) {
1075 PMatrix2D m = parseSingleTransform(matrixStr.substring(start, stop+1));
1076 if (outgoing == null) {
1077 outgoing = m;
1078 } else {
1079 outgoing.apply(m);
1080 }
1081 start = stop + 1;
1082 }
1083 return outgoing;
1084 }
1085
1086
1087 static protected PMatrix2D parseSingleTransform(String matrixStr) {

Callers 3

PShapeSVGMethod · 0.95
LinearGradientMethod · 0.80
RadialGradientMethod · 0.80

Calls 3

parseSingleTransformMethod · 0.95
applyMethod · 0.95
trimMethod · 0.45

Tested by

no test coverage detected