using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
namespace ComputeSharp.BokehBlur.Processors
{
///
/// Applies bokeh blur processing to the image
///
public sealed class HlslBokehBlurProcessor : IImageProcessor
{
///
/// The default radius used by the parameterless constructor
///
public const int DefaultRadius = 32;
///
/// The default component count used by the parameterless constructor
///
public const int DefaultComponents = 2;
///
/// The default gamma used by the parameterless constructor
///
public const float DefaultGamma = 3f;
///
/// Initializes a new instance of the class
///
public HlslBokehBlurProcessor() : this(DefaultRadius, DefaultComponents, DefaultGamma) { }
///
/// Initializes a new instance of the class
///
/// The size of the area to sample
/// The number of components to use to approximate the original 2D bokeh blur convolution kernel
/// The gamma highlight factor to use to further process the image
public HlslBokehBlurProcessor(int radius, int components, float gamma)
{
Radius = radius;
Components = components;
Gamma = gamma;
}
///
/// Gets the radius
///
public int Radius { get; }
///
/// Gets the number of components
///
public int Components { get; }
///
/// Gets the gamma highlight factor to use when applying the effect
///
public float Gamma { get; }
///
public IImageProcessor CreatePixelSpecificProcessor(Configuration configuration, Image source, Rectangle sourceRectangle)
where TPixel : unmanaged, IPixel
{
return new HlslBokehBlurProcessor(this, configuration, source, sourceRectangle);
}
}
}