• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • SixLabors.ImageSharp.Drawing
      • ArcLineSegment
      • ClipPathExtensions
      • ClippingOperation
      • ComplexPolygon
      • CubicBezierLineSegment
      • EllipsePolygon
      • EmptyPath
      • EndCapStyle
      • ILineSegment
      • IPath
      • IPathCollection
      • ISimplePath
      • IntersectionRule
      • JointStyle
      • LinearLineSegment
      • OutlinePathExtensions
      • Path
      • PathBuilder
      • PathCollection
      • PathExtensions
      • PathTypes
      • Polygon
      • RectangularPolygon
      • RegularPolygon
      • SegmentInfo
      • Star
      • TextBuilder
    • SixLabors.ImageSharp.Drawing.Processing
      • Brush
      • BrushApplicator<TPixel>
      • Brushes
      • ClearExtensions
      • ClearPathExtensions
      • ClearRectangleExtensions
      • ClipPathExtensions
      • ColorStop
      • DrawBezierExtensions
      • DrawLineExtensions
      • DrawPathCollectionExtensions
      • DrawPathExtensions
      • DrawPolygonExtensions
      • DrawRectangleExtensions
      • DrawTextExtensions
      • DrawingOptions
      • DrawingOptionsDefaultsExtensions
      • EllipticGradientBrush
      • FillExtensions
      • FillPathBuilderExtensions
      • FillPathCollectionExtensions
      • FillPathExtensions
      • FillPolygonExtensions
      • FillRectangleExtensions
      • GradientBrush
      • GradientRepetitionMode
      • ImageBrush
      • LinearGradientBrush
      • PathGradientBrush
      • PatternBrush
      • PatternPen
      • Pen
      • PenOptions
      • Pens
      • RadialGradientBrush
      • RecolorBrush
      • RichTextOptions
      • RichTextRun
      • ShapeGraphicOptionsDefaultsExtensions
      • ShapeOptions
      • SolidBrush
      • SolidPen
    • SixLabors.ImageSharp.Drawing.Processing.Processors.Drawing
      • ClipPathProcessor
      • DrawPathProcessor
      • FillPathProcessor
      • FillProcessor
    • SixLabors.ImageSharp.Drawing.Processing.Processors.Text
      • DrawTextProcessor
    • SixLabors.ImageSharp.Drawing.Shapes.PolygonClipper
      • ClipperException
      • ClippingType

    Class Pen

    The base class for pens that can apply a pattern to a line with a set brush and thickness

    Inheritance
    object
    Pen
    PatternPen
    SolidPen
    Implements
    IEquatable<Pen>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: SixLabors.ImageSharp.Drawing.Processing
    Assembly: SixLabors.ImageSharp.Drawing.dll
    Syntax
    public abstract class Pen : IEquatable<Pen>
    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

    | Edit this page View Source

    Pen(Brush)

    Initializes a new instance of the Pen class.

    Declaration
    protected Pen(Brush strokeFill)
    Parameters
    Type Name Description
    Brush strokeFill

    The brush used to fill the stroke outline.

    | Edit this page View Source

    Pen(Brush, float)

    Initializes a new instance of the Pen class.

    Declaration
    protected Pen(Brush strokeFill, float strokeWidth)
    Parameters
    Type Name Description
    Brush strokeFill

    The brush used to fill the stroke outline.

    float strokeWidth

    The stroke width in px units.

    | Edit this page View Source

    Pen(Brush, float, float[])

    Initializes a new instance of the Pen class.

    Declaration
    protected Pen(Brush strokeFill, float strokeWidth, float[] strokePattern)
    Parameters
    Type Name Description
    Brush strokeFill

    The brush used to fill the stroke outline.

    float strokeWidth

    The stroke width in px units.

    float[] strokePattern

    The stroke pattern.

    | Edit this page View Source

    Pen(PenOptions)

    Initializes a new instance of the Pen class.

    Declaration
    protected Pen(PenOptions options)
    Parameters
    Type Name Description
    PenOptions options

    The pen options.

    Properties

    | Edit this page View Source

    EndCapStyle

    Gets or sets the end cap style.

    Declaration
    public EndCapStyle EndCapStyle { get; }
    Property Value
    Type Description
    EndCapStyle
    | Edit this page View Source

    JointStyle

    Gets or sets the joint style.

    Declaration
    public JointStyle JointStyle { get; }
    Property Value
    Type Description
    JointStyle
    | Edit this page View Source

    StrokeFill

    Gets the brush used to fill the stroke outline. Defaults to SolidBrush.

    Declaration
    public Brush StrokeFill { get; }
    Property Value
    Type Description
    Brush
    | Edit this page View Source

    StrokePattern

    Gets the stroke pattern.

    Declaration
    public ReadOnlySpan<float> StrokePattern { get; }
    Property Value
    Type Description
    ReadOnlySpan<float>
    | Edit this page View Source

    StrokeWidth

    Gets the stroke width in px units. Defaults to 1px.

    Declaration
    public float StrokeWidth { get; }
    Property Value
    Type Description
    float

    Methods

    | Edit this page View Source

    Equals(Pen?)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public virtual bool Equals(Pen? other)
    Parameters
    Type Name Description
    Pen other

    An object to compare with this object.

    Returns
    Type Description
    bool

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

    | Edit this page View Source

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

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

    Overrides
    object.Equals(object)
    | Edit this page View Source

    GeneratePath(IPath)

    Applies the styling from the pen to a path and generate a new path with the final vector.

    Declaration
    public IPath GeneratePath(IPath path)
    Parameters
    Type Name Description
    IPath path

    The source path

    Returns
    Type Description
    IPath

    The IPath with the pen styling applied.

    | Edit this page View Source

    GeneratePath(IPath, float)

    Applies the styling from the pen to a path and generate a new path with the final vector.

    Declaration
    public abstract IPath GeneratePath(IPath path, float strokeWidth)
    Parameters
    Type Name Description
    IPath path

    The source path

    float strokeWidth

    The stroke width in px units.

    Returns
    Type Description
    IPath

    The IPath with the pen styling applied.

    | Edit this page View Source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    Implements

    IEquatable<T>
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX