46 using std::shared_ptr;
50 SubtitleImage::SubtitleImage (
61 :
Subtitle (in, out, h_position, h_align, v_position, v_align, fade_up_time, fade_down_time)
62 , _png_image (png_image)
69 SubtitleImage::SubtitleImage (
81 :
Subtitle (in, out, h_position, h_align, v_position, v_align, fade_up_time, fade_down_time)
82 , _png_image (png_image)
90 SubtitleImage::read_png_file (boost::filesystem::path file)
98 SubtitleImage::write_png_file (boost::filesystem::path file)
const
101 png_image().write (
file);
109 a.png_image() == b.png_image() &&
113 a.h_position() == b.h_position() &&
114 a.h_align() == b.h_align() &&
116 a.v_align() == b.v_align() &&
117 a.fade_up_time() == b.fade_up_time() &&
118 a.fade_down_time() == b.fade_down_time()
131 SubtitleImage::equals (shared_ptr<SubtitleImage> other,
EqualityOptions options, NoteHandler note)
133 if (png_image() != other->png_image()) {
134 note (NoteType::ERROR,
"subtitle image PNG data differs");
136 string const base =
"dcpdiff_subtitle_";
137 if (boost::filesystem::exists(base +
"A.png")) {
138 note (NoteType::ERROR,
"could not export subtitle as " + base +
"A.png already exists");
140 png_image().write(base +
"A.png");
142 if (boost::filesystem::exists(base +
"B.png")) {
143 note (NoteType::ERROR,
"could not export subtitle as " + base +
"B.png already exists");
145 other->png_image().write(base +
"B.png");
152 if (
in() != other->in()) {
153 note (NoteType::ERROR,
"subtitle in times differ");
157 if (
out() != other->out()) {
158 note (NoteType::ERROR,
"subtitle out times differ");
162 if (h_position() != other->h_position()) {
163 note (NoteType::ERROR,
"subtitle horizontal positions differ");
167 if (h_align() != other->h_align()) {
168 note (NoteType::ERROR,
"subtitle horizontal alignments differ");
173 note (NoteType::ERROR,
"subtitle vertical positions differ");
177 if (v_align() != other->v_align()) {
178 note (NoteType::ERROR,
"subtitle vertical alignments differ");
182 if (fade_up_time() != other->fade_up_time()) {
183 note (NoteType::ERROR,
"subtitle fade-up times differ");
187 if (fade_down_time() != other->fade_down_time()) {
188 note (NoteType::ERROR,
"subtitle fade-down times differ");
199 s <<
"\n[IMAGE] from " << sub.
in() <<
" to " << sub.
out() <<
";\n"
200 <<
"fade up " << sub.fade_up_time() <<
", fade down " << sub.fade_down_time() <<
";\n"
201 <<
"v pos " << sub.
v_position() <<
", valign " << ((int) sub.v_align())
202 <<
", hpos " << sub.h_position() <<
", halign " << ((int) sub.h_align()) <<
"\n";
Class to hold an arbitrary block of data.
A bitmap subtitle with all the associated attributes.
boost::optional< boost::filesystem::path > file() const
A representation of time within a DCP.
Namespace for everything in libdcp.
A class to describe what "equality" means for a particular test.
bool export_differing_subtitles
Utility methods and classes.