/
SolidPen.cs
72 lines (63 loc) · 2.03 KB
/
SolidPen.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Drawing.Processing;
/// <summary>
/// Defines a pen that can apply a pattern to a line with a set brush and thickness.
/// </summary>
public class SolidPen : Pen
{
/// <summary>
/// Initializes a new instance of the <see cref="SolidPen"/> class.
/// </summary>
/// <param name="color">The color.</param>
public SolidPen(Color color)
: base(new SolidBrush(color))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SolidPen"/> class.
/// </summary>
/// <param name="color">The color.</param>
/// <param name="width">The width.</param>
public SolidPen(Color color, float width)
: base(new SolidBrush(color), width)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SolidPen"/> class.
/// </summary>
/// <param name="strokeFill">The brush used to fill the stroke outline.</param>
public SolidPen(Brush strokeFill)
: base(strokeFill)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SolidPen"/> class.
/// </summary>
/// <param name="strokeFill">The brush used to fill the stroke outline.</param>
/// <param name="strokeWidth">The stroke width in px units.</param>
public SolidPen(Brush strokeFill, float strokeWidth)
: base(strokeFill, strokeWidth)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SolidPen"/> class.
/// </summary>
/// <param name="options">The pen options.</param>
public SolidPen(PenOptions options)
: base(options)
{
}
/// <inheritdoc/>
public override bool Equals(Pen? other)
{
if (other is SolidPen)
{
return base.Equals(other);
}
return false;
}
/// <inheritdoc />
public override IPath GeneratePath(IPath path, float strokeWidth)
=> path.GenerateOutline(strokeWidth, this.JointStyle, this.EndCapStyle);
}