2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2011 Blender Foundation. */
|
2020-10-22 11:13:34 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-08-23 15:28:08 +02:00
|
|
|
#include "COM_MultiThreadedOperation.h"
|
2020-10-22 11:13:34 +02:00
|
|
|
|
2021-03-23 17:12:27 +01:00
|
|
|
namespace blender::compositor {
|
|
|
|
|
|
2020-10-22 11:13:34 +02:00
|
|
|
/**
|
2021-01-05 16:16:18 +01:00
|
|
|
* This operation will apply a mask to its input image.
|
|
|
|
|
*
|
|
|
|
|
* `output color.rgba = input color.rgba * input alpha`
|
2020-10-22 11:13:34 +02:00
|
|
|
*/
|
2021-08-23 15:28:08 +02:00
|
|
|
class SetAlphaMultiplyOperation : public MultiThreadedOperation {
|
2020-10-22 11:13:34 +02:00
|
|
|
private:
|
2021-10-13 23:01:15 +02:00
|
|
|
SocketReader *input_color_;
|
|
|
|
|
SocketReader *input_alpha_;
|
2020-10-22 11:13:34 +02:00
|
|
|
|
|
|
|
|
public:
|
2021-01-05 16:16:18 +01:00
|
|
|
SetAlphaMultiplyOperation();
|
2020-10-22 11:13:34 +02:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
2020-10-22 11:13:34 +02:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
void init_execution() override;
|
|
|
|
|
void deinit_execution() override;
|
2021-08-23 15:28:08 +02:00
|
|
|
|
|
|
|
|
void update_memory_buffer_partial(MemoryBuffer *output,
|
|
|
|
|
const rcti &area,
|
|
|
|
|
Span<MemoryBuffer *> inputs) override;
|
2020-10-22 11:13:34 +02:00
|
|
|
};
|
2021-03-23 17:12:27 +01:00
|
|
|
|
|
|
|
|
} // namespace blender::compositor
|