Blender
V2.93
source
blender
compositor
operations
COM_AlphaOverMixedOperation.cc
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU General Public License
4
* as published by the Free Software Foundation; either version 2
5
* of the License, or (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software Foundation,
14
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
*
16
* Copyright 2011, Blender Foundation.
17
*/
18
19
#include "
COM_AlphaOverMixedOperation.h
"
20
21
namespace
blender::compositor
{
22
23
AlphaOverMixedOperation::AlphaOverMixedOperation
()
24
{
25
this->m_x = 0.0f;
26
}
27
28
void
AlphaOverMixedOperation::executePixelSampled
(
float
output
[4],
29
float
x
,
30
float
y
,
31
PixelSampler
sampler)
32
{
33
float
inputColor1[4];
34
float
inputOverColor[4];
35
float
value[4];
36
37
this->
m_inputValueOperation
->
readSampled
(value,
x
,
y
, sampler);
38
this->
m_inputColor1Operation
->
readSampled
(inputColor1,
x
,
y
, sampler);
39
this->
m_inputColor2Operation
->
readSampled
(inputOverColor,
x
,
y
, sampler);
40
41
if
(inputOverColor[3] <= 0.0f) {
42
copy_v4_v4
(
output
, inputColor1);
43
}
44
else
if
(value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
45
copy_v4_v4
(
output
, inputOverColor);
46
}
47
else
{
48
float
addfac = 1.0f - this->m_x + inputOverColor[3] * this->m_x;
49
float
premul = value[0] * addfac;
50
float
mul
= 1.0f - value[0] * inputOverColor[3];
51
52
output
[0] = (
mul
* inputColor1[0]) + premul * inputOverColor[0];
53
output
[1] = (
mul
* inputColor1[1]) + premul * inputOverColor[1];
54
output
[2] = (
mul
* inputColor1[2]) + premul * inputOverColor[2];
55
output
[3] = (
mul
* inputColor1[3]) + value[0] * inputOverColor[3];
56
}
57
}
58
59
}
// namespace blender::compositor
x
x
Definition:
BLI_expr_pylike_eval_test.cc:342
copy_v4_v4
MINLINE void copy_v4_v4(float r[4], const float a[4])
Definition:
math_vector_inline.c:74
COM_AlphaOverMixedOperation.h
y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Definition:
GPU_legacy_stubs.h:206
output
#define output
mul
static void mul(btAlignedObjectArray< T > &items, const Q &value)
Definition:
btSoftBodyHelpers.cpp:120
blender::compositor::AlphaOverMixedOperation::AlphaOverMixedOperation
AlphaOverMixedOperation()
Definition:
COM_AlphaOverMixedOperation.cc:23
blender::compositor::AlphaOverMixedOperation::executePixelSampled
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override
Definition:
COM_AlphaOverMixedOperation.cc:28
blender::compositor::MixBaseOperation::m_inputColor1Operation
SocketReader * m_inputColor1Operation
Definition:
COM_MixOperation.h:36
blender::compositor::MixBaseOperation::m_inputValueOperation
SocketReader * m_inputValueOperation
Definition:
COM_MixOperation.h:35
blender::compositor::MixBaseOperation::m_inputColor2Operation
SocketReader * m_inputColor2Operation
Definition:
COM_MixOperation.h:37
blender::compositor::NodeOperation::readSampled
void readSampled(float result[4], float x, float y, PixelSampler sampler)
Definition:
COM_NodeOperation.h:502
blender::compositor
Definition:
COM_defines.h:21
blender::compositor::PixelSampler
PixelSampler
Definition:
COM_NodeOperation.h:77
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1