Blender V4.3
COM_AlphaOverMixedOperation.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7namespace blender::compositor {
8
14
16{
17 for (; p.out < p.row_end; p.next()) {
18 const float *color1 = p.color1;
19 const float *over_color = p.color2;
20 const float value = *p.value;
21
22 if (over_color[3] <= 0.0f) {
23 copy_v4_v4(p.out, color1);
24 }
25 else if (value == 1.0f && over_color[3] >= 1.0f) {
26 copy_v4_v4(p.out, over_color);
27 }
28 else {
29 const float addfac = 1.0f - x_ + over_color[3] * x_;
30 const float premul = value * addfac;
31 const float mul = 1.0f - value * over_color[3];
32
33 p.out[0] = (mul * color1[0]) + premul * over_color[0];
34 p.out[1] = (mul * color1[1]) + premul * over_color[1];
35 p.out[2] = (mul * color1[2]) + premul * over_color[2];
36 p.out[3] = (mul * color1[3]) + value * over_color[3];
37 }
38 }
39}
40
41} // namespace blender::compositor
MINLINE void copy_v4_v4(float r[4], const float a[4])
static void mul(btAlignedObjectArray< T > &items, const Q &value)