Struct Rgb
Represents an RGB color with specified RgbWorkingSpace working space.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.ColorSpaces
Assembly: SixLabors.ImageSharp.dll
Syntax
public readonly struct Rgb : IEquatable<Rgb>
Constructors
| Improve this Doc View SourceRgb(Vector3)
Initializes a new instance of the Rgb struct.
Declaration
public Rgb(Vector3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The vector representing the r, g, b components. |
Rgb(Vector3, RgbWorkingSpace)
Initializes a new instance of the Rgb struct.
Declaration
public Rgb(Vector3 vector, RgbWorkingSpace workingSpace)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector | The vector representing the r, g, b components. |
RgbWorkingSpace | workingSpace | The rgb working space. |
Rgb(Single, Single, Single)
Initializes a new instance of the Rgb struct.
Declaration
public Rgb(float r, float g, float b)
Parameters
Type | Name | Description |
---|---|---|
Single | r | The red component ranging between 0 and 1. |
Single | g | The green component ranging between 0 and 1. |
Single | b | The blue component ranging between 0 and 1. |
Rgb(Single, Single, Single, RgbWorkingSpace)
Initializes a new instance of the Rgb struct.
Declaration
public Rgb(float r, float g, float b, RgbWorkingSpace workingSpace)
Parameters
Type | Name | Description |
---|---|---|
Single | r | The red component ranging between 0 and 1. |
Single | g | The green component ranging between 0 and 1. |
Single | b | The blue component ranging between 0 and 1. |
RgbWorkingSpace | workingSpace | The rgb working space. |
Fields
| Improve this Doc View SourceB
Gets the blue component.
Declaration
public readonly float B
Field Value
Type | Description |
---|---|
Single |
DefaultWorkingSpace
The default rgb working space.
Declaration
public static readonly RgbWorkingSpace DefaultWorkingSpace
Field Value
Type | Description |
---|---|
RgbWorkingSpace |
G
Gets the green component.
Declaration
public readonly float G
Field Value
Type | Description |
---|---|
Single |
R
Gets the red component.
Declaration
public readonly float R
Field Value
Type | Description |
---|---|
Single |
WorkingSpace
Gets the Rgb color space RgbWorkingSpaces
Declaration
public readonly RgbWorkingSpace WorkingSpace
Field Value
Type | Description |
---|---|
RgbWorkingSpace |
Methods
| Improve this Doc View SourceEquals(Rgb)
Declaration
public readonly bool Equals(Rgb other)
Parameters
Type | Name | Description |
---|---|---|
Rgb | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceToString()
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceToVector3()
Returns a new Vector3 representing this instance.
Declaration
public readonly Vector3 ToVector3()
Returns
Type | Description |
---|---|
Vector3 | The Vector3. |
Operators
| Improve this Doc View SourceEquality(Rgb, Rgb)
Compares two Rgb objects for equality.
Declaration
public static bool operator ==(Rgb left, Rgb right)
Parameters
Type | Name | Description |
---|---|---|
Rgb | left | The Rgb on the left side of the operand. |
Rgb | right | The Rgb on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is equal to the |
Implicit(Rgb24 to Rgb)
Declaration
public static implicit operator Rgb(Rgb24 color)
Parameters
Type | Name | Description |
---|---|---|
Rgb24 | color | The instance of Rgba32 to convert. |
Returns
Type | Description |
---|---|
Rgb | An instance of Rgb. |
Implicit(Rgba32 to Rgb)
Declaration
public static implicit operator Rgb(Rgba32 color)
Parameters
Type | Name | Description |
---|---|---|
Rgba32 | color | The instance of Rgba32 to convert. |
Returns
Type | Description |
---|---|
Rgb | An instance of Rgb. |
Inequality(Rgb, Rgb)
Compares two Rgb objects for inequality.
Declaration
public static bool operator !=(Rgb left, Rgb right)
Parameters
Type | Name | Description |
---|---|---|
Rgb | left | The Rgb on the left side of the operand. |
Rgb | right | The Rgb on the right side of the operand. |
Returns
Type | Description |
---|---|
Boolean | True if the current left is unequal to the |