Blender  V3.3
COM_ConvertColorSpaceOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. */
3 
5 
6 namespace blender::compositor {
7 
9 {
12  this->input_program_ = nullptr;
13  color_processor_ = nullptr;
14 }
15 
17 {
18  this->settings_ = node_color_space;
19 }
20 
22 {
23  if (BLI_strnlen(settings_->from_color_space, sizeof(settings_->from_color_space)) == 0 ||
24  BLI_strnlen(settings_->to_color_space, sizeof(settings_->to_color_space)) == 0) {
25  return;
26  }
27 
28  int in_colorspace_index = IMB_colormanagement_colorspace_get_named_index(
29  settings_->from_color_space);
30  int out_colorspace_index = IMB_colormanagement_colorspace_get_named_index(
31  settings_->to_color_space);
32 
33  if (in_colorspace_index == 0 || out_colorspace_index == 0) {
34  return;
35  }
36 
37  this->input_program_ = this->get_input_socket_reader(0);
38 
40  settings_->to_color_space);
41 }
42 
44  float x,
45  float y,
47 {
48  this->input_program_->read_sampled(output, x, y, sampler);
49  if (color_processor_ != nullptr) {
51  }
52 }
53 
55  const rcti &area,
57 {
58  for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
59  copy_v4_v4(it.out, it.in(0));
60  }
61 
62  if (color_processor_ != nullptr) {
63  output->apply_processor(*color_processor_, area);
64  }
65 }
66 
68 {
69  if (color_processor_ != nullptr) {
70  IMB_colormanagement_processor_free(color_processor_);
71  }
72  this->input_program_ = nullptr;
73  this->color_processor_ = nullptr;
74 }
75 
76 } // namespace blender::compositor
MINLINE void copy_v4_v4(float r[4], const float a[4])
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:899
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor, float *pixel, int channels)
struct ColormanageProcessor * IMB_colormanagement_colorspace_processor_new(const char *from_colorspace, const char *to_colorspace)
void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processor)
int IMB_colormanagement_colorspace_get_named_index(const char *name)
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
void set_settings(NodeConvertColorSpace *node_color_space)
a MemoryBuffer contains access to the data of a chunk
void add_output_socket(DataType datatype)
SocketReader * get_input_socket_reader(unsigned int index)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
ccl_global KernelShaderEvalInput ccl_global float * output
static void area(int d1, int d2, int e1, int e2, float weights[2])
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static bNodeSocketTemplate inputs[]