Browse Source

Blend => DrawImage

af/merge-core
James Jackson-South 8 years ago
parent
commit
d02a2eb93f
  1. 10
      src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs
  2. 2
      tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs

10
src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs

@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="image">The image to blend with the currently processing image.</param>
/// <param name="opacity">The opacity of the image to blend. Must be between 0 and 1.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Blend<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, float opacity)
public static IImageProcessingContext<TPixel> DrawImage<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, float opacity)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, opacity));
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="blender">The blending mode.</param>
/// <param name="opacity">The opacity of the image to blend. Must be between 0 and 1.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Blend<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, PixelBlenderMode blender, float opacity)
public static IImageProcessingContext<TPixel> DrawImage<TPixel>(this IImageProcessingContext<TPixel> source, Image<TPixel> image, PixelBlenderMode blender, float opacity)
where TPixel : struct, IPixel<TPixel>
=> source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, opacity, blender));
@ -45,11 +45,9 @@ namespace SixLabors.ImageSharp.Processing.Drawing
/// <param name="options">The options, including the blending type and blending amount.</param>
/// <param name="image">The image to blend with the currently processing image.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> Blend<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Image<TPixel> image)
public static IImageProcessingContext<TPixel> DrawImage<TPixel>(this IImageProcessingContext<TPixel> source, GraphicsOptions options, Image<TPixel> image)
where TPixel : struct, IPixel<TPixel>
{
return source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, options));
}
=> source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, options));
/// <summary>
/// Draws the given image together with the current one by blending their pixels.

2
tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs

@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
using (Image<Rgba32> src = srcFile.CreateImage())
using (Image<Rgba32> dest = provider.GetImage())
{
using (Image<Rgba32> res = dest.Clone(x => x.Blend(new GraphicsOptions { BlenderMode = mode }, src)))
using (Image<Rgba32> res = dest.Clone(x => x.DrawImage(new GraphicsOptions { BlenderMode = mode }, src)))
{
res.DebugSave(provider, mode.ToString());
res.CompareToReferenceOutput(provider, mode.ToString());

Loading…
Cancel
Save