// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests { using System; /// /// Provides instances for parametric unit tests. /// /// The pixel format of the image public abstract partial class TestImageProvider where TColor : struct, IPackedPixel, IEquatable { private class SolidProvider : BlankProvider { private readonly byte a; private readonly byte b; private readonly byte g; private readonly byte r; public SolidProvider(int width, int height, byte r, byte g, byte b, byte a) : base(width, height) { this.r = r; this.g = g; this.b = b; this.a = a; } public override string SourceFileOrDescription => $"Solid{this.Width}x{this.Height}_({this.r},{this.g},{this.b},{this.a})"; public override Image GetImage() { var image = base.GetImage(); TColor color = default(TColor); color.PackFromBytes(this.r, this.g, this.b, this.a); return image.Fill(color); } } } }