Table of Contents

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

source Vector3

The 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

r float

The red component usually ranging between 0 and 1.

g float

The green component usually ranging between 0 and 1.

b float

The blue component usually ranging between 0 and 1.

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

Methods

Clamp(Rgb)

Initializes the color instance for a source clamped between 0 and 1

public static Rgb Clamp(Rgb source)

Parameters

source Rgb

The source to load the color from.

Returns

Rgb

The Rgb.

Equals(Rgb)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Rgb other)

Parameters

other Rgb

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

options ColorConversionOptions

The color profile conversion options.

source CieXyz

The color profile connecting space.

Returns

Rgb

The Rgb.

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

options ColorConversionOptions

The color profile conversion options.

source ReadOnlySpan<CieXyz>

The color profile span to convert from.

destination Span<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

source Vector3

The vector to load the color from.

Returns

Rgb

The Rgb.

FromScaledVector4(Vector4)

Initializes the color instance from a generic scaled Vector4.

public static Rgb FromScaledVector4(Vector4 source)

Parameters

source Vector4

The vector to load the color from.

Returns

Rgb

The Rgb.

FromScaledVector4(ReadOnlySpan<Vector4>, Span<Rgb>)

Converts the span of colors from a generic ("scaled") Vector4 representation with values scaled and clamped between 0 and 1.

public static void FromScaledVector4(ReadOnlySpan<Vector4> source, Span<Rgb> destination)

Parameters

source ReadOnlySpan<Vector4>

The vector span to convert from.

destination Span<Rgb>

The color span to write the results to.

GetChromaticAdaptionWhitePointSource()

Gets the chromatic adaption white point source.

public static ChromaticAdaptionWhitePointSource GetChromaticAdaptionWhitePointSource()

Returns

ChromaticAdaptionWhitePointSource

The ChromaticAdaptionWhitePointSource.

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

options ColorConversionOptions

The color profile conversion options.

Returns

CieXyz

The CieXyz.

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

options ColorConversionOptions

The color profile conversion options.

source ReadOnlySpan<Rgb>

The color span to convert from.

destination Span<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 0 and 1. The vector components are typically expanded in least to greatest significance order.

public Vector3 ToScaledVector3()

Returns

Vector3

The Vector3.

ToScaledVector4()

Expands the color into a generic ("scaled") Vector4 representation with values scaled and usually clamped between 0 and 1. The vector components are typically expanded in least to greatest significance order.

public Vector4 ToScaledVector4()

Returns

Vector4

The Vector4.

ToScaledVector4(ReadOnlySpan<Rgb>, Span<Vector4>)

Converts the span of colors to a generic ("scaled") Vector4 representation with values scaled and clamped between 0 and 1.

public static void ToScaledVector4(ReadOnlySpan<Rgb> source, Span<Vector4> destination)

Parameters

source ReadOnlySpan<Rgb>

The color span to convert from.

destination Span<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

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.

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.