Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/operations/COM_ColorMatteOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index 6e9c1b0d48a..7706559be00 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -22,7 +22,8 @@
#include "COM_ColorMatteOperation.h"
#include "BLI_math.h"
-ColorMatteOperation::ColorMatteOperation(): NodeOperation() {
+ColorMatteOperation::ColorMatteOperation(): NodeOperation()
+{
addInputSocket(COM_DT_COLOR);
addInputSocket(COM_DT_COLOR);
addOutputSocket(COM_DT_VALUE);
@@ -31,23 +32,26 @@ ColorMatteOperation::ColorMatteOperation(): NodeOperation() {
inputKeyProgram = NULL;
}
-void ColorMatteOperation::initExecution() {
+void ColorMatteOperation::initExecution()
+{
this->inputImageProgram = this->getInputSocketReader(0);
this->inputKeyProgram = this->getInputSocketReader(1);
}
-void ColorMatteOperation::deinitExecution() {
- this->inputImageProgram= NULL;
- this->inputKeyProgram= NULL;
+void ColorMatteOperation::deinitExecution()
+{
+ this->inputImageProgram = NULL;
+ this->inputKeyProgram = NULL;
}
-void ColorMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inColor[4];
float inKey[4];
- const float hue=this->settings->t1;
- const float sat=this->settings->t2;
- const float val=this->settings->t3;
+ const float hue = this->settings->t1;
+ const float sat = this->settings->t2;
+ const float val = this->settings->t3;
float h_wrap;
@@ -62,19 +66,19 @@ void ColorMatteOperation::executePixel(float* outputValue, float x, float y, Pix
if (
/* do hue last because it needs to wrap, and does some more checks */
- /* sat */ (fabsf(inColor[1]-inKey[1]) < sat) &&
- /* val */ (fabsf(inColor[2]-inKey[2]) < val) &&
+ /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) &&
+ /* val */ (fabsf(inColor[2] - inKey[2]) < val) &&
/* multiply by 2 because it wraps on both sides of the hue,
* otherwise 0.5 would key all hue's */
- /* hue */ ((h_wrap= 2.f * fabsf(inColor[0]-inKey[0])) < hue || (2.f - h_wrap) < hue)
+ /* hue */ ((h_wrap = 2.f * fabsf(inColor[0]-inKey[0])) < hue || (2.f - h_wrap) < hue)
) {
- outputValue[0]=0.f; /*make transparent*/
+ outputValue[0] = 0.0f; /*make transparent*/
}
else { /*pixel is outside key color */
- outputValue[0]=inColor[3]; /* make pixel just as transparent as it was before */
+ outputValue[0] = inColor[3]; /* make pixel just as transparent as it was before */
}
}