mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System;
|
|
using System.IO;
|
|
using ImageSharp;
|
|
using Processing;
|
|
using System.Collections.Generic;
|
|
using ImageSharp.Formats;
|
|
using ImageSharp.IO;
|
|
|
|
/// <summary>
|
|
/// Watches but does not actually run the processors against the image.
|
|
/// </summary>
|
|
/// <seealso cref="ImageSharp.Image{ImageSharp.Color}" />
|
|
public class SaveWatchingImage : Image<Color>
|
|
{
|
|
public List<OperationDetails> Saves { get; } = new List<OperationDetails>();
|
|
|
|
public SaveWatchingImage(int width, int height, IFileSystem fs = null)
|
|
: base(width, height, Configuration.CreateDefaultInstance())
|
|
{
|
|
//switch out the file system for tests
|
|
this.Configuration.FileSystem = fs ?? this.Configuration.FileSystem;
|
|
}
|
|
|
|
internal override void SaveInternal(Stream stream, IImageEncoder encoder, IEncoderOptions options)
|
|
{
|
|
this.Saves.Add(new OperationDetails
|
|
{
|
|
encoder = encoder,
|
|
options = options,
|
|
stream = stream
|
|
});
|
|
}
|
|
|
|
public struct OperationDetails
|
|
{
|
|
public Stream stream;
|
|
public IImageEncoder encoder;
|
|
public IEncoderOptions options;
|
|
}
|
|
}
|
|
}
|
|
|