/// <summary> /// Gets the Stroke Element Attributes from the Match /// </summary> /// <param name="match">Match object</param> protected override void GetAttributes(Match match) { // Stroke Width var group = match.Groups["StrokeWidth"]; Single.TryParse(group.Value, out _width); // Sanitize by taking the absolute value _width = Math.Abs(_width); _widthValidationCount = RegexFactory.ValidationRegex.Replace(group.Value, String.Empty).Length; // Stroke Brush group = match.Groups["CanvasBrush"]; if (group.Success) { _brush = CanvasBrushParser.Parse(group.Value); } // If the ICanvasBrushElement was not created, then the ICanvasStroke cannot be created if (_brush == null) { throw new NullReferenceException($"Unable to create a valid ICanvasBrush for the " + $"ICanvasStroke with the following Brush data - '{group.Value}'"); } // Stroke Style _style = CanvasStrokeStyleParser.Parse(match); }
/// <summary> /// ctor /// </summary> /// <param name="match">Match object</param> public CanvasStrokeElement(Match match) { _width = 1f; _brush = null; _style = null; _widthValidationCount = 0; Initialize(match); }
/// <summary> /// Gets the Stroke Element Attributes from the Match. /// </summary> /// <param name="match">Match object</param> protected override void GetAttributes(Match match) { // Stroke Width var group = match.Groups["StrokeWidth"]; float.TryParse(group.Value, out _width); // Sanitize by taking the absolute value _width = Math.Abs(_width); _widthValidationCount = RegexFactory.ValidationRegex.Replace(group.Value, string.Empty).Length; // Stroke Brush group = match.Groups["CanvasBrush"]; if (group.Success) { _brush = CanvasBrushParser.Parse(group.Value); } // If the ICanvasBrushElement was not created, then the ICanvasStroke cannot be created if (_brush == null) {