Skip to content

GraphicsAPI reference

Class BlendState

Namespace: MicroEngine.Graphics.Devices
Assembly: MicroEngine.Graphics.dll
Guide: The graphics device

Fixed-function blending: result = src·SrcFactor (op) dst·DstFactor, separately for colour and alpha, computed in float and quantised to the target format. The presets assume premultiplied colours.

C#
public sealed record BlendState : IEquatable<BlendState>

Inheritance

object ← BlendState

Implements

IEquatable<BlendState>

Constructors

BlendState(BlendFactor, BlendFactor, BlendOp, BlendFactor, BlendFactor, BlendOp)

Fixed-function blending: result = src·SrcFactor (op) dst·DstFactor, separately for colour and alpha, computed in float and quantised to the target format. The presets assume premultiplied colours.

C#
public BlendState(BlendFactor SrcColor, BlendFactor DstColor, BlendOp ColorOp, BlendFactor SrcAlpha, BlendFactor DstAlpha, BlendOp AlphaOp)

Parameters

SrcColor BlendFactor

Factor applied to the source colour.

DstColor BlendFactor

Factor applied to the destination colour.

ColorOp BlendOp

Colour operation.

SrcAlpha BlendFactor

Factor applied to the source alpha.

DstAlpha BlendFactor

Factor applied to the destination alpha.

AlphaOp BlendOp

Alpha operation.

Fields

Additive

Additive light: colour src + dst; destination alpha kept.

C#
public static readonly BlendState Additive

Field Value

BlendState

AlphaPremultiplied

Premultiplied “over”, the default: src + dst·(1 − srcA) for colour and alpha.

C#
public static readonly BlendState AlphaPremultiplied

Field Value

BlendState

Multiply

Premultiplied multiply: colour src·dst + dst·(1 − srcA); destination alpha kept.

C#
public static readonly BlendState Multiply

Field Value

BlendState

Opaque

Replace: src.

C#
public static readonly BlendState Opaque

Field Value

BlendState

Properties

AlphaOp

Alpha operation.

C#
public BlendOp AlphaOp { get; init; }

Property Value

BlendOp

ColorOp

Colour operation.

C#
public BlendOp ColorOp { get; init; }

Property Value

BlendOp

DstAlpha

Factor applied to the destination alpha.

C#
public BlendFactor DstAlpha { get; init; }

Property Value

BlendFactor

DstColor

Factor applied to the destination colour.

C#
public BlendFactor DstColor { get; init; }

Property Value

BlendFactor

Presets

The four presets. Every tier supports them with every built-in pipeline (they are the minimum of BuiltInBlendStates).

C#
public static IReadOnlyList<BlendState> Presets { get; }

Property Value

IReadOnlyList<BlendState>

SrcAlpha

Factor applied to the source alpha.

C#
public BlendFactor SrcAlpha { get; init; }

Property Value

BlendFactor

SrcColor

Factor applied to the source colour.

C#
public BlendFactor SrcColor { get; init; }

Property Value

BlendFactor

Methods

<Clone>$()

C#
public BlendState <Clone>$()

Returns

BlendState

Deconstruct(out BlendFactor, out BlendFactor, out BlendOp, out BlendFactor, out BlendFactor, out BlendOp)

C#
public void Deconstruct(out BlendFactor SrcColor, out BlendFactor DstColor, out BlendOp ColorOp, out BlendFactor SrcAlpha, out BlendFactor DstAlpha, out BlendOp AlphaOp)

Parameters

SrcColor BlendFactor

DstColor BlendFactor

ColorOp BlendOp

SrcAlpha BlendFactor

DstAlpha BlendFactor

AlphaOp BlendOp

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(BlendState?)

C#
public bool Equals(BlendState? other)

Parameters

other BlendState?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(BlendState?, BlendState?)

C#
public static bool operator ==(BlendState? left, BlendState? right)

Parameters

left BlendState?

right BlendState?

Returns

bool

operator !=(BlendState?, BlendState?)

C#
public static bool operator !=(BlendState? left, BlendState? right)

Parameters

left BlendState?

right BlendState?

Returns

bool