Struct Rgb
- Namespace
- SixLabors.ImageSharp.ColorSpaces
- Assembly
- SixLabors.ImageSharp.dll
Represents an RGB color with specified RgbWorkingSpace working space.
public readonly struct Rgb : IEquatable<Rgb>
- Implements
- Inherited Members
Constructors
Rgb(Vector3)
Initializes a new instance of the Rgb struct.
public Rgb(Vector3 vector)
Parameters
vectorVector3The vector representing the r, g, b components.
Rgb(Vector3, RgbWorkingSpace)
Initializes a new instance of the Rgb struct.
public Rgb(Vector3 vector, RgbWorkingSpace workingSpace)
Parameters
vectorVector3The vector representing the r, g, b components.
workingSpaceRgbWorkingSpaceThe rgb working space.
Rgb(float, float, float)
Initializes a new instance of the Rgb struct.
public Rgb(float r, float g, float b)
Parameters
rfloatThe red component ranging between 0 and 1.
gfloatThe green component ranging between 0 and 1.
bfloatThe blue component ranging between 0 and 1.
Rgb(float, float, float, RgbWorkingSpace)
Initializes a new instance of the Rgb struct.
public Rgb(float r, float g, float b, RgbWorkingSpace workingSpace)
Parameters
rfloatThe red component ranging between 0 and 1.
gfloatThe green component ranging between 0 and 1.
bfloatThe blue component ranging between 0 and 1.
workingSpaceRgbWorkingSpaceThe rgb working space.
Fields
DefaultWorkingSpace
The default rgb working space.
public static readonly RgbWorkingSpace DefaultWorkingSpace
Field Value
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
WorkingSpace
Gets the Rgb color space RgbWorkingSpaces
public RgbWorkingSpace WorkingSpace { get; }
Property Value
Methods
Equals(Rgb)
public bool Equals(Rgb other)
Parameters
otherRgb
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
ToVector3()
Returns a new Vector3 representing this instance.
public Vector3 ToVector3()
Returns
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.
implicit operator Rgb(Rgb24)
public static implicit operator Rgb(Rgb24 color)
Parameters
Returns
implicit operator Rgb(Rgba32)
public static implicit operator Rgb(Rgba32 color)
Parameters
Returns
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.