GSDP:GAM100/CProcessing/CP BLEND MODE

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 13:40, 26 June 2020 by >J.thiel (→‎CP_BLEND_MODE)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

CP_BLEND_MODE

Description

The enumeration of different ways of blending colors in the program. Use CP_Settings_BlendMode() to set a blend mode in your program and see the page for an example.

Remarks

Valid CP_BLEND_MODE values are:

enum CP_BLEND_MODE		// Processing Equivalent Names
{
	CP_BLEND_ALPHA,		// BLEND
	CP_BLEND_ADD,		// ADD
	CP_BLEND_SUBTRACT,	// DIFFERENCE
	CP_BLEND_MULTIPLY,	// MULTIPLY
	CP_BLEND_MIN,		// DARKEST
	CP_BLEND_MAX,		// LIGHTEST
};

Each blend mode controls the math used to combine colors. If you think of each color channel as a value between 0.0 and 1.0 (no color up to full color) then the math is fairly straight forward.


DestColor - is the background or whatever is already drawn on the screen.

SrcColor - is the color of whatever is about to be drawn on top of the screen.


Alpha:

NewColor = (DestColor * (1 - Alpha)) + (SrcColor * Alpha)


Add:

NewColor = DestColor + (SrcColor * Alpha)


Subtract:

NewColor = DestColor - (SrcColor * Alpha)


Multiply:

NewColor = DestColor * (SrcColor * Alpha)


Minimum:

NewColor = min(DestColor, (SrcColor * Alpha))


Maximum:

NewColor = max(DestColor, (SrcColor * Alpha))

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>