Blender  V3.3
COM_SeparateColorNodeLegacy.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 
6 #include "COM_ConvertOperation.h"
7 
8 namespace blender::compositor {
9 
11 {
12 }
13 
15  const CompositorContext &context) const
16 {
17  NodeInput *image_socket = this->get_input_socket(0);
18  NodeOutput *output_rsocket = this->get_output_socket(0);
19  NodeOutput *output_gsocket = this->get_output_socket(1);
20  NodeOutput *output_bsocket = this->get_output_socket(2);
21  NodeOutput *output_asocket = this->get_output_socket(3);
22 
24  if (color_conv) {
25  converter.add_operation(color_conv);
26 
27  converter.map_input_socket(image_socket, color_conv->get_input_socket(0));
28  }
29 
30  {
32  operation->set_channel(0);
33  converter.add_operation(operation);
34 
35  if (color_conv) {
36  converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
37  }
38  else {
39  converter.map_input_socket(image_socket, operation->get_input_socket(0));
40  }
41  converter.map_output_socket(output_rsocket, operation->get_output_socket(0));
42  }
43 
44  {
46  operation->set_channel(1);
47  converter.add_operation(operation);
48 
49  if (color_conv) {
50  converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
51  }
52  else {
53  converter.map_input_socket(image_socket, operation->get_input_socket(0));
54  }
55  converter.map_output_socket(output_gsocket, operation->get_output_socket(0));
56  }
57 
58  {
60  operation->set_channel(2);
61  converter.add_operation(operation);
62 
63  if (color_conv) {
64  converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
65  }
66  else {
67  converter.map_input_socket(image_socket, operation->get_input_socket(0));
68  }
69  converter.map_output_socket(output_bsocket, operation->get_output_socket(0));
70  }
71 
72  {
74  operation->set_channel(3);
75  converter.add_operation(operation);
76 
77  if (color_conv) {
78  converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0));
79  }
80  else {
81  converter.map_input_socket(image_socket, operation->get_input_socket(0));
82  }
83  converter.map_output_socket(output_asocket, operation->get_output_socket(0));
84  }
85 }
86 
88 {
89  return nullptr; /* no conversion needed */
90 }
91 
93 {
94  return new ConvertRGBToHSVOperation();
95 }
96 
98 {
100  bNode *editor_node = this->get_bnode();
101  operation->set_mode(editor_node->custom1);
102  return operation;
103 }
104 
106 {
107  return new ConvertRGBToYUVOperation();
108 }
109 
110 } // namespace blender::compositor
Overall context of the compositor.
void add_link(NodeOperationOutput *from, NodeOperationInput *to)
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void add_operation(NodeOperation *operation)
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
NodeInput are sockets that can receive data/input.
Definition: COM_Node.h:190
NodeOperation contains calculation logic.
NodeOperationOutput * get_output_socket(unsigned int index=0)
NodeOperationInput * get_input_socket(unsigned int index)
NodeOutput are sockets that can send data/input.
Definition: COM_Node.h:238
NodeOutput * get_output_socket(unsigned int index=0) const
Definition: COM_Node.cc:84
bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition: COM_Node.h:64
NodeInput * get_input_socket(unsigned int index) const
Definition: COM_Node.cc:89
virtual NodeOperation * get_color_converter(const CompositorContext &context) const =0
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
NodeOperation * get_color_converter(const CompositorContext &context) const override
short custom1