Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cpp
- This file was moved from source/blender/compositor/operations/COM_SetAlphaOperation.cpp.
| Show All 10 Lines | |||||
| * | * | ||||
| * You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
| * along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_SetAlphaOperation.h" | #include "COM_SetAlphaReplaceOperation.h" | ||||
| SetAlphaOperation::SetAlphaOperation() | SetAlphaReplaceOperation::SetAlphaReplaceOperation() | ||||
| { | { | ||||
| this->addInputSocket(COM_DT_COLOR); | this->addInputSocket(COM_DT_COLOR); | ||||
| this->addInputSocket(COM_DT_VALUE); | this->addInputSocket(COM_DT_VALUE); | ||||
| this->addOutputSocket(COM_DT_COLOR); | this->addOutputSocket(COM_DT_COLOR); | ||||
| this->m_inputColor = nullptr; | this->m_inputColor = nullptr; | ||||
| this->m_inputAlpha = nullptr; | this->m_inputAlpha = nullptr; | ||||
| } | } | ||||
| void SetAlphaOperation::initExecution() | void SetAlphaReplaceOperation::initExecution() | ||||
| { | { | ||||
| this->m_inputColor = getInputSocketReader(0); | this->m_inputColor = getInputSocketReader(0); | ||||
| this->m_inputAlpha = getInputSocketReader(1); | this->m_inputAlpha = getInputSocketReader(1); | ||||
| } | } | ||||
| void SetAlphaOperation::executePixelSampled(float output[4], | void SetAlphaReplaceOperation::executePixelSampled(float output[4], | ||||
| float x, | float x, | ||||
| float y, | float y, | ||||
| PixelSampler sampler) | PixelSampler sampler) | ||||
| { | { | ||||
| float alphaInput[4]; | float alpha_input[4]; | ||||
| this->m_inputColor->readSampled(output, x, y, sampler); | this->m_inputColor->readSampled(output, x, y, sampler); | ||||
| this->m_inputAlpha->readSampled(alphaInput, x, y, sampler); | this->m_inputAlpha->readSampled(alpha_input, x, y, sampler); | ||||
| output[3] = alpha_input[0]; | |||||
| output[3] = alphaInput[0]; | |||||
| } | } | ||||
| void SetAlphaOperation::deinitExecution() | void SetAlphaReplaceOperation::deinitExecution() | ||||
| { | { | ||||
| this->m_inputColor = nullptr; | this->m_inputColor = nullptr; | ||||
| this->m_inputAlpha = nullptr; | this->m_inputAlpha = nullptr; | ||||
| } | } | ||||