RgbaFloat Struct

A pixel with single-precision floating-point red, green, blue and straight (non-premultiplied) alpha components, for scene-referred and high dynamic range data.

public struct RgbaFloat : IEquatable<RgbaFloat>

Remarks

The color components are not limited to [0, 1]: 1 is the reference white of a standard dynamic range, values above it are brighter, and negative values are colors outside the gamut of the primaries. Alpha is a coverage from 0 (fully transparent) to 1 (fully opaque). A new image of this pixel type is labeled as linear light (ColorTransferFunction.Linear); a conversion keeps the label of its source, since it never converts colors.

Converting to an integer pixel format rejects samples that are not numbers, and samples outside [0, 1] unless PixelConversionOptions.OutOfRangeSamples or PixelConversionOptions.ToneMapping says how to bring them into range.

Implements

Constructors

NameDescription
RgbaFloat(float, float, float, float)Initializes a new instance of the RgbaFloat struct.

RgbaFloat(float, float, float, float)

RgbaFloat.cs

Initializes a new instance of the RgbaFloat struct.

public RgbaFloat(float r, float g, float b, float a = 1f)

Parameters

r float
The red component.
g float
The green component.
b float
The blue component.
a float
The straight alpha component. Defaults to fully opaque.

Methods

NameDescription
Equals(RgbaFloat)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the fully qualified type name of this instance.

Equals overloads

Equals(RgbaFloat)

RgbaFloat.cs

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

public readonly bool Equals(RgbaFloat other)
Parameters
other RgbaFloat
An object to compare with this object.
Returns

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

Remarks

Components are compared with Single.Equals: a component that is not a number equals itself.

Equals(object?)

RgbaFloat.cs

Indicates whether this instance and a specified object are equal.

public override readonly 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.

GetHashCode()

RgbaFloat.cs

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToString()

RgbaFloat.cs

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string The fully qualified type name.

Operators

NameDescription
operator ==(RgbaFloat, RgbaFloat)Compares two pixels for equality.
operator !=(RgbaFloat, RgbaFloat)Compares two pixels for inequality.

operator ==(RgbaFloat, RgbaFloat)

RgbaFloat.cs

Compares two pixels for equality.

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

Parameters

left RgbaFloat
The first pixel.
right RgbaFloat
The second pixel.

Returns

bool true if all components are equal; otherwise false.

operator !=(RgbaFloat, RgbaFloat)

RgbaFloat.cs

Compares two pixels for inequality.

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

Parameters

left RgbaFloat
The first pixel.
right RgbaFloat
The second pixel.

Returns

bool true if any component differs; otherwise false.

Fields

NameDescription
AThe straight alpha component (0 is fully transparent, 1 is fully opaque).
BThe blue component.
GThe green component.
RThe red component.

A

The straight alpha component (0 is fully transparent, 1 is fully opaque).

public float A

B

The blue component.

public float B

G

The green component.

public float G

R

The red component.

public float R