Browse Source

Removed execution mode options

pull/1058/head
Sergio Pedri 6 years ago
parent
commit
2f68f0ded0
  1. 48
      src/ImageSharp/Processing/Extensions/BokehBlurExtensions.cs
  2. 44
      src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs

48
src/ImageSharp/Processing/Extensions/BokehBlurExtensions.cs

@ -19,15 +19,6 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source)
=> source.ApplyProcessor(new BokehBlurProcessor());
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="executionMode">The execution mode to use when applying the processor.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, BokehBlurExecutionMode executionMode)
=> source.ApplyProcessor(new BokehBlurProcessor(executionMode));
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
@ -39,18 +30,6 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma));
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
/// <param name="executionMode">The execution mode to use when applying the processor.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, BokehBlurExecutionMode executionMode)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma, executionMode));
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
@ -62,18 +41,6 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, Rectangle rectangle)
=> source.ApplyProcessor(new BokehBlurProcessor(), rectangle);
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="executionMode">The execution mode to use when applying the processor.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, Rectangle rectangle, BokehBlurExecutionMode executionMode)
=> source.ApplyProcessor(new BokehBlurProcessor(executionMode), rectangle);
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
@ -87,20 +54,5 @@ namespace SixLabors.ImageSharp.Processing
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, Rectangle rectangle)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma), rectangle);
/// <summary>
/// Applies a bokeh blur to the image.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="components">The 'components' value representing the number of kernels to use to approximate the bokeh effect.</param>
/// <param name="gamma">The gamma highlight factor to use to emphasize bright spots in the source image</param>
/// <param name="executionMode">The execution mode to use when applying the processor.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BokehBlur(this IImageProcessingContext source, int radius, int components, float gamma, BokehBlurExecutionMode executionMode, Rectangle rectangle)
=> source.ApplyProcessor(new BokehBlurProcessor(radius, components, gamma, executionMode), rectangle);
}
}

44
src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs

@ -26,27 +26,11 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
/// </summary>
public const float DefaultGamma = 3F;
/// <summary>
/// The default execution mode used by the parameterless constructor.
/// </summary>
public const BokehBlurExecutionMode DefaultExecutionMode = BokehBlurExecutionMode.PreferLowMemoryUsage;
/// <summary>
/// Initializes a new instance of the <see cref="BokehBlurProcessor"/> class.
/// </summary>
public BokehBlurProcessor()
: this(DefaultRadius, DefaultComponents, DefaultGamma, DefaultExecutionMode)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BokehBlurProcessor"/> class.
/// </summary>
/// <param name="executionMode">
/// The execution mode to use when applying the processor.
/// </param>
public BokehBlurProcessor(BokehBlurExecutionMode executionMode)
: this(DefaultRadius, DefaultComponents, DefaultGamma, executionMode)
: this(DefaultRadius, DefaultComponents, DefaultGamma)
{
}
@ -63,33 +47,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
/// The gamma highlight factor to use to further process the image.
/// </param>
public BokehBlurProcessor(int radius, int components, float gamma)
: this(radius, components, gamma, DefaultExecutionMode)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BokehBlurProcessor"/> class.
/// </summary>
/// <param name="radius">
/// The 'radius' value representing the size of the area to sample.
/// </param>
/// <param name="components">
/// The number of components to use to approximate the original 2D bokeh blur convolution kernel.
/// </param>
/// <param name="gamma">
/// The gamma highlight factor to use to further process the image.
/// </param>
/// <param name="executionMode">
/// The execution mode to use when applying the processor.
/// </param>
public BokehBlurProcessor(int radius, int components, float gamma, BokehBlurExecutionMode executionMode)
{
Guard.MustBeGreaterThanOrEqualTo(gamma, 1, nameof(gamma));
this.Radius = radius;
this.Components = components;
this.Gamma = gamma;
this.ExecutionMode = executionMode;
}
/// <summary>
@ -107,11 +70,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
/// </summary>
public float Gamma { get; }
/// <summary>
/// Gets the execution mode to use when applying the effect.
/// </summary>
public BokehBlurExecutionMode ExecutionMode { get; }
/// <inheritdoc />
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Image<TPixel> source, Rectangle sourceRectangle)
where TPixel : struct, IPixel<TPixel>

Loading…
Cancel
Save