diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-10 16:25:00 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-10 17:16:23 +0300 |
commit | 8f6cc16490843bec88806c2f76c0aa012db938dd (patch) | |
tree | 0add47958c691a254c96def0f59dc2656e3912f0 /source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc | |
parent | b81d88a8e24574028e5a5c01e8decf6ae80a7de5 (diff) |
Compositor: Full frame curve nodes
Adds full frame implementation to "RGB Curves",
"Vector Curves" and "Hue Correct" nodes.
No functional changes.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12093
Diffstat (limited to 'source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc index e341a88ff71..5ae868c5964 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc @@ -73,4 +73,31 @@ void HueSaturationValueCorrectOperation::deinitExecution() this->m_inputProgram = nullptr; } +void HueSaturationValueCorrectOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + float hsv[4]; + for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { + copy_v4_v4(hsv, it.in(0)); + + /* Adjust hue, scaling returned default 0.5 up to 1. */ + float f = BKE_curvemapping_evaluateF(this->m_curveMapping, 0, hsv[0]); + hsv[0] += f - 0.5f; + + /* Adjust saturation, scaling returned default 0.5 up to 1. */ + f = BKE_curvemapping_evaluateF(this->m_curveMapping, 1, hsv[0]); + hsv[1] *= (f * 2.0f); + + /* Adjust value, scaling returned default 0.5 up to 1. */ + f = BKE_curvemapping_evaluateF(this->m_curveMapping, 2, hsv[0]); + hsv[2] *= (f * 2.0f); + + hsv[0] = hsv[0] - floorf(hsv[0]); /* Mod 1.0. */ + CLAMP(hsv[1], 0.0f, 1.0f); + + copy_v4_v4(it.out, hsv); + } +} + } // namespace blender::compositor |