From d02a2eb93f7434f0a67dcede55c5a956583eef05 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 21 Mar 2018 16:10:14 +1100 Subject: [PATCH] Blend => DrawImage --- .../Processing/Drawing/DrawImageExtensions.cs | 10 ++++------ .../PixelBlenders/PorterDuffCompositorTests.cs | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs index e2951ee2c..83e1b90f5 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs @@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The image to blend with the currently processing image. /// The opacity of the image to blend. Must be between 0 and 1. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, float opacity) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, float opacity) where TPixel : struct, IPixel => source.ApplyProcessor(new DrawImageProcessor(image, opacity)); @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The blending mode. /// The opacity of the image to blend. Must be between 0 and 1. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, Image image, PixelBlenderMode blender, float opacity) where TPixel : struct, IPixel => source.ApplyProcessor(new DrawImageProcessor(image, opacity, blender)); @@ -45,11 +45,9 @@ namespace SixLabors.ImageSharp.Processing.Drawing /// The options, including the blending type and blending amount. /// The image to blend with the currently processing image. /// The . - public static IImageProcessingContext Blend(this IImageProcessingContext source, GraphicsOptions options, Image image) + public static IImageProcessingContext DrawImage(this IImageProcessingContext source, GraphicsOptions options, Image image) where TPixel : struct, IPixel - { - return source.ApplyProcessor(new DrawImageProcessor(image, options)); - } + => source.ApplyProcessor(new DrawImageProcessor(image, options)); /// /// Draws the given image together with the current one by blending their pixels. diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs index 11e6000fe..36473fa56 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs @@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders using (Image src = srcFile.CreateImage()) using (Image dest = provider.GetImage()) { - using (Image res = dest.Clone(x => x.Blend(new GraphicsOptions { BlenderMode = mode }, src))) + using (Image res = dest.Clone(x => x.DrawImage(new GraphicsOptions { BlenderMode = mode }, src))) { res.DebugSave(provider, mode.ToString()); res.CompareToReferenceOutput(provider, mode.ToString());