Skip to content

Commit 66bbc6a

Browse files
Remove clamping
1 parent 3703cb1 commit 66bbc6a

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

  • src/ImageSharp/ColorProfiles

src/ImageSharp/ColorProfiles/Rgb.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@ namespace SixLabors.ImageSharp.ColorProfiles;
99

1010
internal readonly struct Rgb : IProfileConnectingSpace<Rgb, CieXyz>
1111
{
12-
private static readonly Vector3 Min = Vector3.Zero;
13-
private static readonly Vector3 Max = Vector3.One;
14-
1512
/// <summary>
1613
/// Initializes a new instance of the <see cref="Rgb"/> struct.
1714
/// </summary>
18-
/// <param name="r">The red component ranging between 0 and 1.</param>
19-
/// <param name="g">The green component ranging between 0 and 1.</param>
20-
/// <param name="b">The blue component ranging between 0 and 1.</param>
15+
/// <param name="r">The red component usually ranging between 0 and 1.</param>
16+
/// <param name="g">The green component usually ranging between 0 and 1.</param>
17+
/// <param name="b">The blue component usually ranging between 0 and 1.</param>
2118
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2219
public Rgb(float r, float g, float b)
23-
: this(new Vector3(r, g, b))
2420
{
21+
this.R = r;
22+
this.G = g;
23+
this.B = b;
2524
}
2625

2726
/// <summary>
@@ -31,7 +30,6 @@ public Rgb(float r, float g, float b)
3130
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3231
private Rgb(Vector3 source)
3332
{
34-
source = Vector3.Clamp(source, Min, Max);
3533
this.R = source.X;
3634
this.G = source.Y;
3735
this.B = source.Z;
@@ -165,7 +163,7 @@ public static void ToProfileConnectionSpace(ColorConversionOptions options, Read
165163

166164
/// <summary>
167165
/// Expands the color into a generic ("scaled") <see cref="Vector3"/> representation
168-
/// with values scaled and clamped between <value>0</value> and <value>1</value>.
166+
/// with values scaled and usually clamped between <value>0</value> and <value>1</value>.
169167
/// The vector components are typically expanded in least to greatest significance order.
170168
/// </summary>
171169
/// <returns>The <see cref="Vector3"/>.</returns>
@@ -174,7 +172,7 @@ public static void ToProfileConnectionSpace(ColorConversionOptions options, Read
174172

175173
/// <summary>
176174
/// Expands the color into a generic ("scaled") <see cref="Vector4"/> representation
177-
/// with values scaled and clamped between <value>0</value> and <value>1</value>.
175+
/// with values scaled and usually clamped between <value>0</value> and <value>1</value>.
178176
/// The vector components are typically expanded in least to greatest significance order.
179177
/// </summary>
180178
/// <returns>The <see cref="Vector4"/>.</returns>

0 commit comments

Comments
 (0)