/// <summary> /// Ends the current figure; optionally, closes it. /// </summary> /// <param name="figureLoop"> The figure-loop. </param> public void EndFigure(CanvasFigureLoop figureLoop) { this.Add(new Node { Type = NodeType.EndFigure, FigureLoop = figureLoop, }); }
public override string CanvasFigureLoop(CanvasFigureLoop value) { var typeName = nameof(CanvasFigureLoop); return(value switch { Mgcg.CanvasFigureLoop.Open => $"{typeName}{ScopeResolve}Open", Mgcg.CanvasFigureLoop.Closed => $"{typeName}{ScopeResolve}Closed", _ => throw new InvalidOperationException(), });
public void EndFigure(CanvasFigureLoop figureLoop) { if (figureLoop == CanvasFigureLoop.Closed) { _currentGlyph.Add(new LinePath(_lastPoint, _startPoint)); } allGlyphs.Add(_currentGlyph); // start a new block _currentGlyph = new TextGlyph(); System.Diagnostics.Debug.WriteLine(">>>>>"); }
public virtual string CanvasFigureLoop(CanvasFigureLoop value) { var typeName = nameof(CanvasFigureLoop); switch (value) { case Mgcg.CanvasFigureLoop.Open: return($"{typeName}{ScopeResolve}Open"); case Mgcg.CanvasFigureLoop.Closed: return($"{typeName}{ScopeResolve}Closed"); default: throw new InvalidOperationException(); } }
public override string CanvasFigureLoop(CanvasFigureLoop value) { switch (value) { case Mgcg.CanvasFigureLoop.Open: return("CanvasFigureLoop.Open"); case Mgcg.CanvasFigureLoop.Closed: return("CanvasFigureLoop.Closed"); default: throw new InvalidOperationException(); } }
public void EndFigure(CanvasFigureLoop figureLoop) { if (figureTopEdge == null || figureBottomEdge == null) { return; // The figure's area doesn't comprise a line. } float left = System.Math.Max(figureTopEdge[0], figureBottomEdge[0]); float right = System.Math.Min(figureTopEdge[1], figureBottomEdge[1]); float width = right - left; if (width > 0) { Rect rect = new Rect(left, lineRegion.Top, width, lineRegion.Height); unsortedOutput.Add(rect); } }
/// <summary> /// Builds a path with the given collection of points. /// </summary> /// <param name="builder">CanvasPathBuilder</param> /// <param name="canvasFigureLoop">Specifies whether the figure is open or closed. /// This affects the appearance of fills and strokes, as well as geometry operations.</param> /// <param name="points">Collection of Vector2 points on the path.</param> /// <returns>CanvasPathBuilder</returns> public static CanvasPathBuilder BuildPathWithLines(this CanvasPathBuilder builder, CanvasFigureLoop canvasFigureLoop, IEnumerable <Vector2> points) { var first = true; foreach (var point in points) { if (first) { builder.BeginFigure(point); first = false; } else { builder.AddLine(point); } } builder.EndFigure(canvasFigureLoop); return(builder); }
public void EndFigure(CanvasFigureLoop figureLoop) { if (figureTopEdge == null || figureBottomEdge == null) { figureIsValid = false; } if (figureIsValid) { float left = System.Math.Max(figureTopEdge[0], figureBottomEdge[0]); float right = System.Math.Min(figureTopEdge[1], figureBottomEdge[1]); float width = right - left; if (width > 0) { Rect rect = new Rect(left, lineRegion.Top, width, lineRegion.Height); unsortedOutput.Add(rect); } } }
public void EndFigure(CanvasFigureLoop figureLoop) { if (figureLoop == CanvasFigureLoop.Closed) { if (Path.Points.Count > 1) // what we really want to check here is non-null area, but that's not important { var first = Path.Points.First(); var last = Path.Points.Last(); if (first.X == last.X && first.Y == last.Y) { Path.Points.RemoveAt(0); } } if (Path.IsOpen) { Path.Close(); } if (Path.Points.Count > 2) { var prev = Path.Points[Path.Points.Count - 2]; var point = Path.Points[Path.Points.Count - 1]; foreach (var next in Path.Points) { if (point.Type != Data.PointType.None && (prev.Type == Data.PointType.None || next.Type == Data.PointType.None) && IsFlatAngle(prev, point, next)) { point.IsSmooth = true; } prev = point; point = next; } } } }
/// <summary> /// >Ends the current figure; optionally, closes it. /// </summary> /// <param name="figureLoop"><see cref="CanvasFigureLoop"/></param> public void EndFigure(CanvasFigureLoop figureLoop) { _cmdBuilder.AppendLine($" pathBuilder.EndFigure({(figureLoop == CanvasFigureLoop.Closed ? "CanvasFigureLoop.Closed" : "CanvasFigureLoop.Open")});"); }
public abstract string CanvasFigureLoop(CanvasFigureLoop value);
string CanvasFigureLoop(CanvasFigureLoop value) => _stringifier.CanvasFigureLoop(value);
public void EndFigure(CanvasFigureLoop figureLoop) { wasEndFigureCalled = true; }
public void EndFigure(CanvasFigureLoop figureLoop) { _builder.Append("Z "); }
public void EndFigure(CanvasFigureLoop figureLoop) { }
internal EndFigure(CanvasFigureLoop figureLoop) { FigureLoop = figureLoop; }
public void EndFigure(CanvasFigureLoop figureLoop) { _commands.Add(new Command.EndFigure(figureLoop)); }
public void EndFigure(CanvasFigureLoop figureLoop) { Parts.Add("Z"); }
public void EndFigure(CanvasFigureLoop figureLoop) { wasEndFigureCalled = true; }
public void ClosePath() { mFigureLoop = CanvasFigureLoop.Closed; }
public void EndFigure(CanvasFigureLoop arg) { }
/// <summary> /// Builds a path with the given collection of points in the (x, y) pattern. /// </summary> /// <param name="builder">CanvasPathBuilder</param> /// <param name="canvasFigureLoop">Specifies whether the figure is open or closed. /// This affects the appearance of fills and strokes, as well as geometry operations.</param> /// <param name="nodes">Collection of points in the (x, y) pattern on the path.</param> /// <returns>CanvasPathBuilder</returns> public static CanvasPathBuilder BuildPathWithLines(this CanvasPathBuilder builder, CanvasFigureLoop canvasFigureLoop, IEnumerable <(float x, float y)> nodes)