Blender  V3.3
COM_DilateErodeOperation.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
4 #pragma once
5 
7 
8 namespace blender::compositor {
9 
11  public:
12  struct PixelData;
13 
14  private:
18  SocketReader *input_program_;
19 
20  float distance_;
21  float switch_;
22  float inset_;
23 
28  int scope_;
29 
30  public:
31  /* DilateErode Distance Threshold */
33 
37  void execute_pixel(float output[4], int x, int y, void *data) override;
38 
39  void init_data() override;
43  void init_execution() override;
44 
45  void *initialize_tile_data(rcti *rect) override;
49  void deinit_execution() override;
50 
51  void set_distance(float distance)
52  {
53  distance_ = distance;
54  }
55  void set_switch(float sw)
56  {
57  switch_ = sw;
58  }
59  void set_inset(float inset)
60  {
61  inset_ = inset;
62  }
63 
65  ReadBufferOperation *read_operation,
66  rcti *output) override;
67 
68  void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
70  const rcti &area,
71  Span<MemoryBuffer *> inputs) override;
72 };
73 
75  public:
76  struct PixelData;
77 
78  protected:
83  float distance_;
84  int scope_;
85 
86  public:
87  /* Dilate Distance. */
89 
93  void execute_pixel(float output[4], int x, int y, void *data) override;
94 
95  void init_data() override;
99  void init_execution() override;
100 
101  void *initialize_tile_data(rcti *rect) override;
105  void deinit_execution() override;
106 
107  void set_distance(float distance)
108  {
110  }
112  ReadBufferOperation *read_operation,
113  rcti *output) override;
114 
115  void execute_opencl(OpenCLDevice *device,
116  MemoryBuffer *output_memory_buffer,
117  cl_mem cl_output_buffer,
118  MemoryBuffer **input_memory_buffers,
119  std::list<cl_mem> *cl_mem_to_clean_up,
120  std::list<cl_kernel> *cl_kernels_to_clean_up) override;
121 
122  void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final;
124  const rcti &area,
125  Span<MemoryBuffer *> inputs) override;
126 };
127 
129  public:
130  /* Erode Distance */
132 
136  void execute_pixel(float output[4], int x, int y, void *data) override;
137 
138  void execute_opencl(OpenCLDevice *device,
139  MemoryBuffer *output_memory_buffer,
140  cl_mem cl_output_buffer,
141  MemoryBuffer **input_memory_buffers,
142  std::list<cl_mem> *cl_mem_to_clean_up,
143  std::list<cl_kernel> *cl_kernels_to_clean_up) override;
144 
146  const rcti &area,
147  Span<MemoryBuffer *> inputs) override;
148 };
149 
151  protected:
156 
158 
159  public:
160  /* Dilate step */
162 
166  void execute_pixel(float output[4], int x, int y, void *data) override;
167 
171  void init_execution() override;
172 
173  void *initialize_tile_data(rcti *rect) override;
177  void deinit_execution() override;
178  void deinitialize_tile_data(rcti *rect, void *data) override;
179 
180  void set_iterations(int iterations)
181  {
182  iterations_ = iterations;
183  }
184 
186  ReadBufferOperation *read_operation,
187  rcti *output) override;
188 
189  void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final;
191  const rcti &area,
192  Span<MemoryBuffer *> inputs) override;
193 };
194 
196  public:
199 
200  void *initialize_tile_data(rcti *rect) override;
202  const rcti &area,
203  Span<MemoryBuffer *> inputs) override;
204 };
205 
206 } // namespace blender::compositor
_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 get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final
Get input operation area being read by this operation on rendering given output area.
void execute_pixel(float output[4], int x, int y, void *data) override
virtual void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void execute_opencl(OpenCLDevice *device, MemoryBuffer *output_memory_buffer, cl_mem cl_output_buffer, MemoryBuffer **input_memory_buffers, std::list< cl_mem > *cl_mem_to_clean_up, std::list< cl_kernel > *cl_kernels_to_clean_up) override
custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevic...
void execute_pixel(float output[4], int x, int y, void *data) override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void execute_pixel(float output[4], int x, int y, void *data) override
virtual void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final
Get input operation area being read by this operation on rendering given output area.
void deinitialize_tile_data(rcti *rect, void *data) override
void execute_pixel(float output[4], int x, int y, void *data) override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void execute_opencl(OpenCLDevice *device, MemoryBuffer *output_memory_buffer, cl_mem cl_output_buffer, MemoryBuffer **input_memory_buffers, std::list< cl_mem > *cl_mem_to_clean_up, std::list< cl_kernel > *cl_kernels_to_clean_up) override
custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevic...
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
a MemoryBuffer contains access to the data of a chunk
NodeOperation contains calculation logic.
device representing an GPU OpenCL device. an instance of this class represents a single cl_device
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_gpu_kernel_postfix ccl_global float int int int sw
ccl_global KernelShaderEvalInput * input
static void area(int d1, int d2, int e1, int e2, float weights[2])
T distance(const T &a, const T &b)
static bNodeSocketTemplate inputs[]