]> git.sesse.net Git - casparcg/blob - core/producer/text/text_producer.h
* psd: added support for scaling and tracking in text-producer
[casparcg] / core / producer / text / text_producer.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
20 */
21
22 #pragma once
23
24 #include "../frame_producer.h"
25
26 #include <common/memory.h>
27
28 #include <boost/property_tree/ptree_fwd.hpp>
29 #include <string>
30 #include <vector>
31
32 #include "utils/color.h"
33 #include "utils/string_metrics.h"
34 #include "utils/text_info.h"
35
36 namespace caspar { namespace core {
37         namespace text 
38         {
39                 void init();
40         }
41
42 class text_producer : public frame_producer_base
43 {
44 public:
45         text_producer(const spl::shared_ptr<frame_factory>& frame_factory, int x, int y, const std::wstring& str, text::text_info& text_info, long parent_width, long parent_height, bool standalone);
46         static spl::shared_ptr<text_producer> create(const spl::shared_ptr<class frame_factory>& frame_factory, int x, int y, const std::wstring& str, text::text_info& text_info, long parent_width, long parent_height, bool standalone = false);
47         
48         draw_frame receive_impl() override;
49         boost::unique_future<std::wstring> call(const std::vector<std::wstring>& param) override;
50
51         text::string_metrics measure_string(const std::wstring& str);
52
53         constraints& pixel_constraints() override;
54         std::wstring print() const override;
55         std::wstring name() const override;
56         boost::property_tree::wptree info() const override;
57         void subscribe(const monitor::observable::observer_ptr& o) override;
58         void unsubscribe(const monitor::observable::observer_ptr& o) override;
59
60         binding<std::wstring>& text();
61         const binding<int>& current_bearing_y() const;
62         const binding<int>& current_protrude_under_y() const;
63 private:
64         struct impl;
65         spl::unique_ptr<impl> impl_;
66 };
67
68 spl::shared_ptr<frame_producer> create_text_producer(const spl::shared_ptr<class frame_factory>& frame_factory, const video_format_desc& format_desc, const std::vector<std::wstring>& params);
69
70
71 }}