Blender V5.0
BLI_math_color_blend.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "BLI_math_inline.h"
12#include "BLI_sys_types.h"
13
14/******************** Blending Modes **********************
15 * - byte function assume straight alpha
16 * - float functions assume premultiplied alpha
17 */
18
19MINLINE void blend_color_mix_byte(unsigned char dst[4],
20 const unsigned char src1[4],
21 const unsigned char src2[4]);
22MINLINE void blend_color_add_byte(unsigned char dst[4],
23 const unsigned char src1[4],
24 const unsigned char src2[4]);
25MINLINE void blend_color_sub_byte(unsigned char dst[4],
26 const unsigned char src1[4],
27 const unsigned char src2[4]);
28MINLINE void blend_color_mul_byte(unsigned char dst[4],
29 const unsigned char src1[4],
30 const unsigned char src2[4]);
31MINLINE void blend_color_lighten_byte(unsigned char dst[4],
32 const unsigned char src1[4],
33 const unsigned char src2[4]);
34MINLINE void blend_color_darken_byte(unsigned char dst[4],
35 const unsigned char src1[4],
36 const unsigned char src2[4]);
37MINLINE void blend_color_erase_alpha_byte(unsigned char dst[4],
38 const unsigned char src1[4],
39 const unsigned char src2[4]);
40MINLINE void blend_color_add_alpha_byte(unsigned char dst[4],
41 const unsigned char src1[4],
42 const unsigned char src2[4]);
43
44MINLINE void blend_color_overlay_byte(unsigned char dst[4],
45 const uchar src1[4],
46 const uchar src2[4]);
47MINLINE void blend_color_hardlight_byte(unsigned char dst[4],
48 const uchar src1[4],
49 const uchar src2[4]);
50MINLINE void blend_color_burn_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4]);
51MINLINE void blend_color_linearburn_byte(unsigned char dst[4],
52 const uchar src1[4],
53 const uchar src2[4]);
54MINLINE void blend_color_dodge_byte(unsigned char dst[4],
55 const uchar src1[4],
56 const uchar src2[4]);
57MINLINE void blend_color_screen_byte(unsigned char dst[4],
58 const uchar src1[4],
59 const uchar src2[4]);
60MINLINE void blend_color_softlight_byte(unsigned char dst[4],
61 const uchar src1[4],
62 const uchar src2[4]);
63MINLINE void blend_color_pinlight_byte(unsigned char dst[4],
64 const uchar src1[4],
65 const uchar src2[4]);
66MINLINE void blend_color_linearlight_byte(unsigned char dst[4],
67 const uchar src1[4],
68 const uchar src2[4]);
69MINLINE void blend_color_vividlight_byte(unsigned char dst[4],
70 const uchar src1[4],
71 const uchar src2[4]);
72MINLINE void blend_color_difference_byte(unsigned char dst[4],
73 const uchar src1[4],
74 const uchar src2[4]);
75MINLINE void blend_color_exclusion_byte(unsigned char dst[4],
76 const uchar src1[4],
77 const uchar src2[4]);
78MINLINE void blend_color_color_byte(unsigned char dst[4],
79 const uchar src1[4],
80 const uchar src2[4]);
81MINLINE void blend_color_hue_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4]);
82MINLINE void blend_color_saturation_byte(unsigned char dst[4],
83 const uchar src1[4],
84 const uchar src2[4]);
85MINLINE void blend_color_luminosity_byte(unsigned char dst[4],
86 const uchar src1[4],
87 const uchar src2[4]);
88
89MINLINE void blend_color_interpolate_byte(unsigned char dst[4],
90 const unsigned char src1[4],
91 const unsigned char src2[4],
92 float ft);
93
94MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4]);
95MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4]);
96MINLINE void blend_color_sub_float(float dst[4], const float src1[4], const float src2[4]);
97MINLINE void blend_color_mul_float(float dst[4], const float src1[4], const float src2[4]);
98MINLINE void blend_color_lighten_float(float dst[4], const float src1[4], const float src2[4]);
99MINLINE void blend_color_darken_float(float dst[4], const float src1[4], const float src2[4]);
100MINLINE void blend_color_erase_alpha_float(float dst[4], const float src1[4], const float src2[4]);
101MINLINE void blend_color_add_alpha_float(float dst[4], const float src1[4], const float src2[4]);
102
103MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]);
104MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]);
105MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]);
106MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]);
107MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]);
108MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]);
109MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]);
110MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]);
111MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]);
112MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]);
113MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]);
114MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]);
115MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]);
116MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]);
117MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]);
118MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]);
119
120MINLINE void blend_color_interpolate_float(float dst[4],
121 const float src1[4],
122 const float src2[4],
123 float t);
124
125#if BLI_MATH_DO_INLINE
126# include "intern/math_color_blend_inline.cc" // IWYU pragma: export
127#endif
MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_linearburn_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_saturation_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_erase_alpha_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_sub_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_luminosity_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mul_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_pinlight_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_erase_alpha_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_screen_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_add_alpha_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_vividlight_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mul_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_darken_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_difference_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_burn_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_add_alpha_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_color_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_overlay_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_dodge_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_hardlight_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_sub_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_darken_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_softlight_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_add_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_hue_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_lighten_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_exclusion_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_interpolate_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], float ft)
MINLINE void blend_color_linearlight_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4])
MINLINE void blend_color_lighten_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], const float src2[4], float t)
#define MINLINE
unsigned char uchar