Table of Contents

Class BlendMode

Defines how a foreground colour (the top colour) is blended onto a background colour (the bottom colour) to form a new colour, ignoring their alpha.

public abstract record BlendMode : IEquatable<BlendMode>
Inheritance
BlendMode
Implements
Inherited Members
Extension Methods

Fields

Add

The Add blend mode.

public static readonly BlendMode Add

Field Value

BlendMode

Remarks

Also known as Linear Dodge.

This follows the specification from https://docs.krita.org/en/reference_manual/blending_modes/arithmetic.html#addition.

BlendModes

All BlendModes implemented in BlendMode.

public static readonly BlendMode[] BlendModes

Field Value

BlendMode[]

Remarks

There is no guarantee as to what order this is in.

Multiply

The Multiply blend mode.

public static readonly BlendMode Multiply

Field Value

BlendMode

Remarks

This follows the specification from https://www.w3.org/TR/compositing-1/#blendingmultiply.

Normal

The Normal blend mode.

public static readonly BlendMode Normal

Field Value

BlendMode

Remarks

This follows the specification from https://www.w3.org/TR/compositing-1/#blendingnormal.

Overlay

The Overlay blend mode.

public static readonly BlendMode Overlay

Field Value

BlendMode

Remarks

This follows the specification from https://www.w3.org/TR/compositing-1/#blendingoverlay.

Screen

The Screen blend mode.

public static readonly BlendMode Screen

Field Value

BlendMode

Remarks

This follows the specification from https://www.w3.org/TR/compositing-1/#blendingscreen.

Subtract

The Subtract blend mode.

public static readonly BlendMode Subtract

Field Value

BlendMode

Remarks

Properties

name

The display name of the blend mode.

public abstract string name { get; }

Property Value

string

Methods

Blend(Color, Color)

Applies the blend mode with source-over alpha compositing.

public Color Blend(Color top, Color bottom)

Parameters

top Color
bottom Color

Returns

Color

The blended colour in straight alpha form.

Remarks

top and bottom should be in straight alpha form.

This follows the specification from https://www.w3.org/TR/compositing-1/#generalformula.

No clamping is performed on top or bottom, but the output may be clamped depending on the BlendMode.

Does not do any colour space conversion.

Blend(RGB, RGB)

Applies the blend mode to the two colours.

public abstract RGB Blend(RGB top, RGB bottom)

Parameters

top RGB
bottom RGB

Returns

RGB

The blended colour in straight alpha form.

Remarks

top and bottom should be in straight alpha form.

No clamping is performed on top or bottom, but the output may be clamped depending on the BlendMode.

Does not do any colour space conversion.

Parse(string)

Returns the blend mode with that name (case-insensitive).

public static BlendMode Parse(string blendModeName)

Parameters

blendModeName string

Returns

BlendMode

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

See Also