public LineTo(char command, ShapeUtil.StringSplitter value) : base(command) { if (char.ToLower(command) == 'h') { this.PositionType = eType.Horizontal; double v = value.ReadNextValue(); this.Points = new Point[] { new Point(v, 0) }; return; } if (char.ToLower(command) == 'v') { this.PositionType = eType.Vertical; double v = value.ReadNextValue(); this.Points = new Point[] { new Point(0, v) }; return; } this.PositionType = eType.Point; List <Point> list = new List <Point>(); while (value.More) { Point p = value.ReadNextPoint(); list.Add(p); } this.Points = list.ToArray(); }
public static Transform ParseTransform(string value) { string type = ExtractUntil(value, '('); string v1 = ExtractBetween(value, '(', ')'); ShapeUtil.StringSplitter split = new ShapeUtil.StringSplitter(v1); List <double> values = new List <double>(); while (split.More) { values.Add(split.ReadNextValue()); } if (type == SVGTags.sTranslate) { return(new TranslateTransform(values[0], values[1])); } if (type == SVGTags.sMatrix) { return(Transform.Parse(v1)); } if (type == SVGTags.sScale) { return(new ScaleTransform(values[0], values[1])); } if (type == SVGTags.sRotate) { return(new RotateTransform(values[0], values[1], values[2])); } return(null); }
public EllipticalArcTo(char command, ShapeUtil.StringSplitter value) : base(command) { this.RX = value.ReadNextValue(); this.RY = value.ReadNextValue(); this.AxisRotation = value.ReadNextValue(); double arcflag = value.ReadNextValue(); this.LargeArc = (arcflag > 0); double sweepflag = value.ReadNextValue(); this.Clockwise = (sweepflag > 0); this.X = value.ReadNextValue(); this.Y = value.ReadNextValue(); }
private static Transform ParseTransformInternal(string value) { string type = ExtractUntil(value, '(').TrimStart(','); string v1 = ExtractBetween(value, '(', ')'); ShapeUtil.StringSplitter split = new ShapeUtil.StringSplitter(v1); List <double> values = new List <double>(); while (split.More) { values.Add(split.ReadNextValue()); } if (type == SVGTags.sTranslate) { if (values.Count == 1) { return(new TranslateTransform(values[0], 0)); } else { return(new TranslateTransform(values[0], values[1])); } } if (type == SVGTags.sMatrix) { return(Transform.Parse(v1)); } if (type == SVGTags.sScale) { if (values.Count == 1) { return(new ScaleTransform(values[0], values[0])); } else { return(new ScaleTransform(values[0], values[1])); } } if (type == SVGTags.sSkewX) { return(new SkewTransform(values[0], 0)); } if (type == SVGTags.sSkewY) { return(new SkewTransform(0, values[0])); } if (type == SVGTags.sRotate) { if (values.Count == 1) { return(new RotateTransform(values[0], 0, 0)); } if (values.Count == 2) { return(new RotateTransform(values[0], values[1], 0)); } return(new RotateTransform(values[0], values[1], values[2])); } return(null); }