Skip to content

Rgba32

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Represents an RGBA pixel color.

csharp
public readonly record struct Rgba32 : IEquatable<Rgba32>

Implements

Constructors

Rgba32(byte, byte, byte, byte)

Represents an RGBA pixel color.

Parameters:

  • R (Byte): Red component (0-255).
  • G (Byte): Green component (0-255).
  • B (Byte): Blue component (0-255).
  • A (Byte): Alpha component (0-255, 0=transparent, 255=opaque).
csharp
public Rgba32(byte R, byte G, byte B, byte A)

Properties

A

Alpha component (0-255, 0=transparent, 255=opaque).

Returns: Byte

csharp
public byte A { get; init; }

B

Blue component (0-255).

Returns: Byte

csharp
public byte B { get; init; }

G

Green component (0-255).

Returns: Byte

csharp
public byte G { get; init; }

IsOpaque

Gets whether this pixel is fully opaque (alpha = 255).

Returns: Boolean

csharp
public bool IsOpaque { get; }

IsTransparent

Gets whether this pixel is fully transparent (alpha = 0).

Returns: Boolean

csharp
public bool IsTransparent { get; }

R

Red component (0-255).

Returns: Byte

csharp
public byte R { get; init; }

Methods

FromRgb(byte, byte, byte)

Creates an opaque pixel from RGB values.

Parameters:

Returns: Rgba32

csharp
public static Rgba32 FromRgb(byte r, byte g, byte b)

Fields

Transparent

Fully transparent pixel.

Returns: Rgba32

csharp
public static readonly Rgba32 Transparent

Released under the MIT License.