// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Tests.Drawing { using System; using System.Linq; using System.Collections.Generic; using System.Text; using ImageSharp.PixelFormats; using Xunit; public class BlendedShapes { public static IEnumerable modes = ((PixelBlenderMode[])Enum.GetValues(typeof(PixelBlenderMode))) .Select(x=> new object[] { x }); [Theory] [WithBlankImages(nameof(modes), 100, 100, PixelTypes.Rgba32)] public void DrawBlendedValues(TestImageProvider provider, PixelBlenderMode mode) where TPixel : struct, IPixel { using (var img = provider.GetImage()) { img.Fill(NamedColors.DarkBlue, new Rectangle(0, 40, 100, 20)); img.Fill(NamedColors.HotPink, new Rectangle(40, 0, 20, 100), new ImageSharp.GraphicsOptions(true) { BlenderMode = mode }); img.DebugSave(provider, new { mode }); } } [Theory] [WithBlankImages(nameof(modes), 100, 100, PixelTypes.Rgba32)] public void DrawBlendedValues_transparent(TestImageProvider provider, PixelBlenderMode mode) where TPixel : struct, IPixel { using (var img = provider.GetImage()) { img.Fill(NamedColors.DarkBlue, new Rectangle(0, 40, 100, 20)); img.Fill(NamedColors.HotPink, new Rectangle(20, 0, 40, 100), new ImageSharp.GraphicsOptions(true) { BlenderMode = mode }); img.Fill(NamedColors.Transparent, new Rectangle(40, 0, 20, 100), new ImageSharp.GraphicsOptions(true) { BlenderMode = mode }); img.DebugSave(provider, new { mode }); } } } }