private static Matrix parseTransformSkewX(String pString) { var start = SVGConstants.ATTRIBUTE_TRANSFORM_VALUE_SKEW_X.Length + 1; var svgNumberParserFloatResult = pString.Substring(start, pString.IndexOf(')') - start).ParseFloats(); SVGTransformParser.assertNumberParserResultNumberCountMinimum(svgNumberParserFloatResult, 1); float angle = svgNumberParserFloatResult[0]; Matrix matrix = new Matrix(); matrix.PostSkew((float)Math.Tan(angle), 0); return(matrix); }
private static Matrix parseTransformTranslate(String pString) { var start = SVGConstants.ATTRIBUTE_TRANSFORM_VALUE_TRANSLATE.Length + 1; var svgNumberParserFloatResult = pString.Substring(start, pString.IndexOf(')') - start).ParseFloats(); SVGTransformParser.assertNumberParserResultNumberCountMinimum(svgNumberParserFloatResult, 1); float tx = svgNumberParserFloatResult[0]; float ty = 0; if (svgNumberParserFloatResult.Length > 1) { ty = svgNumberParserFloatResult[1]; } Matrix matrix = new Matrix(); matrix.PostTranslate(tx, ty); return(matrix); }
public static Matrix parseTransformRotate(String pString) { var start = SVGConstants.ATTRIBUTE_TRANSFORM_VALUE_ROTATE.Length + 1; var svgNumberParserFloatResult = pString.Substring(start, pString.IndexOf(')') - start).ParseFloats(); SVGTransformParser.assertNumberParserResultNumberCountMinimum(svgNumberParserFloatResult, 1); float angle = svgNumberParserFloatResult[0]; float cx = 0; float cy = 0; if (svgNumberParserFloatResult.Length > 2) { cx = svgNumberParserFloatResult[1]; cy = svgNumberParserFloatResult[2]; } Matrix matrix = new Matrix(); matrix.PostTranslate(cx, cy); matrix.PostRotate(angle); matrix.PostTranslate(-cx, -cy); return(matrix); }