GrayHalf Struct

An opaque grayscale pixel with a half-precision floating-point gray level, in 2 bytes per pixel.

public struct GrayHalf : IEquatable<GrayHalf>

Remarks

The values have the meaning of those of GrayFloat, 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
GrayHalf(Half)Initializes a new instance of the GrayHalf struct.

GrayHalf(Half)

GrayHalf.cs

Initializes a new instance of the GrayHalf struct.

public GrayHalf(Half value)

Parameters

value Half
The gray level.

Methods

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

GrayHalf.cs

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

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

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

Remarks

Values are compared with Half.Equals: a value that is not a number equals itself.

Equals(object?)

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

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

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

operator ==(GrayHalf, GrayHalf)

GrayHalf.cs

Compares two pixels for equality.

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

Parameters

left GrayHalf
The first pixel.
right GrayHalf
The second pixel.

Returns

bool true if the values are equal; otherwise false.

operator !=(GrayHalf, GrayHalf)

GrayHalf.cs

Compares two pixels for inequality.

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

Parameters

left GrayHalf
The first pixel.
right GrayHalf
The second pixel.

Returns

bool true if the values differ; otherwise false.

Fields

NameDescription
ValueThe gray level.

Value

The gray level.

public Half Value