Skip to content

Commit de47366

Browse files
enable for pens
1 parent 2609d5e commit de47366

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/ImageSharp.Drawing/Processing/Pen.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
#nullable disable
5-
64
namespace SixLabors.ImageSharp.Drawing.Processing;
75

86
/// <summary>
@@ -104,15 +102,16 @@ public IPath GeneratePath(IPath path)
104102
public abstract IPath GeneratePath(IPath path, float strokeWidth);
105103

106104
/// <inheritdoc/>
107-
public virtual bool Equals(Pen other)
108-
=> this.StrokeWidth == other.StrokeWidth
105+
public virtual bool Equals(Pen? other)
106+
=> other != null
107+
&& this.StrokeWidth == other.StrokeWidth
109108
&& this.JointStyle == other.JointStyle
110109
&& this.EndCapStyle == other.EndCapStyle
111110
&& this.StrokeFill.Equals(other.StrokeFill)
112111
&& this.StrokePattern.SequenceEqual(other.StrokePattern);
113112

114113
/// <inheritdoc/>
115-
public override bool Equals(object obj) => this.Equals(obj as Pen);
114+
public override bool Equals(object? obj) => this.Equals(obj as Pen);
116115

117116
/// <inheritdoc/>
118117
public override int GetHashCode()

src/ImageSharp.Drawing/Processing/PenOptions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
#nullable disable
5-
64
namespace SixLabors.ImageSharp.Drawing.Processing;
75

86
/// <summary>
@@ -35,7 +33,7 @@ public PenOptions(Color color, float strokeWidth)
3533
/// <param name="color">The color.</param>
3634
/// <param name="strokeWidth">The stroke width in px units.</param>
3735
/// <param name="strokePattern">The stroke pattern.</param>
38-
public PenOptions(Color color, float strokeWidth, float[] strokePattern)
36+
public PenOptions(Color color, float strokeWidth, float[]? strokePattern)
3937
: this(new SolidBrush(color), strokeWidth, strokePattern)
4038
{
4139
}
@@ -46,7 +44,7 @@ public PenOptions(Color color, float strokeWidth, float[] strokePattern)
4644
/// <param name="strokeFill">The brush used to fill the stroke outline.</param>
4745
/// <param name="strokeWidth">The stroke width in px units.</param>
4846
/// <param name="strokePattern">The stroke pattern.</param>
49-
public PenOptions(Brush strokeFill, float strokeWidth, float[] strokePattern)
47+
public PenOptions(Brush strokeFill, float strokeWidth, float[]? strokePattern)
5048
{
5149
Guard.MustBeGreaterThan(strokeWidth, 0, nameof(strokeWidth));
5250

@@ -70,7 +68,7 @@ public PenOptions(Brush strokeFill, float strokeWidth, float[] strokePattern)
7068
/// <summary>
7169
/// Gets the stroke pattern.
7270
/// </summary>
73-
public float[] StrokePattern { get; }
71+
public float[]? StrokePattern { get; }
7472

7573
/// <summary>
7674
/// Gets or sets the joint style.

0 commit comments

Comments
 (0)