Argb32 Struct

A pixel with 8-bit components and straight (non-premultiplied) alpha, stored in ARGB byte order.

public struct Argb32 : IEquatable<Argb32>

Remarks

The fields are declared in storage order (Argb32.A, Argb32.R, Argb32.G, Argb32.B), the memory layout of a 0xAARRGGBB value stored in big-endian byte order, but the constructor takes components in logical red, green, blue, alpha order, like every other pixel type. It converts to Rgba32 and back without any loss.

Implements

Constructors

NameDescription
Argb32(byte, byte, byte, byte)Initializes a new instance of the Argb32 struct from components in logical RGBA order.

Argb32(byte, byte, byte, byte)

Argb32.cs

Initializes a new instance of the Argb32 struct from components in logical RGBA order.

public Argb32(byte r, byte g, byte b, byte a = 255)

Parameters

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

Methods

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

Argb32.cs

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

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

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

Equals(object?)

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

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

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

operator ==(Argb32, Argb32)

Argb32.cs

Compares two pixels for equality.

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

Parameters

left Argb32
The first pixel.
right Argb32
The second pixel.

Returns

bool true if all components are equal; otherwise false.

operator !=(Argb32, Argb32)

Argb32.cs

Compares two pixels for inequality.

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

Parameters

left Argb32
The first pixel.
right Argb32
The second pixel.

Returns

bool true if any component differs; otherwise false.

Fields

NameDescription
AThe straight alpha component (byte offset 0).
BThe blue component (byte offset 3).
GThe green component (byte offset 2).
RThe red component (byte offset 1).

A

The straight alpha component (byte offset 0).

public byte A

B

The blue component (byte offset 3).

public byte B

G

The green component (byte offset 2).

public byte G

R

The red component (byte offset 1).

public byte R