Blender
V4.3
source
blender
compositor
operations
COM_GlareThresholdOperation.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 "
BLI_math_base.hh
"
6
#include "
BLI_math_color.h
"
7
#include "
BLI_utildefines.h
"
8
9
#include "
COM_GlareThresholdOperation.h
"
10
11
#include "
IMB_colormanagement.hh
"
12
13
namespace
blender::compositor
{
14
15
GlareThresholdOperation::GlareThresholdOperation
()
16
{
17
this->
add_input_socket
(
DataType::Color
,
ResizeMode::FitAny
);
18
this->
add_output_socket
(
DataType::Color
);
19
20
flags_
.can_be_constant =
true
;
21
}
22
23
void
GlareThresholdOperation::determine_canvas
(
const
rcti
&preferred_area,
rcti
&r_area)
24
{
25
NodeOperation::determine_canvas
(preferred_area, r_area);
26
const
int
width =
BLI_rcti_size_x
(&r_area) / (1 << settings_->quality);
27
const
int
height =
BLI_rcti_size_y
(&r_area) / (1 << settings_->quality);
28
r_area.
xmax
= r_area.
xmin
+ width;
29
r_area.
ymax
= r_area.
ymin
+ height;
30
}
31
32
void
GlareThresholdOperation::update_memory_buffer_partial
(
MemoryBuffer
*
output
,
33
const
rcti
&area,
34
Span<MemoryBuffer *>
inputs
)
35
{
36
const
float
threshold = settings_->threshold;
37
for
(
BuffersIterator<float>
it =
output
->iterate_with(
inputs
, area); !it.is_end(); ++it) {
38
float4
hsva;
39
rgb_to_hsv_v
(it.in(0), hsva);
40
41
hsva.z =
math::max
(0.0f, hsva.z - threshold);
42
43
hsv_to_rgb_v
(hsva, it.out);
44
CLAMP3_MIN
(it.out, 0.0f);
45
it.out[3] = 1.0f;
46
}
47
}
48
49
}
// namespace blender::compositor
BLI_math_base.hh
BLI_math_color.h
hsv_to_rgb_v
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
Definition
math_color.cc:57
rgb_to_hsv_v
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
Definition
math_color.cc:258
BLI_rcti_size_y
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition
BLI_rect.h:193
BLI_rcti_size_x
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition
BLI_rect.h:189
BLI_utildefines.h
CLAMP3_MIN
#define CLAMP3_MIN(vec, b)
Definition
BLI_utildefines.h:246
COM_GlareThresholdOperation.h
IMB_colormanagement.hh
output
#define output
blender::Span
Definition
BLI_span.hh:75
blender::compositor::GlareThresholdOperation::update_memory_buffer_partial
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
Definition
COM_GlareThresholdOperation.cc:32
blender::compositor::GlareThresholdOperation::determine_canvas
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
Definition
COM_GlareThresholdOperation.cc:23
blender::compositor::GlareThresholdOperation::GlareThresholdOperation
GlareThresholdOperation()
Definition
COM_GlareThresholdOperation.cc:15
blender::compositor::MemoryBuffer
a MemoryBuffer contains access to the data
Definition
COM_MemoryBuffer.h:35
blender::compositor::NodeOperation::add_output_socket
void add_output_socket(DataType datatype)
Definition
COM_NodeOperation.cc:102
blender::compositor::NodeOperation::flags_
NodeOperationFlags flags_
Definition
COM_NodeOperation.h:295
blender::compositor::NodeOperation::add_input_socket
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
Definition
COM_NodeOperation.cc:97
blender::compositor::NodeOperation::determine_canvas
virtual void determine_canvas(const rcti &preferred_area, rcti &r_area)
Definition
COM_NodeOperation.cc:107
blender::compositor::DataType::Color
@ Color
Color data type.
Definition
COM_defines.h:27
blender::compositor::ResizeMode::FitAny
@ FitAny
Fit the width or the height of the input image to the width or height of the working area of the node...
Definition
COM_NodeOperation.h:64
blender::compositor
Definition
COM_JumpFloodingAlgorithm.cc:20
blender::compositor::BuffersIterator
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
Definition
COM_BuffersIterator.h:179
blender::math::max
T max(const T &a, const T &b)
Definition
BLI_math_base.hh:48
blender::float4
VecBase< float, 4 > float4
Definition
BLI_math_vector_types.hh:613
inputs
static blender::bke::bNodeSocketTemplate inputs[]
Definition
node_texture_at.cc:11
rcti
Definition
DNA_vec_types.h:68
rcti::ymin
int ymin
Definition
DNA_vec_types.h:70
rcti::ymax
int ymax
Definition
DNA_vec_types.h:70
rcti::xmin
int xmin
Definition
DNA_vec_types.h:69
rcti::xmax
int xmax
Definition
DNA_vec_types.h:69
Generated on Sat Oct 4 2025 05:32:23 for Blender by
doxygen
1.14.0