Class PatternPen
- Namespace
- SixLabors.ImageSharp.Drawing.Processing
- Assembly
- SixLabors.ImageSharp.Drawing.dll
Defines a pen that can apply a pattern to a line with a set brush and thickness.
public class PatternPen : Pen, IEquatable<Pen>
- Inheritance
-
PatternPen
- Implements
- Inherited Members
Remarks
The pattern is expressed in the form
[1f, 2f, 0.5f]
this will be converted into a pattern that is 3.5 times longer than 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
PatternPen(Color, float, float[])
Initializes a new instance of the PatternPen class.
public PatternPen(Color color, float strokeWidth, float[] strokePattern)
Parameters
colorColorThe color.
strokeWidthfloatThe stroke width in the path's local coordinate space before any drawing transform is applied.
strokePatternfloat[]The stroke pattern.
PatternPen(Color, float, float[], float)
Initializes a new instance of the PatternPen class.
public PatternPen(Color color, float strokeWidth, float[] strokePattern, float strokePatternOffset)
Parameters
colorColorThe color.
strokeWidthfloatThe stroke width in the path's local coordinate space before any drawing transform is applied.
strokePatternfloat[]The stroke pattern.
strokePatternOffsetfloatThe distance into the stroke pattern, expressed as a multiple of
strokeWidth.
PatternPen(Color, float[])
Initializes a new instance of the PatternPen class.
public PatternPen(Color color, float[] strokePattern)
Parameters
PatternPen(Color, float[], float)
Initializes a new instance of the PatternPen class.
public PatternPen(Color color, float[] strokePattern, float strokePatternOffset)
Parameters
colorColorThe color.
strokePatternfloat[]The stroke pattern.
strokePatternOffsetfloatThe distance into the stroke pattern, expressed as a multiple of the stroke width.
PatternPen(Brush, float, float[])
Initializes a new instance of the PatternPen class.
public PatternPen(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.
PatternPen(Brush, float, float[], float)
Initializes a new instance of the PatternPen class.
public PatternPen(Brush strokeFill, float strokeWidth, float[] strokePattern, float strokePatternOffset)
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.
strokePatternOffsetfloatThe distance into the stroke pattern, expressed as a multiple of
strokeWidth.
PatternPen(PenOptions)
Initializes a new instance of the PatternPen class.
public PatternPen(PenOptions options)
Parameters
optionsPenOptionsThe pen options.
Methods
Equals(Pen?)
Indicates whether the current object is equal to another object of the same type.
public override bool Equals(Pen? other)
Parameters
otherPenAn object to compare with this object.
Returns
GeneratePath(IPath, float)
Applies the styling from the pen to a path and generates a new path with the final vector.
public override 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.