diff --git a/src/ImageSharp/Processing/BinaryThresholdColorComponent.cs b/src/ImageSharp/Processing/BinaryThresholdColorComponent.cs
new file mode 100644
index 000000000..e46070dcb
--- /dev/null
+++ b/src/ImageSharp/Processing/BinaryThresholdColorComponent.cs
@@ -0,0 +1,26 @@
+// Copyright (c) Six Labors.
+// Licensed under the Apache License, Version 2.0.
+
+namespace SixLabors.ImageSharp.Processing
+{
+ ///
+ /// The color component to be compared to threshold.
+ ///
+ public enum BinaryThresholdColorComponent : int
+ {
+ ///
+ /// Luminance color component according to ITU-R Recommendation BT.709.
+ ///
+ Luminance = 0,
+
+ ///
+ /// HSL saturation color component.
+ ///
+ Saturation = 1,
+
+ ///
+ /// Maximum of YCbCr chroma value, i.e. Cb and Cr distance from achromatic value.
+ ///
+ MaxChroma = 2,
+ }
+}
diff --git a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs b/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
index 375c787db..11c6433f2 100644
--- a/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
+++ b/src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
@@ -12,31 +12,34 @@ namespace SixLabors.ImageSharp.Processing
public static class BinaryThresholdExtensions
{
///
- /// Applies binarization to the image splitting the pixels at the given threshold.
+ /// Applies binarization to the image splitting the pixels at the given threshold with
+ /// Luminance as the color component to be compared to threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
- /// The color component to be compared to threshold.
/// The to allow chaining of operations.
- public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold, BinaryThresholdColorComponent colorComponent) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent));
+ public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance));
///
- /// Applies binarization to the image splitting the pixels at the given threshold with
- /// Luminance as color component to be compared to threshold.
+ /// Applies binarization to the image splitting the pixels at the given threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
+ /// The color component to be compared to threshold.
/// The to allow chaining of operations.
- public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance));
+ public static IImageProcessingContext BinaryThreshold(
+ this IImageProcessingContext source,
+ float threshold,
+ BinaryThresholdColorComponent colorComponent)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent));
///
- /// Applies binarization to the image splitting the pixels at the given threshold.
+ /// Applies binarization to the image splitting the pixels at the given threshold with
+ /// Luminance as the color component to be compared to threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
- /// The color component to be compared to threshold.
///
/// The structure that specifies the portion of the image object to alter.
///
@@ -44,16 +47,15 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
- BinaryThresholdColorComponent colorComponent,
- Rectangle rectangle) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent), rectangle);
+ Rectangle rectangle)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance), rectangle);
///
- /// Applies binarization to the image splitting the pixels at the given threshold with
- /// Luminance as color component to be compared to threshold.
+ /// Applies binarization to the image splitting the pixels at the given threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
+ /// The color component to be compared to threshold.
///
/// The structure that specifies the portion of the image object to alter.
///
@@ -61,50 +63,51 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
- Rectangle rectangle) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance), rectangle);
+ BinaryThresholdColorComponent colorComponent,
+ Rectangle rectangle)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent), rectangle);
///
- /// Applies binarization to the image splitting the pixels at the given threshold.
+ /// Applies binarization to the image splitting the pixels at the given threshold with
+ /// Luminance as the color component to be compared to threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
/// The color to use for pixels that are above the threshold.
/// The color to use for pixels that are below the threshold
- /// The color component to be compared to threshold.
/// The to allow chaining of operations.
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
Color upperColor,
- Color lowerColor,
- BinaryThresholdColorComponent colorComponent) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent));
+ Color lowerColor)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance));
- ///
- /// Applies binarization to the image splitting the pixels at the given threshold with
- /// Luminance as color component to be compared to threshold.
+ ///
+ /// Applies binarization to the image splitting the pixels at the given threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
/// The color to use for pixels that are above the threshold.
/// The color to use for pixels that are below the threshold
+ /// The color component to be compared to threshold.
/// The to allow chaining of operations.
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
Color upperColor,
- Color lowerColor) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance));
+ Color lowerColor,
+ BinaryThresholdColorComponent colorComponent)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent));
- ///
- /// Applies binarization to the image splitting the pixels at the given threshold.
+ ///
+ /// Applies binarization to the image splitting the pixels at the given threshold with
+ /// Luminance as the color component to be compared to threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
/// The color to use for pixels that are above the threshold.
/// The color to use for pixels that are below the threshold
- /// The color component to be compared to threshold.
///
/// The structure that specifies the portion of the image object to alter.
///
@@ -114,18 +117,17 @@ namespace SixLabors.ImageSharp.Processing
float threshold,
Color upperColor,
Color lowerColor,
- BinaryThresholdColorComponent colorComponent,
- Rectangle rectangle) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent), rectangle);
+ Rectangle rectangle)
+ => source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance), rectangle);
- ///
- /// Applies binarization to the image splitting the pixels at the given threshold with
- /// Luminance as color component to be compared to threshold.
+ ///
+ /// Applies binarization to the image splitting the pixels at the given threshold.
///
/// The image this method extends.
/// The threshold to apply binarization of the image. Must be between 0 and 1.
/// The color to use for pixels that are above the threshold.
/// The color to use for pixels that are below the threshold
+ /// The color component to be compared to threshold.
///
/// The structure that specifies the portion of the image object to alter.
///
@@ -135,7 +137,8 @@ namespace SixLabors.ImageSharp.Processing
float threshold,
Color upperColor,
Color lowerColor,
+ BinaryThresholdColorComponent colorComponent,
Rectangle rectangle) =>
- source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance), rectangle);
+ source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent), rectangle);
}
}
diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
index 992852499..24a3e6c1d 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
@@ -5,27 +5,6 @@ using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
{
- ///
- /// The color component to be compared to threshold.
- ///
- public enum BinaryThresholdColorComponent : int
- {
- ///
- /// Luminance color component according to ITU-R Recommendation BT.709.
- ///
- Luminance = 0,
-
- ///
- /// HSL saturation color component.
- ///
- Saturation = 1,
-
- ///
- /// Maximum of YCbCr chroma value, i.e. Cb and Cr distance from achromatic value.
- ///
- MaxChroma = 2,
- }
-
///
/// Performs simple binary threshold filtering against an image.
///