Blender
V4.3
source
blender
compositor
operations
COM_AlphaOverPremultiplyOperation.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
5
#include "
COM_AlphaOverPremultiplyOperation.h
"
6
7
namespace
blender::compositor
{
8
9
AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation
()
10
{
11
flags_
.
can_be_constant
=
true
;
12
}
13
14
void
AlphaOverPremultiplyOperation::update_memory_buffer_row
(
PixelCursor
&p)
15
{
16
for
(; p.
out
< p.
row_end
; p.
next
()) {
17
const
float
*color1 = p.
color1
;
18
const
float
*over_color = p.
color2
;
19
const
float
value = *p.
value
;
20
21
/* Zero alpha values should still permit an add of RGB data. */
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
mul
= 1.0f - value * over_color[3];
30
31
p.
out
[0] = (
mul
* color1[0]) + value * over_color[0];
32
p.
out
[1] = (
mul
* color1[1]) + value * over_color[1];
33
p.
out
[2] = (
mul
* color1[2]) + value * over_color[2];
34
p.
out
[3] = (
mul
* color1[3]) + value * over_color[3];
35
}
36
}
37
}
38
39
}
// namespace blender::compositor
copy_v4_v4
MINLINE void copy_v4_v4(float r[4], const float a[4])
Definition
math_vector_inline.c:57
COM_AlphaOverPremultiplyOperation.h
mul
static void mul(btAlignedObjectArray< T > &items, const Q &value)
Definition
btSoftBodyHelpers.cpp:120
blender::compositor::AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation
AlphaOverPremultiplyOperation()
Definition
COM_AlphaOverPremultiplyOperation.cc:9
blender::compositor::AlphaOverPremultiplyOperation::update_memory_buffer_row
void update_memory_buffer_row(PixelCursor &p) override
Definition
COM_AlphaOverPremultiplyOperation.cc:14
blender::compositor::NodeOperation::flags_
NodeOperationFlags flags_
Definition
COM_NodeOperation.h:295
blender::compositor
Definition
COM_JumpFloodingAlgorithm.cc:20
blender::compositor::MixBaseOperation::PixelCursor
Definition
COM_MixOperation.h:17
blender::compositor::MixBaseOperation::PixelCursor::row_end
const float * row_end
Definition
COM_MixOperation.h:19
blender::compositor::MixBaseOperation::PixelCursor::color1
const float * color1
Definition
COM_MixOperation.h:21
blender::compositor::MixBaseOperation::PixelCursor::value
const float * value
Definition
COM_MixOperation.h:20
blender::compositor::MixBaseOperation::PixelCursor::color2
const float * color2
Definition
COM_MixOperation.h:22
blender::compositor::MixBaseOperation::PixelCursor::out
float * out
Definition
COM_MixOperation.h:18
blender::compositor::MixBaseOperation::PixelCursor::next
void next()
Definition
COM_MixOperation.h:28
blender::compositor::NodeOperationFlags::can_be_constant
bool can_be_constant
Definition
COM_NodeOperation.h:207
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0