Struct Rgb
- Namespace
- SixLabors.ImageSharp.ColorProfiles
- Assembly
- SixLabors.ImageSharp.dll
Represents an RGB (red, green, blue) color profile.
public readonly struct Rgb : IProfileConnectingSpace<Rgb, CieXyz>, IColorProfile<Rgb, CieXyz>, IColorProfile<Rgb>, IColorProfile, IEquatable<Rgb>, IProfileConnectingSpace
- Implements
- Inherited Members
Constructors
Rgb(Vector3)
Initializes a new instance of the Rgb struct.
public Rgb(Vector3 source)
Parameters
sourceVector3The vector representing the r, g, b components.
Rgb(float, float, float)
Initializes a new instance of the Rgb struct.
public Rgb(float r, float g, float b)
Parameters
rfloatThe red component usually ranging between 0 and 1.
gfloatThe green component usually ranging between 0 and 1.
bfloatThe blue component usually ranging between 0 and 1.
Properties
B
Gets the blue component.
public float B { get; }
Property Value
G
Gets the green component.
public float G { get; }
Property Value
R
Gets the red component.
public float R { get; }
Property Value
Methods
Clamp(Rgb)
Initializes the color instance for a source clamped between
public static Rgb Clamp(Rgb source)
Parameters
sourceRgbThe source to load the color from.
Returns
Equals(Rgb)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Rgb other)
Parameters
otherRgbAn 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 CieXyz)
Initializes the color instance from the profile connection space.
public static Rgb FromProfileConnectingSpace(ColorConversionOptions options, in CieXyz source)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceCieXyzThe color profile connecting space.
Returns
FromProfileConnectionSpace(ColorConversionOptions, ReadOnlySpan<CieXyz>, Span<Rgb>)
Converts the span of colors from the profile connection space.
public static void FromProfileConnectionSpace(ColorConversionOptions options, ReadOnlySpan<CieXyz> source, Span<Rgb> destination)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceReadOnlySpan<CieXyz>The color profile span to convert from.
destinationSpan<Rgb>The color span to write the results to.
FromScaledVector3(Vector3)
Initializes the color instance from a generic scaled Vector3.
public static Rgb FromScaledVector3(Vector3 source)
Parameters
sourceVector3The vector to load the color from.
Returns
FromScaledVector4(Vector4)
Initializes the color instance from a generic scaled Vector4.
public static Rgb FromScaledVector4(Vector4 source)
Parameters
sourceVector4The vector to load the color from.
Returns
FromScaledVector4(ReadOnlySpan<Vector4>, Span<Rgb>)
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<Rgb> destination)
Parameters
sourceReadOnlySpan<Vector4>The vector span to convert from.
destinationSpan<Rgb>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 CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
Returns
ToProfileConnectionSpace(ColorConversionOptions, ReadOnlySpan<Rgb>, Span<CieXyz>)
Converts the span of colors to the profile connection space.
public static void ToProfileConnectionSpace(ColorConversionOptions options, ReadOnlySpan<Rgb> source, Span<CieXyz> destination)
Parameters
optionsColorConversionOptionsThe color profile conversion options.
sourceReadOnlySpan<Rgb>The color span to convert from.
destinationSpan<CieXyz>The color profile span to write the results to.
ToScaledVector3()
Expands the color into a generic ("scaled") Vector3 representation
with values scaled and usually clamped between
public Vector3 ToScaledVector3()
Returns
ToScaledVector4()
Expands the color into a generic ("scaled") Vector4 representation
with values scaled and usually clamped between
public Vector4 ToScaledVector4()
Returns
ToScaledVector4(ReadOnlySpan<Rgb>, Span<Vector4>)
Converts the span of colors to a generic ("scaled") Vector4 representation
with values scaled and clamped between
public static void ToScaledVector4(ReadOnlySpan<Rgb> source, Span<Vector4> destination)
Parameters
sourceReadOnlySpan<Rgb>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 ==(Rgb, Rgb)
Compares two Rgb objects for equality.
public static bool operator ==(Rgb left, Rgb right)
Parameters
leftRgbThe Rgb on the left side of the operand.
rightRgbThe Rgb on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
operator !=(Rgb, Rgb)
Compares two Rgb objects for inequality.
public static bool operator !=(Rgb left, Rgb right)
Parameters
leftRgbThe Rgb on the left side of the operand.
rightRgbThe Rgb on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.