LaFloat Struct

A pixel with a single-precision floating-point gray level and a straight (non-premultiplied) alpha component, in 8 bytes per pixel.

public struct LaFloat : IEquatable<LaFloat>

Remarks

The gray level has the meaning of the colors of RgbaFloat: linear light where 1 is the reference white, with values outside [0, 1] allowed (highlights above 1). 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), and the components are stored in native endianness.

Converting a color to it gives the Rec. 709 luma of the color, 0.2126 R + 0.7152 G + 0.0722 B (the luma of a gray color is that gray), and converting it to a color format repeats the gray level in the three colors. Converting it to an integer pixel format follows the rules of RgbaFloat.

Implements

Constructors

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

LaFloat overloads

LaFloat(float)

LaFloat.cs

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

public LaFloat(float l)
Parameters
l float
The gray level.

LaFloat(float, float)

LaFloat.cs

Initializes a new instance of the LaFloat struct.

public LaFloat(float l, float a)
Parameters
l float
The gray level.
a float
The straight alpha component.

Methods

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

LaFloat.cs

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

public readonly bool Equals(LaFloat other)
Parameters
other LaFloat
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?)

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

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

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

operator ==(LaFloat, LaFloat)

LaFloat.cs

Compares two pixels for equality.

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

Parameters

left LaFloat
The first pixel.
right LaFloat
The second pixel.

Returns

bool true if all components are equal; otherwise false.

operator !=(LaFloat, LaFloat)

LaFloat.cs

Compares two pixels for inequality.

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

Parameters

left LaFloat
The first pixel.
right LaFloat
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).
LThe gray level.

A

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

public float A

L

The gray level.

public float L