mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
2.0 KiB
44 lines
2.0 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.ImageSharp.Processing.Processors.Convolution;
|
|
using SixLabors.Primitives;
|
|
|
|
namespace SixLabors.ImageSharp.Processing
|
|
{
|
|
/// <summary>
|
|
/// Adds Gaussian blurring extensions to the <see cref="Image"/> type.
|
|
/// </summary>
|
|
public static class GaussianBlurExtensions
|
|
{
|
|
/// <summary>
|
|
/// Applies a Gaussian blur to the image.
|
|
/// </summary>
|
|
/// <param name="source">The image this method extends.</param>
|
|
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source)
|
|
=> source.ApplyProcessor(new GaussianBlurProcessor());
|
|
|
|
/// <summary>
|
|
/// Applies a Gaussian blur to the image.
|
|
/// </summary>
|
|
/// <param name="source">The image this method extends.</param>
|
|
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
|
|
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma)
|
|
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma));
|
|
|
|
/// <summary>
|
|
/// Applies a Gaussian blur to the image.
|
|
/// </summary>
|
|
/// <param name="source">The image this method extends.</param>
|
|
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
|
|
/// <param name="rectangle">
|
|
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
|
|
/// </param>
|
|
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|
public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle)
|
|
=> source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle);
|
|
}
|
|
}
|