Class Pen
- Namespace
- SixLabors.ImageSharp.Drawing.Processing
- Assembly
- SixLabors.ImageSharp.Drawing.dll
The base class for pens that can apply a pattern to a line with a set brush and thickness
public abstract class Pen : IEquatable<Pen>
- Inheritance
-
Pen
- Implements
- Derived
- Inherited Members
Remarks
The pattern will be in to the form of
new float[]{ 1f, 2f, 0.5f}
this will be converted into a pattern that is 3.5 times longer that the width with 3 sections.
- Section 1 will be width long (making a square) and will be filled by the brush.
- Section 2 will be width * 2 long and will be empty.
- Section 3 will be width/2 long and will be filled.
The pattern will immediately repeat without gap.
Constructors
Pen(Brush)
Initializes a new instance of the Pen class.
protected Pen(Brush strokeFill)
Parameters
strokeFillBrushThe brush used to fill the stroke outline.
Pen(Brush, float)
Initializes a new instance of the Pen class.
protected Pen(Brush strokeFill, float strokeWidth)
Parameters
strokeFillBrushThe brush used to fill the stroke outline.
strokeWidthfloatThe stroke width in the path's local coordinate space before any drawing transform is applied.
Pen(Brush, float, float[])
Initializes a new instance of the Pen class.
protected Pen(Brush strokeFill, float strokeWidth, float[] strokePattern)
Parameters
strokeFillBrushThe brush used to fill the stroke outline.
strokeWidthfloatThe stroke width in the path's local coordinate space before any drawing transform is applied.
strokePatternfloat[]The stroke pattern.
Pen(PenOptions)
Initializes a new instance of the Pen class.
protected Pen(PenOptions options)
Parameters
optionsPenOptionsThe pen options.
Properties
StrokeFill
Gets the brush used to fill the stroke outline. Defaults to SolidBrush.
public Brush StrokeFill { get; }
Property Value
StrokeOptions
Gets or sets the stroke geometry options used to stroke paths drawn with this pen.
public StrokeOptions StrokeOptions { get; }
Property Value
StrokePattern
Gets the stroke pattern.
public ReadOnlyMemory<float> StrokePattern { get; }
Property Value
StrokeWidth
Gets the stroke width in the path's local coordinate space before any drawing transform is applied. Defaults to 1.
public float StrokeWidth { get; }
Property Value
Methods
Equals(Pen?)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(Pen? other)
Parameters
otherPenAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GeneratePath(IPath)
Applies the styling from the pen to a path and generate a new path with the final vector.
public IPath GeneratePath(IPath path)
Parameters
pathIPathThe source path
Returns
GeneratePath(IPath, float)
Applies the styling from the pen to a path and generate a new path with the final vector.
public abstract IPath GeneratePath(IPath path, float strokeWidth)
Parameters
pathIPathThe source path
strokeWidthfloatThe stroke width in the path's local coordinate space before any drawing transform is applied.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.