//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp
{
using System;
using Processing.Processors;
///
/// Extension methods for the type.
///
public static partial class ImageExtensions
{
///
/// Applies a radial glow effect to an image.
///
/// The pixel format.
/// The image this method extends.
/// The .
public static Image Glow(this Image source)
where TColor : struct, IPackedPixel, IEquatable
{
return Glow(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds);
}
///
/// Applies a radial glow effect to an image.
///
/// The pixel format.
/// The image this method extends.
/// The color to set as the glow.
/// The .
public static Image Glow(this Image source, TColor color)
where TColor : struct, IPackedPixel, IEquatable
{
return Glow(source, color, source.Bounds.Width * .5F, source.Bounds);
}
///
/// Applies a radial glow effect to an image.
///
/// The pixel format.
/// The image this method extends.
/// The the radius.
/// The .
public static Image Glow(this Image source, float radius)
where TColor : struct, IPackedPixel, IEquatable
{
return Glow(source, NamedColors.Black, radius, source.Bounds);
}
///
/// Applies a radial glow effect to an image.
///
/// The pixel format.
/// The image this method extends.
///
/// The structure that specifies the portion of the image object to alter.
///
/// The .
public static Image Glow(this Image source, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable
{
return Glow(source, NamedColors.Black, 0, rectangle);
}
///
/// Applies a radial glow effect to an image.
///
/// The pixel format.
/// The image this method extends.
/// The color to set as the glow.
/// The the radius.
///
/// The structure that specifies the portion of the image object to alter.
///
/// The .
public static Image Glow(this Image source, TColor color, float radius, Rectangle rectangle)
where TColor : struct, IPackedPixel, IEquatable
{
GlowProcessor processor = new GlowProcessor(color) { Radius = radius, };
source.ApplyProcessor(processor, rectangle);
return source;
}
}
}