From 66bbc6af24192da328b359ca095cdc2ecb8ba239 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 20 Mar 2024 12:32:28 +1000 Subject: [PATCH] Remove clamping --- src/ImageSharp/ColorProfiles/Rgb.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/ColorProfiles/Rgb.cs b/src/ImageSharp/ColorProfiles/Rgb.cs index 2669d2c96..bccae1132 100644 --- a/src/ImageSharp/ColorProfiles/Rgb.cs +++ b/src/ImageSharp/ColorProfiles/Rgb.cs @@ -9,19 +9,18 @@ namespace SixLabors.ImageSharp.ColorProfiles; internal readonly struct Rgb : IProfileConnectingSpace { - private static readonly Vector3 Min = Vector3.Zero; - private static readonly Vector3 Max = Vector3.One; - /// /// Initializes a new instance of the struct. /// - /// The red component ranging between 0 and 1. - /// The green component ranging between 0 and 1. - /// The blue component ranging between 0 and 1. + /// The red component usually ranging between 0 and 1. + /// The green component usually ranging between 0 and 1. + /// The blue component usually ranging between 0 and 1. [MethodImpl(MethodImplOptions.AggressiveInlining)] public Rgb(float r, float g, float b) - : this(new Vector3(r, g, b)) { + this.R = r; + this.G = g; + this.B = b; } /// @@ -31,7 +30,6 @@ internal readonly struct Rgb : IProfileConnectingSpace [MethodImpl(MethodImplOptions.AggressiveInlining)] private Rgb(Vector3 source) { - source = Vector3.Clamp(source, Min, Max); this.R = source.X; this.G = source.Y; this.B = source.Z; @@ -165,7 +163,7 @@ internal readonly struct Rgb : IProfileConnectingSpace /// /// Expands the color into a generic ("scaled") representation - /// with values scaled and clamped between 0 and 1. + /// with values scaled and usually clamped between 0 and 1. /// The vector components are typically expanded in least to greatest significance order. /// /// The . @@ -174,7 +172,7 @@ internal readonly struct Rgb : IProfileConnectingSpace /// /// Expands the color into a generic ("scaled") representation - /// with values scaled and clamped between 0 and 1. + /// with values scaled and usually clamped between 0 and 1. /// The vector components are typically expanded in least to greatest significance order. /// /// The .