// 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.
namespace Perspex.Media
{
///
/// Describes how a stroke is drawn.
///
public class Pen
{
///
/// Initializes a new instance of the class.
///
/// The brush used to draw.
/// The stroke thickness.
/// The dash style.
/// The dash cap.
/// The start line cap.
/// The end line cap.
/// The line join.
/// The miter limit.
public Pen(
IBrush brush,
double thickness = 1.0,
DashStyle dashStyle = null,
PenLineCap dashCap = PenLineCap.Flat,
PenLineCap startLineCap = PenLineCap.Flat,
PenLineCap endLineCap = PenLineCap.Flat,
PenLineJoin lineJoin = PenLineJoin.Miter,
double miterLimit = 10.0)
{
Brush = brush;
Thickness = thickness;
DashCap = dashCap;
StartLineCap = startLineCap;
EndLineCap = endLineCap;
LineJoin = lineJoin;
MiterLimit = miterLimit;
DashStyle = dashStyle;
}
///
/// Initializes a new instance of the class.
///
/// The stroke color.
/// The stroke thickness.
/// The dash style.
/// The dash cap.
/// The start line cap.
/// The end line cap.
/// The line join.
/// The miter limit.
public Pen(
uint color,
double thickness = 1.0,
DashStyle dashStyle = null,
PenLineCap dashCap = PenLineCap.Flat,
PenLineCap startLineCap = PenLineCap.Flat,
PenLineCap endLineCap = PenLineCap.Flat,
PenLineJoin lineJoin = PenLineJoin.Miter,
double miterLimit = 10.0)
{
Brush = new SolidColorBrush(color);
Thickness = thickness;
StartLineCap = startLineCap;
EndLineCap = endLineCap;
LineJoin = lineJoin;
MiterLimit = miterLimit;
DashStyle = dashStyle;
DashCap = dashCap;
}
///
/// Gets the brush used to draw the stroke.
///
public IBrush Brush { get; }
///
/// Gets the stroke thickness.
///
public double Thickness { get; } = 1.0;
public DashStyle DashStyle { get; }
public PenLineCap DashCap { get; }
public PenLineCap StartLineCap { get; } = PenLineCap.Flat;
public PenLineCap EndLineCap { get; } = PenLineCap.Flat;
public PenLineJoin LineJoin { get; } = PenLineJoin.Miter;
public double MiterLimit { get; } = 10.0;
}
}