From 699570419044f23af4e1dc916a5e59017b1c10ab Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 6 Aug 2026 23:07:06 +1000 Subject: [PATCH 1/2] Remove AntialiasThreshold from GraphicsOptions Drops the `AntialiasThreshold` field/property from `GraphicsOptions` and updates related XML docs to reflect the simplified antialiasing behavior. Clone logic and test coverage were adjusted accordingly, including removal of threshold assertions and comparer checks. --- src/ImageSharp/GraphicsOptions.cs | 23 +------------------ .../ImageSharp.Tests/GraphicsOptionsTests.cs | 10 -------- .../TestUtilities/GraphicsOptionsComparer.cs | 1 - 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/ImageSharp/GraphicsOptions.cs b/src/ImageSharp/GraphicsOptions.cs index e05659651..ff54b8df9 100644 --- a/src/ImageSharp/GraphicsOptions.cs +++ b/src/ImageSharp/GraphicsOptions.cs @@ -7,11 +7,10 @@ namespace SixLabors.ImageSharp; /// /// Provides configuration for controlling how graphics operations are rendered, -/// including antialiasing, pixel blending, alpha composition, and coverage thresholding. +/// including antialiasing, pixel blending, and alpha composition. /// public class GraphicsOptions : IDeepCloneable { - private float antialiasThreshold = .5F; private float blendPercentage = 1F; /// @@ -25,7 +24,6 @@ public class GraphicsOptions : IDeepCloneable { this.AlphaCompositionMode = source.AlphaCompositionMode; this.Antialias = source.Antialias; - this.AntialiasThreshold = source.AntialiasThreshold; this.BlendPercentage = source.BlendPercentage; this.ColorBlendingMode = source.ColorBlendingMode; } @@ -33,29 +31,10 @@ public class GraphicsOptions : IDeepCloneable /// /// Gets or sets a value indicating whether antialiasing should be applied. /// When , edges are rendered with smooth sub-pixel coverage. - /// When , coverage is snapped to binary (fully opaque or fully transparent) - /// using as the cutoff. /// Defaults to . /// public bool Antialias { get; set; } = true; - /// - /// Gets or sets the coverage threshold used when is . - /// Pixels with antialiased coverage above this value are rendered as fully opaque; - /// pixels below are discarded. Valid range is 0 to 1. Lower values preserve more - /// thin features at small sizes. Defaults to 0.5F. - /// - public float AntialiasThreshold - { - get => this.antialiasThreshold; - - set - { - Guard.MustBeBetweenOrEqualTo(value, 0F, 1F, nameof(this.AntialiasThreshold)); - this.antialiasThreshold = value; - } - } - /// /// Gets or sets the blending percentage applied to the drawing operation. /// A value of 1.0 applies the operation at full strength; 0.0 makes it invisible. diff --git a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs index 1b87819b6..e9d45a1fd 100644 --- a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs +++ b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs @@ -22,14 +22,6 @@ public class GraphicsOptionsTests Assert.True(this.cloneGraphicsOptions.Antialias); } - [Fact] - public void DefaultGraphicsOptionsAntialiasThreshold() - { - const float expected = .5F; - Assert.Equal(expected, this.newGraphicsOptions.AntialiasThreshold); - Assert.Equal(expected, this.cloneGraphicsOptions.AntialiasThreshold); - } - [Fact] public void DefaultGraphicsOptionsBlendPercentage() { @@ -61,7 +53,6 @@ public class GraphicsOptionsTests { AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop, Antialias = false, - AntialiasThreshold = .33F, BlendPercentage = .25F, ColorBlendingMode = PixelColorBlendingMode.HardLight, }; @@ -79,7 +70,6 @@ public class GraphicsOptionsTests actual.AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop; actual.Antialias = false; - actual.AntialiasThreshold = .67F; actual.BlendPercentage = .25F; actual.ColorBlendingMode = PixelColorBlendingMode.HardLight; diff --git a/tests/ImageSharp.Tests/TestUtilities/GraphicsOptionsComparer.cs b/tests/ImageSharp.Tests/TestUtilities/GraphicsOptionsComparer.cs index 649da425e..deac649e4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/GraphicsOptionsComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/GraphicsOptionsComparer.cs @@ -8,7 +8,6 @@ public class GraphicsOptionsComparer : IEqualityComparer public bool Equals(GraphicsOptions x, GraphicsOptions y) => x.AlphaCompositionMode == y.AlphaCompositionMode && x.Antialias == y.Antialias - && x.AntialiasThreshold == y.AntialiasThreshold && x.BlendPercentage == y.BlendPercentage && x.ColorBlendingMode == y.ColorBlendingMode; From 0b9f1630c08c2a4e408997ab1c5f767c23e6f8e4 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 7 Aug 2026 07:47:29 +1000 Subject: [PATCH 2/2] Update GraphicsOptions.cs --- src/ImageSharp/GraphicsOptions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ImageSharp/GraphicsOptions.cs b/src/ImageSharp/GraphicsOptions.cs index ff54b8df9..4d8c41212 100644 --- a/src/ImageSharp/GraphicsOptions.cs +++ b/src/ImageSharp/GraphicsOptions.cs @@ -31,6 +31,7 @@ public class GraphicsOptions : IDeepCloneable /// /// Gets or sets a value indicating whether antialiasing should be applied. /// When , edges are rendered with smooth sub-pixel coverage. + /// When , coverage is snapped to binary (fully opaque or fully transparent). /// Defaults to . /// public bool Antialias { get; set; } = true;