Enumeration specifying blend modes. The following function-formulas are used in a number of the blend modes:
vec3 ClipColor(in vec3 C)
{
float L = Luminosity(C);
float MinC = MinColorChannel(C);
float MaxC = MaxColorChannel(C);
if (MinC < 0.0)
C =
vec3(L) + (C -
vec3(L)) * (L / (L - MinC));
if (MaxC > 1.0)
C =
vec3(L) + (C -
vec3(L)) * ((1 - L) / (MaxC - L));
return C;
}
vec3 OverrideLuminosity(vec3 C, vec3 L)
{
float Clum = Luminosity(C);
float Llum = Luminosity(L);
float Delta = Llum - Clum;
return ClipColor(C +
vec3(Delta));
}
vec3 OverrideLuminosityAndSaturation(vec3 C, vec3 S, vec3 L)
{
float Cmin = MinColorChannel(C);
float Csat = Saturation(C);
float Ssat = Saturation(S);
if (Csat > 0.0)
{
C = (C - Cmin) * Ssat / Csat;
}
else
{
}
return OverrideLuminosity(C, L);
}
Enumerator |
---|
blend_porter_duff_clear | Porter-Duff clear mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F.rgba = (0, 0, 0, 0).
|
blend_porter_duff_src | Porter-Duff src mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F = S.
|
blend_porter_duff_dst | Porter-Duff dst mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F = D.
|
blend_porter_duff_src_over | Porter-Duff src-over mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = S.rgb + D.rgb * (1 - S.a) |
blend_porter_duff_dst_over | Porter-Duff dst-over mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = D.a + S.a * (1 - D.a) F.rgb = D.rgb + S.rgb * (1 - D.a) |
blend_porter_duff_src_in | Porter-Duff src-in mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a * D.a F.rgb = S.rgb * D.a |
blend_porter_duff_dst_in | Porter-Duff dst-in mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is F.a = S.a * D.a F.rgb = D.rgb * S.a |
blend_porter_duff_src_out | Porter-Duff mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a * (1 - D.a) F.rgb = S.rgb * (1 - D.a) |
blend_porter_duff_dst_out | Porter-Duff src-out mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = D.a * (1.0 - S.a) F.rgb = D.rgb * (1.0 - S.a) |
blend_porter_duff_src_atop | Porter-Duff src-atop mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = D.a F.rgb = S.rgb * D.a + D.rgb * (1.0 - S.a) |
blend_porter_duff_dst_atop | Porter-Duff dst-atop mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a F.rgb = D.rgb * S.a + S.rgb * (1 - D.a) |
blend_porter_duff_xor | Porter-Duff xor mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a * (1 - D.a) + D.a * (1 - S.a) F.rgb = S.rgb * (1 - D.a) + D.rgb * (1 - S.a) |
blend_porter_duff_plus | Plus blend mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a F.rgb = S.rgb + D.rgb |
blend_porter_duff_modulate | Modulate blend mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a * D.a F.rgb = S.rgb * D.rgb |
blend_w3c_screen | Screen mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = S.c + D.c - S.c * D.c |
blend_w3c_overlay | Overlay mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = 2 * S * D, if D <= 0.5 1 - 2 * (1 - S) * (1 - D), otherwise |
blend_w3c_darken | Darken mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, |
blend_w3c_lighten | Lighten mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = max(S.c, D.c) |
blend_w3c_color_dodge | Color dodge mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = 0, if D.c <= 0 min(1, D.c / (1 - S.c)), if D.c > 0 and S.c < 1 1, if D.c > 0 and S.c >= 1 |
blend_w3c_color_burn | Color burn mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = 1, if D.c >= 1 1 - min(1, (1 - D.c) / S.c), if D.c < 1 and S.c > 0 0, if D.c < 1 and S.c <= 0 |
blend_w3c_hardlight | Harlight mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = 2 * S.c * D.c, if S.c <= 0.5 1 - 2 * (1 - S.c) * (1 - D.c), otherwise |
blend_w3c_softlight | Softlight mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = D.c - (1 - 2 * S.c) * D.c * (1 - D.c), if S.c <= 0.5 D.c + (2 * S.c - 1) * D.c * ((16 * D.c - 12) * D.c + 3), if S.c > 0.5 and D.c <= 0.25 D.c + (2 * S.c - 1) * (sqrt(D.c) - D.c), if S.c > 0.5 and D.c > 0.25 |
blend_w3c_difference | Difference mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = abs(S.c - D.c) |
blend_w3c_exclusion | Exclusion mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, f(S, D).c = S.c + D.c - 2 * S.c * D.c |
blend_w3c_multiply | Multiply mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where for each channel c, |
blend_w3c_hue | Hue mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where f(S.rgb, D.rgb).rgb = OverrideLuminosityAndSaturation(S.rgb, D.rgb, D.rgb) |
blend_w3c_saturation | Saturation mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where f(S.rgb, D.rgb).rgb = OverrideLuminosityAndSaturation(D.rgb, S.rgb, D.rgb) |
blend_w3c_color | Color mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where f(S.rgb, D.rgb).rgb = OverrideLuminosity(S.rgb, D.rgb) |
blend_w3c_luminosity | Luminosity mode. Letting S be the value from the fragment shader and D be the current value in the framebuffer, replaces the value in the framebuffer with F where F is: F.a = S.a + D.a * (1 - S.a) F.rgb = f(UndoAlpha(S), UndoAlpha(D)) * S.a * D.a + S.rgb * (1 - D.a) + D.rgb * (1 - S.a) where f(S.rgb, D.rgb).rgb = OverrideLuminosity(D.rgb, S.rgb) |