Blender V4.3
COM_TranslateOperation.h
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#pragma once
6
7#include "BLI_utildefines.h"
10
11#include <mutex>
12
13namespace blender::compositor {
14
16 protected:
17 static constexpr int IMAGE_INPUT_INDEX = 0;
18 static constexpr int X_INPUT_INDEX = 1;
19 static constexpr int Y_INPUT_INDEX = 2;
20
21 private:
22 float delta_x_;
23 float delta_y_;
24 bool is_delta_set_;
25 bool is_relative_;
26 PixelSampler sampler_;
27
28 std::mutex mutex_;
29
30 protected:
33
34 public:
37
39 {
40 BLI_assert(is_delta_set_);
41 return delta_x_;
42 }
44 {
45 BLI_assert(is_delta_set_);
46 return delta_y_;
47 }
48
49 void set_is_relative(const bool is_relative)
50 {
51 is_relative_ = is_relative;
52 }
54 {
55 return is_relative_;
56 }
57
59 {
60 return sampler_;
61 }
63 {
64 sampler_ = sampler;
65 }
66
67 inline void ensure_delta()
68 {
69 if (!is_delta_set_) {
70 std::unique_lock lock(mutex_);
71 if (is_delta_set_) {
72 return;
73 }
74
77 if (get_is_relative()) {
78 const int input_width = BLI_rcti_size_x(
80 const int input_height = BLI_rcti_size_y(
82 delta_x_ *= input_width;
83 delta_y_ *= input_height;
84 }
85
86 is_delta_set_ = true;
87 }
88 }
89 void set_wrapping(int wrapping_type);
90
91 void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
92
94 const rcti &area,
95 Span<MemoryBuffer *> inputs) override;
97 const rcti &area,
98 Span<MemoryBuffer *> inputs) override;
99};
100
102 public:
104 void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
105};
106
107} // namespace blender::compositor
#define BLI_assert(a)
Definition BLI_assert.h:50
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:193
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:189
volatile int lock
a MemoryBuffer contains access to the data
float get_constant_value_default(float default_value)
NodeOperation * get_input_operation(int index)
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
void update_memory_buffer_started(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
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) override
Get input operation area being read by this operation on rendering given output area.
local_group_size(16, 16) .push_constant(Type local_group_size(16, 16) .push_constant(Type input_tx sampler(1, ImageType::FLOAT_2D, "matte_tx") .image(0
DataType
possible data types for sockets
Definition COM_defines.h:21
ResizeMode
Resize modes of inputsockets How are the input and working resolutions matched.
@ Center
Center the input image to the center of the working area of the node, no resizing occurs.