Gray16 Struct

An opaque 16-bit grayscale pixel, stored in native endianness.

public struct Gray16 : IEquatable<Gray16>
Implements

Constructors

NameDescription
Gray16(ushort)Initializes a new instance of the Gray16 struct.

Gray16(ushort)

Gray16.cs

Initializes a new instance of the Gray16 struct.

public Gray16(ushort value)

Parameters

value ushort
The gray level.

Methods

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

Gray16.cs

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

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

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

Equals(object?)

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

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

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

operator ==(Gray16, Gray16)

Gray16.cs

Compares two pixels for equality.

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

Parameters

left Gray16
The first pixel.
right Gray16
The second pixel.

Returns

bool true if the values are equal; otherwise false.

operator !=(Gray16, Gray16)

Gray16.cs

Compares two pixels for inequality.

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

Parameters

left Gray16
The first pixel.
right Gray16
The second pixel.

Returns

bool true if the values differ; otherwise false.

Fields

NameDescription
ValueThe gray level (0 is black, 65535 is white), in the encoded (not linear) scale.

Value

The gray level (0 is black, 65535 is white), in the encoded (not linear) scale.

public ushort Value