gpu_set_blendequation_sepalpha

This function is the same as gpu_set_blendequation, however it allows you to set two separate equations: the first one is used for the RGB components of the source and destination, and the second one is used for the alpha component.

You can choose from the following equations for each:

Blend Mode Equation Constant
ConstantDescriptionEquation
bm_eq_addAdd both together (the default equation).source + destination
bm_eq_subtractSubtract source from destination.destination - source
bm_eq_reverse_subtractSubtract destination from source.source - destination
bm_eq_minUse whichever value is smaller.min(source, destination)
bm_eq_maxUse whichever value is larger.max(source, destination)

IMPORTANT Blend factors are not applied when bm_eq_min or bm_eq_max is used as the blend equation, which is effectively the same as using bm_one as the factors.

To help you get the most from blend modes and to help understand how they work and how they affect the final image being drawn to the screen, we recommend that you read the following guide:

 

Syntax:

gpu_set_blendequation_sepalpha(equation, equation_alpha);

ArgumentTypeDescription
equationBlend Mode Equation ConstantBlend mode equation used for RGB components.
equation_alphaBlend Mode Equation ConstantBlend mode equation used for the alpha component.

 

Returns:

N/A

 

Example:

gpu_set_blendmode_ext(bm_src_alpha, bm_one);
gpu_set_blendequation_sepalpha(bm_subtract, bm_max);
draw_circle(100, 100, 50, 0);
gpu_set_blendmode(bm_normal);

This changes the blend mode factors and then the equation, draws a circle and resets both the blend mode and equation (by switching to the normal blend mode) so they don't affect things drawn after this.

The blending here will function as the following: it will multiply the source pixel with the source alpha, and the destination pixel with 1 (keeping it the same as it was). It will then subtract the source RGB from the destination RGB, and use whichever alpha value is larger.