Class BlendMode
- Namespace
- PAC.Colour.Compositing
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
Remarks
Also known as Linear Dodge.
This follows the specification from https://docs.krita.org/en/reference_manual/blending_modes/arithmetic.html#addition.
BlendModes
public static readonly BlendMode[] BlendModes
Field Value
Remarks
There is no guarantee as to what order this is in.
Multiply
The Multiply blend mode.
public static readonly BlendMode Multiply
Field Value
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
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
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
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
Remarks
This follows the specification from https://docs.krita.org/en/reference_manual/blending_modes/arithmetic.html#subtract.
Properties
name
The display name of the blend mode.
public abstract string name { get; }
Property Value
Methods
Blend(Color, Color)
Applies the blend mode with source-over alpha compositing.
public Color Blend(Color top, Color bottom)
Parameters
top
Colorbottom
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
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
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.