SvgClosePathSegment.cs 862 Bytes
Newer Older
davescriven's avatar
davescriven committed
1
2
3
4
5
6
7
8
9
10
using System;
using System.Collections.Generic;
using System.Text;

namespace Svg.Pathing
{
    public sealed class SvgClosePathSegment : SvgPathSegment
    {
        public override void AddToPath(System.Drawing.Drawing2D.GraphicsPath graphicsPath)
        {
Eric Domke's avatar
Eric Domke committed
11
12
13
14
15
            // Important for custom line caps.  Force the path the close with an explicit line, not just an implicit close of the figure.
            if (graphicsPath.PathPoints.Length > 1 && !graphicsPath.PathPoints[0].Equals(graphicsPath.PathPoints[graphicsPath.PathPoints.Length - 1]))
            {
                graphicsPath.AddLine(graphicsPath.PathPoints[graphicsPath.PathPoints.Length - 1], graphicsPath.PathPoints[0]);
            }
davescriven's avatar
davescriven committed
16
17
            graphicsPath.CloseFigure();
        }
Tebjan Halm's avatar
Tebjan Halm committed
18
19
20
21
22
23
        
        public override string ToString()
		{
			return "z";
		}

davescriven's avatar
davescriven committed
24
25
    }
}