RgbaHalf Struct

A pixel with half-precision floating-point red, green, blue and straight (non-premultiplied) alpha components, for scene-referred and high dynamic range data stored in 8 bytes per pixel.

public struct RgbaHalf : IEquatable<RgbaHalf>

Remarks

The values have the meaning of those of RgbaFloat, with the range and the precision of Half (11 significant bits, finite values up to 65,504). Components are stored in native endianness.

Implements

Constructors

NameDescription
RgbaHalf(Half, Half, Half)Initializes a new instance of the RgbaHalf struct with a fully opaque alpha.
RgbaHalf(Half, Half, Half, Half)Initializes a new instance of the RgbaHalf struct.

RgbaHalf overloads

RgbaHalf(Half, Half, Half)

RgbaHalf.cs

Initializes a new instance of the RgbaHalf struct with a fully opaque alpha.

public RgbaHalf(Half r, Half g, Half b)
Parameters
r Half
The red component.
g Half
The green component.
b Half
The blue component.

RgbaHalf(Half, Half, Half, Half)

RgbaHalf.cs

Initializes a new instance of the RgbaHalf struct.

public RgbaHalf(Half r, Half g, Half b, Half a)
Parameters
r Half
The red component.
g Half
The green component.
b Half
The blue component.
a Half
The straight alpha component.

Methods

NameDescription
Equals(RgbaHalf)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(RgbaHalf)

RgbaHalf.cs

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

public readonly bool Equals(RgbaHalf other)
Parameters
other RgbaHalf
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 Half.Equals: a component that is not a number equals itself.

Equals(object?)

RgbaHalf.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()

RgbaHalf.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()

RgbaHalf.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 ==(RgbaHalf, RgbaHalf)Compares two pixels for equality.
operator !=(RgbaHalf, RgbaHalf)Compares two pixels for inequality.

operator ==(RgbaHalf, RgbaHalf)

RgbaHalf.cs

Compares two pixels for equality.

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

Parameters

left RgbaHalf
The first pixel.
right RgbaHalf
The second pixel.

Returns

bool true if all components are equal; otherwise false.

operator !=(RgbaHalf, RgbaHalf)

RgbaHalf.cs

Compares two pixels for inequality.

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

Parameters

left RgbaHalf
The first pixel.
right RgbaHalf
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 Half A

B

The blue component.

public Half B

G

The green component.

public Half G

R

The red component.

public Half R