Blender V4.3
COM_InvertOperation.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
19
21 const rcti &area,
23{
24 for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
25 const float value = *it.in(0);
26 const float inverted_value = 1.0f - value;
27 const float *color = it.in(1);
28
29 if (color_) {
30 it.out[0] = (1.0f - color[0]) * value + color[0] * inverted_value;
31 it.out[1] = (1.0f - color[1]) * value + color[1] * inverted_value;
32 it.out[2] = (1.0f - color[2]) * value + color[2] * inverted_value;
33 }
34 else {
35 copy_v3_v3(it.out, color);
36 }
37
38 if (alpha_) {
39 it.out[3] = (1.0f - color[3]) * value + color[3] * inverted_value;
40 }
41 else {
42 it.out[3] = color[3];
43 }
44 }
45}
46
47} // namespace blender::compositor
MINLINE void copy_v3_v3(float r[3], const float a[3])
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
a MemoryBuffer contains access to the data
void add_output_socket(DataType datatype)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator