Blender V4.3
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
11#include "BLI_math_inline.h"
12#include "BLI_sys_types.h"
13#include "BLI_utildefines.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/******************** Blending Modes **********************
20 * - byte function assume straight alpha
21 * - float functions assume premultiplied alpha
22 */
23
24MINLINE void blend_color_mix_byte(unsigned char dst[4],
25 const unsigned char src1[4],
26 const unsigned char src2[4]);
27MINLINE void blend_color_add_byte(unsigned char dst[4],
28 const unsigned char src1[4],
29 const unsigned char src2[4]);
30MINLINE void blend_color_sub_byte(unsigned char dst[4],
31 const unsigned char src1[4],
32 const unsigned char src2[4]);
33MINLINE void blend_color_mul_byte(unsigned char dst[4],
34 const unsigned char src1[4],
35 const unsigned char src2[4]);
36MINLINE void blend_color_lighten_byte(unsigned char dst[4],
37 const unsigned char src1[4],
38 const unsigned char src2[4]);
39MINLINE void blend_color_darken_byte(unsigned char dst[4],
40 const unsigned char src1[4],
41 const unsigned char src2[4]);
42MINLINE void blend_color_erase_alpha_byte(unsigned char dst[4],
43 const unsigned char src1[4],
44 const unsigned char src2[4]);
45MINLINE void blend_color_add_alpha_byte(unsigned char dst[4],
46 const unsigned char src1[4],
47 const unsigned char src2[4]);
48
49MINLINE void blend_color_overlay_byte(unsigned char dst[4],
50 const uchar src1[4],
51 const uchar src2[4]);
52MINLINE void blend_color_hardlight_byte(unsigned char dst[4],
53 const uchar src1[4],
54 const uchar src2[4]);
55MINLINE void blend_color_burn_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4]);
56MINLINE void blend_color_linearburn_byte(unsigned char dst[4],
57 const uchar src1[4],
58 const uchar src2[4]);
59MINLINE void blend_color_dodge_byte(unsigned char dst[4],
60 const uchar src1[4],
61 const uchar src2[4]);
62MINLINE void blend_color_screen_byte(unsigned char dst[4],
63 const uchar src1[4],
64 const uchar src2[4]);
65MINLINE void blend_color_softlight_byte(unsigned char dst[4],
66 const uchar src1[4],
67 const uchar src2[4]);
68MINLINE void blend_color_pinlight_byte(unsigned char dst[4],
69 const uchar src1[4],
70 const uchar src2[4]);
71MINLINE void blend_color_linearlight_byte(unsigned char dst[4],
72 const uchar src1[4],
73 const uchar src2[4]);
74MINLINE void blend_color_vividlight_byte(unsigned char dst[4],
75 const uchar src1[4],
76 const uchar src2[4]);
77MINLINE void blend_color_difference_byte(unsigned char dst[4],
78 const uchar src1[4],
79 const uchar src2[4]);
80MINLINE void blend_color_exclusion_byte(unsigned char dst[4],
81 const uchar src1[4],
82 const uchar src2[4]);
83MINLINE void blend_color_color_byte(unsigned char dst[4],
84 const uchar src1[4],
85 const uchar src2[4]);
86MINLINE void blend_color_hue_byte(unsigned char dst[4], const uchar src1[4], const uchar src2[4]);
87MINLINE void blend_color_saturation_byte(unsigned char dst[4],
88 const uchar src1[4],
89 const uchar src2[4]);
90MINLINE void blend_color_luminosity_byte(unsigned char dst[4],
91 const uchar src1[4],
92 const uchar src2[4]);
93
94MINLINE void blend_color_interpolate_byte(unsigned char dst[4],
95 const unsigned char src1[4],
96 const unsigned char src2[4],
97 float ft);
98
99MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4]);
100MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4]);
101MINLINE void blend_color_sub_float(float dst[4], const float src1[4], const float src2[4]);
102MINLINE void blend_color_mul_float(float dst[4], const float src1[4], const float src2[4]);
103MINLINE void blend_color_lighten_float(float dst[4], const float src1[4], const float src2[4]);
104MINLINE void blend_color_darken_float(float dst[4], const float src1[4], const float src2[4]);
105MINLINE void blend_color_erase_alpha_float(float dst[4], const float src1[4], const float src2[4]);
106MINLINE void blend_color_add_alpha_float(float dst[4], const float src1[4], const float src2[4]);
107
108MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]);
109MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]);
110MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]);
111MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]);
112MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]);
113MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]);
114MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]);
115MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]);
116MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]);
117MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]);
118MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]);
119MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]);
120MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]);
121MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]);
122MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]);
123MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]);
124
125MINLINE void blend_color_interpolate_float(float dst[4],
126 const float src1[4],
127 const float src2[4],
128 float t);
129
130#if BLI_MATH_DO_INLINE
132#endif
133
134#ifdef __cplusplus
135}
136#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