// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using Perspex.Platform;
namespace Perspex.Media
{
///
/// Represents the geometry of a line.
///
public class LineGeometry : Geometry
{
private Point _startPoint;
private Point _endPoint;
///
/// Initializes a new instance of the class.
///
/// The start point.
/// The end point.
public LineGeometry(Point startPoint, Point endPoint)
{
_startPoint = startPoint;
_endPoint = endPoint;
IPlatformRenderInterface factory = PerspexLocator.Current.GetService();
IStreamGeometryImpl impl = factory.CreateStreamGeometry();
using (IStreamGeometryContextImpl context = impl.Open())
{
context.BeginFigure(_startPoint, false);
context.LineTo(_endPoint);
context.EndFigure(false);
}
PlatformImpl = impl;
}
///
public override Geometry Clone()
{
return new LineGeometry(_startPoint, _endPoint);
}
}
}