1 // Modern effects for a modern Streamer
2 // Copyright (C) 2019 Michael Fabian Dirks
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
17 
18 #pragma once
19 #include "common.hpp"
20 #include "obs/gs/gs-texture.hpp"
21 
22 namespace gfx {
23 	namespace blur {
24 		enum class type : int64_t {
25 			Invalid = -1,
26 			Area,
27 			Directional,
28 			Rotational,
29 			Zoom,
30 		};
31 
32 		class base {
33 			public:
~base()34 			virtual ~base() {}
35 
36 			virtual void set_input(std::shared_ptr<::gs::texture> texture) = 0;
37 
38 			virtual ::gfx::blur::type get_type() = 0;
39 
40 			virtual double_t get_size() = 0;
41 
42 			virtual void set_size(double_t width) = 0;
43 
44 			virtual void set_step_scale(double_t x, double_t y) = 0;
45 
46 			virtual void set_step_scale_x(double_t v);
47 
48 			virtual void set_step_scale_y(double_t v);
49 
50 			virtual void get_step_scale(double_t& x, double_t& y) = 0;
51 
52 			virtual double_t get_step_scale_x();
53 
54 			virtual double_t get_step_scale_y();
55 
56 			virtual std::shared_ptr<::gs::texture> render() = 0;
57 
58 			virtual std::shared_ptr<::gs::texture> get() = 0;
59 		};
60 
61 		class base_angle {
62 			public:
~base_angle()63 			virtual ~base_angle() {}
64 
65 			virtual double_t get_angle() = 0;
66 
67 			virtual void set_angle(double_t angle) = 0;
68 		};
69 
70 		class base_center {
71 			public:
~base_center()72 			virtual ~base_center() {}
73 
74 			virtual void set_center(double_t x, double_t y) = 0;
75 
76 			virtual void set_center_x(double_t v);
77 
78 			virtual void set_center_y(double_t v);
79 
80 			virtual void get_center(double_t& x, double_t& y) = 0;
81 
82 			virtual double_t get_center_x();
83 
84 			virtual double_t get_center_y();
85 		};
86 
87 		class ifactory {
88 			public:
~ifactory()89 			virtual ~ifactory() {}
90 
91 			virtual bool is_type_supported(::gfx::blur::type type) = 0;
92 
93 			virtual std::shared_ptr<::gfx::blur::base> create(::gfx::blur::type type) = 0;
94 
95 			virtual double_t get_min_size(::gfx::blur::type type) = 0;
96 
97 			virtual double_t get_step_size(::gfx::blur::type type) = 0;
98 
99 			virtual double_t get_max_size(::gfx::blur::type type) = 0;
100 
101 			virtual double_t get_min_angle(::gfx::blur::type type) = 0;
102 
103 			virtual double_t get_step_angle(::gfx::blur::type type) = 0;
104 
105 			virtual double_t get_max_angle(::gfx::blur::type type) = 0;
106 
107 			virtual bool is_step_scale_supported(::gfx::blur::type type) = 0;
108 
109 			virtual double_t get_min_step_scale_x(::gfx::blur::type type) = 0;
110 
111 			virtual double_t get_step_step_scale_x(::gfx::blur::type type) = 0;
112 
113 			virtual double_t get_max_step_scale_x(::gfx::blur::type type) = 0;
114 
115 			virtual double_t get_min_step_scale_y(::gfx::blur::type type) = 0;
116 
117 			virtual double_t get_step_step_scale_y(::gfx::blur::type type) = 0;
118 
119 			virtual double_t get_max_step_scale_y(::gfx::blur::type type) = 0;
120 		};
121 	} // namespace blur
122 } // namespace gfx
123