Table of Contents

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

color Color

The color.

strokeWidth float

The stroke width in the path's local coordinate space before any drawing transform is applied.

strokePattern float[]

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

color Color

The color.

strokeWidth float

The stroke width in the path's local coordinate space before any drawing transform is applied.

strokePattern float[]

The stroke pattern.

strokePatternOffset float

The 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

color Color

The color.

strokePattern float[]

The stroke pattern.

PatternPen(Color, float[], float)

Initializes a new instance of the PatternPen class.

public PatternPen(Color color, float[] strokePattern, float strokePatternOffset)

Parameters

color Color

The color.

strokePattern float[]

The stroke pattern.

strokePatternOffset float

The 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

strokeFill Brush

The brush used to fill the stroke outline.

strokeWidth float

The stroke width in the path's local coordinate space before any drawing transform is applied.

strokePattern float[]

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

strokeFill Brush

The brush used to fill the stroke outline.

strokeWidth float

The stroke width in the path's local coordinate space before any drawing transform is applied.

strokePattern float[]

The stroke pattern.

strokePatternOffset float

The 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

options PenOptions

The 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

other Pen

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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

path IPath

The source path.

strokeWidth float

The stroke width in the path's local coordinate space before any drawing transform is applied.

Returns

IPath

The IPath with the pen styling applied.