]> git.sesse.net Git - casparcg/blob - core/mixer/image/image_mixer.h
2.0.0.2: Added CLIP_RECT and FIX_RECT commands. TODO: Does not work properly with...
[casparcg] / core / mixer / image / image_mixer.h
1 #pragma once\r
2 \r
3 #include "../gpu/host_buffer.h"\r
4 \r
5 #include "../../video_format.h"\r
6 \r
7 #include <boost/tuple/tuple.hpp>\r
8 #include <boost/thread/future.hpp>\r
9 #include <boost/noncopyable.hpp>\r
10 \r
11 #include <memory>\r
12 #include <array>\r
13 \r
14 namespace caspar { namespace core {\r
15 \r
16 struct pixel_format_desc;\r
17         \r
18 class image_transform \r
19 {\r
20 public:\r
21         image_transform();\r
22 \r
23         void set_opacity(double value);\r
24         double get_opacity() const;\r
25 \r
26         void set_gain(double value);\r
27         double get_gain() const;\r
28 \r
29         void set_position(double x, double y);\r
30         std::array<double, 2> get_position() const;\r
31 \r
32         void set_size(double x, double ys);\r
33         std::array<double, 2> get_size() const; \r
34 \r
35         void set_uv(double left, double top, double right, double bottom);\r
36         std::array<double, 4> get_uv() const;\r
37 \r
38         void set_mode(video_mode::type mode);\r
39         video_mode::type get_mode() const;\r
40 \r
41         image_transform& operator*=(const image_transform &other);\r
42         const image_transform operator*(const image_transform &other) const;\r
43 private:\r
44         double opacity_;\r
45         double gain_;\r
46         std::array<double, 2> pos_;\r
47         std::array<double, 2> size_;\r
48         std::array<double, 4> uv_;\r
49         video_mode::type mode_;\r
50 };\r
51 \r
52 class image_mixer : boost::noncopyable\r
53 {\r
54 public:\r
55         image_mixer(const video_format_desc& format_desc);\r
56 \r
57         void begin(const image_transform& transform);\r
58         void process(const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>>& buffers);\r
59         void end();\r
60 \r
61         boost::unique_future<safe_ptr<const host_buffer>> begin_pass();\r
62         void end_pass();\r
63 \r
64         std::vector<safe_ptr<host_buffer>> create_buffers(const pixel_format_desc& format);\r
65 \r
66 private:\r
67         struct implementation;\r
68         std::shared_ptr<implementation> impl_;\r
69 };\r
70 \r
71 }}