]> git.sesse.net Git - casparcg/blob - core/mixer/image/image_mixer.h
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[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_uv(double left, double top, double right, double bottom);\r
33         std::array<double, 4> get_uv() const;\r
34 \r
35         void set_mode(video_mode::type mode);\r
36         video_mode::type get_mode() const;\r
37 \r
38         image_transform& operator*=(const image_transform &other);\r
39         const image_transform operator*(const image_transform &other) const;\r
40 private:\r
41         double opacity_;\r
42         double gain_;\r
43         std::array<double, 2> pos_;\r
44         std::array<double, 4> uv_;\r
45         video_mode::type mode_;\r
46 };\r
47 \r
48 class image_mixer : boost::noncopyable\r
49 {\r
50 public:\r
51         image_mixer(const video_format_desc& format_desc);\r
52 \r
53         void begin(const image_transform& transform);\r
54         void process(const pixel_format_desc& desc, std::vector<safe_ptr<host_buffer>>& buffers);\r
55         void end();\r
56 \r
57         boost::unique_future<safe_ptr<const host_buffer>> begin_pass();\r
58         void end_pass();\r
59 \r
60         std::vector<safe_ptr<host_buffer>> create_buffers(const pixel_format_desc& format);\r
61 \r
62 private:\r
63         struct implementation;\r
64         std::shared_ptr<implementation> impl_;\r
65 };\r
66 \r
67 }}