libdcp
src
text_image.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
3
4
This file is part of libdcp.
5
6
libdcp 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 2 of the License, or
9
(at your option) any later version.
10
11
libdcp 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 libdcp. If not, see <http://www.gnu.org/licenses/>.
18
19
In addition, as a special exception, the copyright holders give
20
permission to link the code of portions of this program with the
21
OpenSSL library under certain conditions as described in each
22
individual source file, and distribute linked combinations
23
including the two.
24
25
You must obey the GNU General Public License in all respects
26
for all of the code used other than OpenSSL. If you modify
27
file(s) with this exception, you may extend this exception to your
28
version of the file(s), but you are not obligated to do so. If you
29
do not wish to do so, delete this exception statement from your
30
version. If you delete this exception statement from all source
31
files in the program, then also delete it here.
32
*/
33
34
40
#ifndef LIBDCP_TEXT_IMAGE_H
41
#define LIBDCP_TEXT_IMAGE_H
42
43
44
#include "
array_data.h
"
45
#include "
text.h
"
46
#include "
dcp_time.h
"
47
#include <boost/optional.hpp>
48
#include <string>
49
50
51
namespace
dcp
{
52
53
57
class
TextImage
:
public
Text
58
{
59
public
:
60
TextImage
(
61
ArrayData
png_image,
62
Time
in
,
63
Time
out
,
64
float
h_position,
65
HAlign
h_align,
66
float
v_position
,
67
VAlign
v_align,
68
float
z_position,
69
Time
fade_up_time,
70
Time
fade_down_time
71
);
72
73
TextImage
(
74
ArrayData
png_image,
75
std::string
id
,
76
Time
in
,
77
Time
out
,
78
float
h_position,
79
HAlign
h_align,
80
float
v_position
,
81
VAlign
v_align,
82
float
z_position,
83
Time
fade_up_time,
84
Time
fade_down_time
85
);
86
87
ArrayData
png_image ()
const
{
88
return
_png_image;
89
}
90
91
void
set_png_image (
ArrayData
png) {
92
_png_image = png;
93
}
94
95
void
read_png_file (boost::filesystem::path
file
);
96
void
write_png_file (boost::filesystem::path
file
)
const
;
97
98
std::string id ()
const
{
99
return
_id;
100
}
101
103
boost::optional<boost::filesystem::path>
file
()
const
{
104
return
_file;
105
}
106
107
bool
equals(std::shared_ptr<const dcp::Text> other_text,
EqualityOptions
const
& options, NoteHandler note)
const override
;
108
109
private
:
110
ArrayData
_png_image;
111
std::string _id;
112
mutable
boost::optional<boost::filesystem::path> _file;
113
};
114
115
116
bool
operator==(TextImage
const
& a, TextImage
const
& b);
117
bool
operator!=(TextImage
const
& a, TextImage
const
& b);
118
std::ostream& operator<<(std::ostream& s, TextImage
const
& text);
119
120
121
}
122
123
124
#endif
array_data.h
ArrayData class.
dcp::ArrayData
Class to hold an arbitrary block of data.
Definition:
array_data.h:55
dcp::EqualityOptions
A class to describe what "equality" means for a particular test.
Definition:
equality_options.h:56
dcp::TextImage
A bitmap subtitle or caption with all the associated attributes.
Definition:
text_image.h:58
dcp::TextImage::file
boost::optional< boost::filesystem::path > file() const
Definition:
text_image.h:103
dcp::Text
Definition:
text.h:56
dcp::Text::in
Time in() const
Definition:
text.h:61
dcp::Text::out
Time out() const
Definition:
text.h:66
dcp::Text::v_position
float v_position() const
Definition:
text.h:82
dcp::Time
A representation of time within a DCP.
Definition:
dcp_time.h:73
dcp_time.h
Time class.
dcp
Namespace for everything in libdcp.
Definition:
array_data.h:50
dcp::HAlign
HAlign
Definition:
h_align.h:46
dcp::VAlign
VAlign
Definition:
v_align.h:46
text.h
Text class.
Generated on Tue Dec 24 2024 22:10:58 for libdcp by
1.9.1