Struct Hsl
- Namespace
- SixLabors.ImageSharp.ColorProfiles
- Assembly
- SixLabors.ImageSharp.dll
Represents a Hsl (hue, saturation, lightness) color.
public readonly struct Hsl : IColorProfile<Hsl, Rgb>, IColorProfile<Hsl>, IColorProfile, IEquatable<Hsl>
- Implements
- Inherited Members
Constructors
Hsl(Vector3)
Initializes a new instance of the Hsl struct.
public Hsl(Vector3 vector)
Parameters
vectorVector3The vector representing the h, s, l components.
Hsl(float, float, float)
Initializes a new instance of the Hsl struct.
public Hsl(float h, float s, float l)
Parameters
hfloatThe h hue component.
sfloatThe s saturation component.
lfloatThe l value (lightness) component.
Properties
H
Gets the hue component.
public float H { get; }
Property Value
L
Gets the lightness component.
public float L { get; }
Property Value
S
Gets the saturation component.
public float S { get; }
Property Value
Methods
Equals(Hsl)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Hsl other)
Parameters
otherHslAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
FromProfileConnectingSpace(ColorConversionOptions, in Rgb)
Initializes the color instance from the profile connection space.
public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in Rgb source)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceRgbThe color profile connecting space.
Returns
FromProfileConnectionSpace(ColorConversionOptions, ReadOnlySpan<Rgb>, Span<Hsl>)
Converts the span of colors from the profile connection space.
public static void FromProfileConnectionSpace(ColorConversionOptions options, ReadOnlySpan<Rgb> source, Span<Hsl> destination)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceReadOnlySpan<Rgb>The color profile span to convert from.
destinationSpan<Hsl>The color span to write the results to.
FromScaledVector4(Vector4)
Initializes the color instance from a generic a generic ("scaled") Vector4 representation
with values scaled and clamped between
public static Hsl FromScaledVector4(Vector4 source)
Parameters
sourceVector4The vector to load the pixel from.
Returns
FromScaledVector4(ReadOnlySpan<Vector4>, Span<Hsl>)
Converts the span of colors from a generic ("scaled") Vector4 representation
with values scaled and clamped between
public static void FromScaledVector4(ReadOnlySpan<Vector4> source, Span<Hsl> destination)
Parameters
sourceReadOnlySpan<Vector4>The vector span to convert from.
destinationSpan<Hsl>The color span to write the results to.
GetChromaticAdaptionWhitePointSource()
Gets the chromatic adaption white point source.
public static ChromaticAdaptionWhitePointSource GetChromaticAdaptionWhitePointSource()
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToProfileConnectingSpace(ColorConversionOptions)
Converts the color to the profile connection space.
public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
Returns
ToProfileConnectionSpace(ColorConversionOptions, ReadOnlySpan<Hsl>, Span<Rgb>)
Converts the span of colors to the profile connection space.
public static void ToProfileConnectionSpace(ColorConversionOptions options, ReadOnlySpan<Hsl> source, Span<Rgb> destination)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceReadOnlySpan<Hsl>The color span to convert from.
destinationSpan<Rgb>The color profile span to write the results to.
ToScaledVector4()
Expands the pixel into a generic ("scaled") Vector4 representation
with values scaled and clamped between
public Vector4 ToScaledVector4()
Returns
ToScaledVector4(ReadOnlySpan<Hsl>, Span<Vector4>)
Converts the span of colors to a generic ("scaled") Vector4 representation
with values scaled and clamped between
public static void ToScaledVector4(ReadOnlySpan<Hsl> source, Span<Vector4> destination)
Parameters
sourceReadOnlySpan<Hsl>The color span to convert from.
destinationSpan<Vector4>The vector span to write the results to.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(Hsl, Hsl)
Compares two Hsl objects for equality.
public static bool operator ==(Hsl left, Hsl right)
Parameters
leftHslThe Hsl on the left side of the operand.
rightHslThe Hsl on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
operator !=(Hsl, Hsl)
Compares two Hsl objects for inequality.
public static bool operator !=(Hsl left, Hsl right)
Parameters
leftHslThe Hsl on the left side of the operand.
rightHslThe Hsl on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.