namespace ImageSharp.Tests.Drawing.Paths { using System; using System.IO; using ImageSharp; using Processing; using System.Collections.Generic; using ImageSharp.Formats; /// /// Watches but does not actually run the processors against the image. /// /// public class ProcessorWatchingImage : Image, IImageCallbacks { public List ProcessorApplications { get; } = new List(); public ProcessorWatchingImage(int width, int height) : base(width, height, Configuration.CreateDefaultInstance()) { this.Callbacks = this; } public bool OnSaving(ImageBase image, Stream stream, IImageEncoder encoder, IEncoderOptions options) where TColor : struct, IPixel { return true; } public bool OnProcessing(ImageBase image, IImageProcessor processor, Rectangle rectangle) where TColor : struct, IPixel { this.ProcessorApplications.Add(new ProcessorDetails { processor = (IImageProcessor)processor, rectangle = rectangle }); return false;// do not really apply the processor to speed up testing } public struct ProcessorDetails { public IImageProcessor processor; public Rectangle rectangle; } } }