Table of Contents

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

vector Vector3

The 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

vector Vector3

The vector representing the r, g, b components.

workingSpace RgbWorkingSpace

The rgb working space.

Rgb(float, float, float)

Initializes a new instance of the Rgb struct.

public Rgb(float r, float g, float b)

Parameters

r float

The red component ranging between 0 and 1.

g float

The green component ranging between 0 and 1.

b float

The 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

r float

The red component ranging between 0 and 1.

g float

The green component ranging between 0 and 1.

b float

The blue component ranging between 0 and 1.

workingSpace RgbWorkingSpace

The rgb working space.

Fields

DefaultWorkingSpace

The default rgb working space.

public static readonly RgbWorkingSpace DefaultWorkingSpace

Field Value

RgbWorkingSpace

Properties

B

Gets the blue component. A value usually ranging between 0 and 1.

public float B { get; }

Property Value

float

G

Gets the green component. A value usually ranging between 0 and 1.

public float G { get; }

Property Value

float

R

Gets the red component. A value usually ranging between 0 and 1.

public float R { get; }

Property Value

float

WorkingSpace

Gets the Rgb color space RgbWorkingSpaces

public RgbWorkingSpace WorkingSpace { get; }

Property Value

RgbWorkingSpace

Methods

Equals(Rgb)

public bool Equals(Rgb other)

Parameters

other Rgb

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

ToVector3()

Returns a new Vector3 representing this instance.

public Vector3 ToVector3()

Returns

Vector3

The Vector3.

Operators

operator ==(Rgb, Rgb)

Compares two Rgb objects for equality.

public static bool operator ==(Rgb left, Rgb right)

Parameters

left Rgb

The Rgb on the left side of the operand.

right Rgb

The Rgb on the right side of the operand.

Returns

bool

True if the current left is equal to the right parameter; otherwise, false.

implicit operator Rgb(Rgb24)

Allows the implicit conversion of an instance of Rgb24 to a Rgb.

public static implicit operator Rgb(Rgb24 color)

Parameters

color Rgb24

The instance of Rgba32 to convert.

Returns

Rgb

An instance of Rgb.

implicit operator Rgb(Rgba32)

Allows the implicit conversion of an instance of Rgba32 to a Rgb.

public static implicit operator Rgb(Rgba32 color)

Parameters

color Rgba32

The instance of Rgba32 to convert.

Returns

Rgb

An instance of Rgb.

operator !=(Rgb, Rgb)

Compares two Rgb objects for inequality.

public static bool operator !=(Rgb left, Rgb right)

Parameters

left Rgb

The Rgb on the left side of the operand.

right Rgb

The Rgb on the right side of the operand.

Returns

bool

True if the current left is unequal to the right parameter; otherwise, false.