Table of Contents

Struct Rgba32

Namespace
Icy.Rendering
Assembly
IcyUI.dll

Represents a color of the texture that contains Red, Green, Blue and Alpha channels.

public struct Rgba32
Inherited Members
Extension Methods

Remarks

This type of colors is the most commonly used when handling textures over the game engines.

Constructors

Rgba32(byte, byte, byte, byte)

Initializes a new instance of the Rgba32 struct.

public Rgba32(byte r, byte g, byte b, byte a)

Parameters

r byte

Value of the red color channel.

g byte

Value of the blue color channel.

b byte

Value of the green color channel.

a byte

Value of the alpha color channel.

Fields

A

Gets or sets the value of the Alpha color channel.

public byte A

Field Value

byte

B

Gets or sets the value of the Blue color channel.

public byte B

Field Value

byte

G

Gets or sets the value of the Green color channel.

public byte G

Field Value

byte

R

Gets or sets the value of the Red color channel.

public byte R

Field Value

byte

Methods

FromColor(Color)

Converts an instance of the Color to an according instance of the Rgba32 struct.

public static Rgba32 FromColor(Color c)

Parameters

c Color

An instance of the Color struct to convert.

Returns

Rgba32

An instance of the Rgba32 struct with the same channel values.

GetIntensity()

Gets the brightness of the current pixel, needed for some calculations.

public readonly byte GetIntensity()

Returns

byte

An average intensity of the current Rgba32 instance.

Remarks

This metric is calculated using the following formula: (R + G + B) / 3. Common usages of it can be alpha pre-multiplication.

GetPackedValue()

Gets the packed int value of the current Rgba32 instance.

public readonly int GetPackedValue()

Returns

int

An int with the color channel values from the current Rgba32 instance.

ToColor()

Converts current instance of the Rgba32 to the according instance of the Color struct.

public readonly Color ToColor()

Returns

Color

An instance of the Color struct with the same channel values.

Operators

explicit operator Color(Rgba32)

Converts an instance of the Rgba32 to the according instance of the Color struct.

public static explicit operator Color(Rgba32 p)

Parameters

p Rgba32

An instance of the Rgba32 to convert.

Returns

Color

An instance of the Color struct with the same channel values.

explicit operator Rgba32(Color)

Converts an instance of the Color to an according instance of the Rgba32 struct.

public static explicit operator Rgba32(Color c)

Parameters

c Color

An instance of the Color struct to convert.

Returns

Rgba32

An instance of the Rgba32 struct with the same channel values.