private static SvgTransform CreateRotateTransformationFromArgs(string args) { // rotate(<rotate-angle> [<cx> <cy>]), which specifies a rotation by <rotate-angle> degrees about a given point. // // If optional parameters <cx> and <cy> are not supplied, the rotate is about the origin of the current user coordinate system. // The operation corresponds to the matrix [cos(a) sin(a) -sin(a) cos(a) 0 0]. // // If optional parameters<cx> and<cy> are supplied, the rotate is about the point(cx, cy). // The operation represents the equivalent of the following specification: // translate(< cx >, < cy >) rotate(< rotate - angle >) translate(-< cx >, -< cy >). var split = SplitStringOfNumbers(args); if (split.Length != 1 && split.Length != 3) { throw new Exception($"Invalid rotate transformation arguments '{args}'"); } var angle = float.Parse(split[0]); var cx = split.Length > 1 ? (float?)float.Parse(split[1]) : null; var cy = split.Length > 1 ? (float?)float.Parse(split[2]) : null; var matrix = SvgMatrix.CreateRotate(angle, cx, cy); return(new SvgTransform(SvgTransformType.Rotate, matrix, angle)); }