Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Castilla <manzanillawork@gmail.com>2021-09-28 20:33:06 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-09-28 23:00:17 +0300
commitf84fb12f5d72433780a96c3cc4381399f153cf1a (patch)
tree62ca25765b3b5ccc2bc8ca35449ddd8f3999071a /source/blender/compositor/operations/COM_TransformOperation.h
parent76377f0176b9561a7fc8f46b4ed704c631ddd90d (diff)
Compositor: Add support for canvas compositing
This commit adds functionality for operations that require pixel translation or resizing on "Full Frame" mode, allowing to adjust their canvas. It fixes most cropping issues in translate, scale, rotate and transform nodes by adjusting their canvas to the result, instead of the input canvas. Operations output buffer is still always on (0,0) position for easier image algorithm implementation, even when the canvas is not. Current limitations (will be addressed on bcon2): - Displayed translation in Viewer node is limited to 6000px. - When scaling up the canvas size is limited to the scene resolution size x 1.5 . From that point it crops. If none of these limitations are hit, the Viewer node displays the full input with any translation. Differential Revision: https://developer.blender.org/D12466
Diffstat (limited to 'source/blender/compositor/operations/COM_TransformOperation.h')
-rw-r--r--source/blender/compositor/operations/COM_TransformOperation.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/compositor/operations/COM_TransformOperation.h b/source/blender/compositor/operations/COM_TransformOperation.h
index 480998a0207..3c5584a1bea 100644
--- a/source/blender/compositor/operations/COM_TransformOperation.h
+++ b/source/blender/compositor/operations/COM_TransformOperation.h
@@ -30,15 +30,14 @@ class TransformOperation : public MultiThreadedOperation {
constexpr static int DEGREE_INPUT_INDEX = 3;
constexpr static int SCALE_INPUT_INDEX = 4;
- float scale_center_x_;
- float scale_center_y_;
- float rotate_center_x_;
- float rotate_center_y_;
float rotate_cosine_;
float rotate_sine_;
- float translate_x_;
- float translate_y_;
- float constant_scale_;
+ int translate_x_;
+ int translate_y_;
+ float scale_;
+ rcti scale_canvas_;
+ rcti rotate_canvas_;
+ rcti translate_canvas_;
/* Set variables. */
PixelSampler sampler_;
@@ -46,6 +45,7 @@ class TransformOperation : public MultiThreadedOperation {
float translate_factor_x_;
float translate_factor_y_;
bool invert_;
+ Size2f max_scale_canvas_size_;
public:
TransformOperation();
@@ -71,16 +71,18 @@ class TransformOperation : public MultiThreadedOperation {
invert_ = value;
}
+ void set_scale_canvas_max_size(Size2f size);
+
void init_data() override;
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
+ void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
+
private:
- /** Translate -> Rotate -> Scale. */
void transform(BuffersIterator<float> &it, const MemoryBuffer *input_img);
- /** Scale -> Rotate -> Translate. */
void transform_inverted(BuffersIterator<float> &it, const MemoryBuffer *input_img);
};