It builds again.
[libdcp.git] / src / subtitle_string.h
1 /*
2     Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "types.h"
21 #include "dcp_time.h"
22 #include <string>
23
24 namespace dcp {
25
26 class SubtitleString
27 {
28 public:
29         SubtitleString (
30                 std::string font,
31                 bool italic,
32                 Color color,
33                 int size,
34                 Time in,
35                 Time out,
36                 float v_position,
37                 VAlign v_align,
38                 std::string text,
39                 Effect effect,
40                 Color effect_color,
41                 Time fade_up_time,
42                 Time fade_down_time
43                 );
44
45         std::string font () const {
46                 return _font;
47         }
48
49         bool italic () const {
50                 return _italic;
51         }
52
53         Color color () const {
54                 return _color;
55         }
56
57         Time in () const {
58                 return _in;
59         }
60
61         Time out () const {
62                 return _out;
63         }
64
65         std::string text () const {
66                 return _text;
67         }
68
69         float v_position () const {
70                 return _v_position;
71         }
72
73         VAlign v_align () const {
74                 return _v_align;
75         }
76
77         Effect effect () const {
78                 return _effect;
79         }
80
81         Color effect_color () const {
82                 return _effect_color;
83         }
84
85         Time fade_up_time () const {
86                 return _fade_up_time;
87         }
88
89         Time fade_down_time () const {
90                 return _fade_down_time;
91         }
92
93         int size () const {
94                 return _size;
95         }
96         
97         int size_in_pixels (int screen_height) const;
98
99 private:
100         std::string _font;
101         bool _italic;
102         Color _color;
103         /** Size in points as if the screen height is 11 inches, so a 72pt font
104          *  would be 1/11th of the screen height.
105          */ 
106         int _size;
107         Time _in;
108         Time _out;
109         /** Vertical position as a proportion of the screen height from the top
110          *  (between 0 and 1)
111          */
112         float _v_position;
113         VAlign _v_align;
114         std::string _text;
115         Effect _effect;
116         Color _effect_color;
117         Time _fade_up_time;
118         Time _fade_down_time;
119 };
120
121 bool operator== (SubtitleString const & a, SubtitleString const & b);
122 std::ostream& operator<< (std::ostream& s, SubtitleString const & sub);
123
124 }