// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Drawing.Processing {
///
/// Provides a set of configurations options for pens.
///
public struct PenOptions
{
///
/// Initializes a new instance of the struct.
///
/// The stroke width in the path's local coordinate space before any drawing transform is applied.
public PenOptions(float strokeWidth)
: this(Color.Black, strokeWidth)
{
}
///
/// Initializes a new instance of the struct.
///
/// The color.
/// The stroke width in the path's local coordinate space before any drawing transform is applied.
public PenOptions(Color color, float strokeWidth)
: this(color, strokeWidth, null)
{
}
///
/// Initializes a new instance of the struct.
///
/// The color.
/// The stroke width in the path's local coordinate space before any drawing transform is applied.
/// The stroke pattern.
public PenOptions(Color color, float strokeWidth, float[]? strokePattern)
: this(new SolidBrush(color), strokeWidth, strokePattern)
{
}
///
/// Initializes a new instance of the struct.
///
/// The brush used to fill the stroke outline.
/// The stroke width in the path's local coordinate space before any drawing transform is applied.
/// The stroke pattern.
public PenOptions(Brush strokeFill, float strokeWidth, float[]? strokePattern)
{
Guard.MustBeGreaterThan(strokeWidth, 0, nameof(strokeWidth));
this.StrokeFill = strokeFill;
this.StrokeWidth = strokeWidth;
this.StrokePattern = strokePattern ?? Pens.EmptyPattern;
this.StrokeOptions = new StrokeOptions();
}
///
/// Gets the brush used to fill the stroke outline. Defaults to .
///
public Brush StrokeFill { get; }
///
/// Gets the stroke width in the path's local coordinate space before any drawing transform is applied. Defaults to 1.
///
public float StrokeWidth { get; }
///
/// Gets the stroke pattern.
///
public float[] StrokePattern { get; }
///
/// Gets or sets the stroke geometry options used to stroke paths drawn with this pen.
///
public StrokeOptions? StrokeOptions { get; set; }
}
}