// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp.Drawing.Processing {
///
/// Represents the per-frame painting callback executed by .
///
/// The drawing canvas for the current image frame.
public delegate void CanvasAction(DrawingCanvas canvas);
///
/// Adds image-processing extensions that paint each frame through .
///
public static class PaintExtensions
{
///
/// Paints each image frame using drawing options from the current context.
///
/// The image processing context to paint.
/// The per-frame painting callback.
/// The so additional processing operations can be chained.
public static IImageProcessingContext Paint(
this IImageProcessingContext source,
CanvasAction action)
=> source.Paint(source.GetDrawingOptions(), action);
///
/// Paints each image frame using the supplied drawing options.
///
/// The image processing context to paint.
/// The drawing options applied when creating each frame canvas.
/// The per-frame painting callback.
/// The so additional processing operations can be chained.
public static IImageProcessingContext Paint(
this IImageProcessingContext source,
DrawingOptions options,
CanvasAction action)
{
Guard.NotNull(options, nameof(options));
Guard.NotNull(action, nameof(action));
return source.ApplyProcessor(new PaintProcessor(options, action));
}
}
}