blendMode()

Rendering

Description

Blends the pixels in the display window with the pixels underneath using a defined blend mode.

Syntax

void blendMode(int mode)

Parameters

NameTypeDescription
modeintBLEND, ADD, SUBTRACT, MULTIPLY, SCREEN, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION

Returns

void

Under the Hood

From Processing.h:

void blendMode(int mode);

Under the Hood

From Processing.cpp:

void PApplet::blendMode(int mode) { glEnable(GL_BLEND); // Reset equation first (SUBTRACT changes it) glBlendEquation(GL_FUNC_ADD); switch (mode) { case ADD: glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; case MULTIPLY: glBlendFunc(GL_DST_COLOR, GL_ZERO); break; case SCREEN: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); break; case SUBTRACT: glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); glBlendFunc(GL_SRC_ALPHA, GL_ONE); break; default: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; } }