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 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

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[])

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(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(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 generate 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.