// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Collections.Generic;
using System.Numerics;
namespace SixLabors.ImageSharp.Drawing.Processing.Backends {
///
/// One stroked path command queued by the canvas batcher.
///
public readonly struct StrokePathCommand
{
private readonly IPath sourcePath;
private readonly DrawingOptions drawingOptions;
private readonly IReadOnlyList? clipPaths;
///
/// Initializes a new instance of the struct.
///
/// The source stroke path.
/// The brush used to shade the stroke.
/// The drawing options (graphics, shape, transform) used during composition.
/// The rasterizer options used to generate coverage.
/// The absolute bounds of the logical target.
/// The absolute destination offset of the command.
/// The stroke metadata.
/// Optional clip paths supplied with the command.
/// True if the command was recorded inside a layer.
public StrokePathCommand(
IPath sourcePath,
Brush brush,
DrawingOptions drawingOptions,
in RasterizerOptions rasterizerOptions,
Rectangle targetBounds,
Point destinationOffset,
Pen pen,
IReadOnlyList? clipPaths,
bool isInsideLayer)
{
this.sourcePath = sourcePath;
this.drawingOptions = drawingOptions;
this.clipPaths = clipPaths;
this.Brush = brush;
this.RasterizerOptions = rasterizerOptions;
this.TargetBounds = targetBounds;
this.DestinationOffset = destinationOffset;
this.Pen = pen;
this.IsInsideLayer = isInsideLayer;
}
///
/// Gets the brush used during composition.
///
public Brush Brush { get; }
///
/// Gets the drawing options carried by the command.
///
public DrawingOptions DrawingOptions => this.drawingOptions;
///
/// Gets the graphics options used during composition.
///
public GraphicsOptions GraphicsOptions => this.drawingOptions.GraphicsOptions;
///
/// Gets the rasterizer options used to generate coverage.
///
public RasterizerOptions RasterizerOptions { get; }
///
/// Gets the absolute bounds of the logical target for this command.
///
public Rectangle TargetBounds { get; }
///
/// Gets the absolute destination offset where the local coverage should be composited.
///
public Point DestinationOffset { get; }
///
/// Gets the stroke metadata for this command.
///
public Pen Pen { get; }
///
/// Gets the source stroke path.
///
public IPath SourcePath => this.sourcePath;
///
/// Gets the drawing transform.
///
public Matrix4x4 Transform => this.drawingOptions.Transform;
///
/// Gets the optional clip paths carried by the command.
///
public IReadOnlyList? ClipPaths => this.clipPaths;
///
/// Gets the shape options carried by the command.
///
public ShapeOptions ShapeOptions => this.drawingOptions.ShapeOptions;
///
/// Gets a value indicating whether the command was recorded inside a layer.
///
public bool IsInsideLayer { get; }
}
}