27 return min(C.r, min(C.g, C.b));
34 return max(C.r, max(C.g, C.b));
41 return dot(C,
vec3(0.3, 0.59, 0.11));
67 factor = lumC / (lumC - minC);
68 C = lumCv + (C - lumCv) * factor;
73 factor = (1.0 - lumC) / (maxC - lumC);
74 C = lumCv + (C - lumCv) * factor;
91 float delta = Llum - Clum;
113 C = (C - Cmin) * Ssat / Csat;
144 (1.0 - 2.0 * (1.0 - S) * (1.0 - D));
158 return D - (1.0 - 2.0 * S) * D * (1.0 - D);
162 return D + (2.0 * S - 1.0) * D * ((16.0 * D - 12.0) * D + 3.0);
166 return D + (2.0 * S - 1.0) * (sqrt(D) - D);
185 return 1.0 - 2.0 * (1.0 - S) * (1.0 - D);
208 return min(1.0, D / (1.0 - S));
231 return 1.0 - min(1.0, (1.0 - D) / S);
238 #define FASTUIDRAW_PORTER_DUFF_MACRO(src_factor, dst_factor) \ 239 ((src_factor) * in_src + (dst_factor) * in_fb) 242 #define FASTUIDRAW_SEPERABLE_FBF_BLEND_ONE_CHANNEL_MACRO(channel, expression) \ 243 S = Srgb.channel; D = Drgb.channel; \ 244 out_src.channel = (expression) 251 #define FASTUIDRAW_SEPERABLE_FBF_BLEND_MACRO(expression) \ 254 Srgb = fastuidraw_undo_alpha(in_src); \ 255 Drgb = fastuidraw_undo_alpha(in_fb); \ 256 out_src.a = in_src.a + in_fb.a * (1.0 - in_src.a); \ 257 FASTUIDRAW_SEPERABLE_FBF_BLEND_ONE_CHANNEL_MACRO(r, expression); \ 258 FASTUIDRAW_SEPERABLE_FBF_BLEND_ONE_CHANNEL_MACRO(g, expression); \ 259 FASTUIDRAW_SEPERABLE_FBF_BLEND_ONE_CHANNEL_MACRO(b, expression); \ 260 out_src.rgb *= in_src.a * in_fb.a; 261 out_src.rgb += Srgb * (1.0 - in_fb.a) + Drgb * (1.0 - in_src.a)
268 #define FASTUIDRAW_NON_SEPERABLE_FBF_BLEND_MACRO(expression) \ 270 S = fastuidraw_undo_alpha(in_src); \ 271 D = fastuidraw_undo_alpha(in_fb); \ 272 out_src.a = in_src.a + in_fb.a * (1.0 - in_src.a); \ 273 out_src.rgb = expression; \ 274 out_src.rgb *= in_src.a * in_fb.a; \ 275 out_src.rgb += S * (1.0 - in_fb.a) + D * (1.0 - in_src.a); float fastuidraw_color_dodge(in float S, in float D)
perform color dodge blending on a single color channel
float fastuidraw_hardlight(in float S, in float D)
perform hardlight blending on a single color channel
float fastuidraw_color_burn(in float S, in float D)
perform color burn blending on a single color channel
vec3 fastuidraw_set_luminosity(in vec3 C, in vec3 L)
float fastuidraw_compute_max(in vec3 C)
Compute the maximum color channel value.
T dot(const vecN< T, N > &a, const vecN< T, N > &b)
vec3 fastuidraw_clipcolor(in vec3 C)
clip an RGB value so that its luminosity is within the range fastuidraw_compute_min() and fastuidraw_...
float fastuidraw_softlight(in float S, in float D)
perform softlight blending on a single color channel
float fastuidraw_overlay(in float S, in float D)
perform overlay blending on a single color channel
float fastuidraw_compute_saturation(in vec3 C)
compute the saturation of an RGB value
float fastuidraw_compute_min(in vec3 C)
Compute the minimum color channel value.
float fastuidraw_compute_luminosity(in vec3 C)
compute the luminosity of an RGB value
vec3 fastuidraw_undo_alpha(in vec4 S)
Undo pre-multiply by alpha on the RGB channels of a color value.
vec3 fastuidraw_set_saturation_and_luminosity(in vec3 C, in vec3 S, in vec3 L)