using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
namespace ComputeSharp.BokehBlur.Processors
{
///
/// Defines Gaussian blur by a (Sigma, Radius) pair
///
public sealed class HlslGaussianBlurProcessor : IImageProcessor
{
///
/// The default value for .
///
public const float DefaultSigma = 3f;
///
/// Initializes a new instance of the class
///
public HlslGaussianBlurProcessor() : this(DefaultSigma, 9) { }
///
/// Initializes a new instance of the class
///
/// The radius value representing the size of the area to sample
public HlslGaussianBlurProcessor(int radius) : this(radius / 3F, radius) { }
///
/// Initializes a new instance of the class
///
/// The sigma value representing the weight of the blur
/// The radius value representing the size of the area to sample (this should be at least twice the sigma value)
public HlslGaussianBlurProcessor(float sigma, int radius)
{
Sigma = sigma;
Radius = radius;
}
///
/// Gets the sigma value representing the weight of the blur
///
public float Sigma { get; }
///
/// Gets the radius defining the size of the area to sample
///
public int Radius { get; }
///
public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
where TPixel : unmanaged, IPixel
{
return new HlslGaussianBlurProcessor(this, configuration, source, sourceRectangle);
}
}
}