// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
namespace SixLabors.ImageSharp.Drawing.Processing {
///
/// Defines the image processor used by
/// to execute a canvas callback for each image frame.
///
public sealed class PaintProcessor : IImageProcessor
{
///
/// Initializes a new instance of the class.
///
/// The drawing options used when creating each frame canvas.
/// The per-frame painting callback.
public PaintProcessor(DrawingOptions options, CanvasAction action)
{
Guard.NotNull(options, nameof(options));
Guard.NotNull(action, nameof(action));
this.Options = options;
this.Action = action;
}
///
/// Gets the drawing options used when creating each frame canvas.
///
public DrawingOptions Options { get; }
///
/// Gets the per-frame painting callback.
///
internal CanvasAction Action { get; }
///
public IImageProcessor CreatePixelSpecificProcessor(
Configuration configuration,
Image source,
Rectangle sourceRectangle)
where TPixel : unmanaged, IPixel
=> new PaintProcessor(configuration, this, source, sourceRectangle);
}
}