public void InBox <TPixel>(TestImageProvider <TPixel> provider, int levels, int brushSize) where TPixel : struct, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.OilPaint(levels, brushSize, rect), $"{levels}-{brushSize}"); }
public void ApplyFilterInBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Matrix4x4 m = CreateCombinedTestFilterMatrix(); provider.RunRectangleConstrainedValidatingProcessorTest((x, b) => x.Filter(m, b), comparer: ValidatorComparer); }
public void PositionAwareInBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest( (c, rect) => c.ProcessPixelRowsAsVector4( (span, offset) => { int y = offset.Y; int x = offset.X; for (int i = 0; i < span.Length; i++) { float sine = MathF.Sin(y), cosine = MathF.Cos(x + i), sum = sine + cosine, abs = MathF.Abs(sum), a = 0.5f + (abs / 2); Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; var gray = new Vector4(avg, avg, avg, a); span[i] = Vector4.Clamp(gray, Vector4.Zero, Vector4.One); } }, rect)); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider, int levels, int brushSize) where TPixel : unmanaged, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.OilPaint(levels, brushSize, rect), $"{levels}-{brushSize}", ImageComparer.TolerantPercentage(0.01F)); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider, int value) where TPixel : unmanaged, IPixel <TPixel> { provider.Utility.TestGroupName = this.GetType().Name; provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => this.Apply(x, value, rect), value, ValidatorComparer); }
public void ApplyDitherFilterInBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { if (SkipAllDitherTests) { return; } provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.Dither(DefaultDitherer, rect), comparer: ValidatorComparer); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.ProcessPixelRowsAsVector4( span => { for (int i = 0; i < span.Length; i++) { Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; span[i] = new Vector4(avg); } }, rect)); }
public void ApplyQuantizationInBox <TPixel>(TestImageProvider <TPixel> provider, IQuantizer quantizer) where TPixel : unmanaged, IPixel <TPixel> { if (SkipAllQuantizerTests) { return; } string quantizerName = quantizer.GetType().Name; string ditherName = quantizer.Options.Dither?.GetType()?.Name ?? "NoDither"; string testOutputDetails = $"{quantizerName}_{ditherName}"; provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.Quantize(quantizer, rect), testOutputDetails: testOutputDetails, comparer: ValidatorComparer, appendPixelTypeToFileName: false); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider, int value) where TPixel : unmanaged, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest((x, rect) => x.Pixelate(value, rect), value); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { provider.Utility.TestGroupName = this.GetType().Name; provider.RunRectangleConstrainedValidatingProcessorTest(this.Apply); }
public void InBox <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { provider.RunRectangleConstrainedValidatingProcessorTest( (x, rect) => x.BackgroundColor(Color.HotPink, rect)); }