//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp
{
using System;
using Drawing.Processors;
///
/// Extension methods for the type.
///
public static partial class ImageExtensions
{
///
/// Draws the given image together with the current one by blending their pixels.
///
/// The pixel format.
/// The image this method extends.
/// The image to blend with the currently processing image.
/// The opacity of the image image to blend. Must be between 0 and 100.
/// The .
public static Image Blend(this Image source, Image image, int percent = 50)
where TColor : struct, IPixel
{
return DrawImage(source, image, percent, default(Size), default(Point));
}
///
/// Draws the given image together with the current one by blending their pixels.
///
/// The image this method extends.
/// The image to blend with the currently processing image.
/// The pixel format.
/// The opacity of the image image to blend. Must be between 0 and 100.
/// The size to draw the blended image.
/// The location to draw the blended image.
/// The .
public static Image DrawImage(this Image source, Image image, int percent, Size size, Point location)
where TColor : struct, IPixel
{
if (size == default(Size))
{
size = new Size(image.Width, image.Height);
}
if (location == default(Point))
{
location = Point.Empty;
}
source.ApplyProcessor(new DrawImageProcessor(image, size, location, percent), source.Bounds);
return source;
}
}
}