41 #include "filesystem.h"
46 using std::dynamic_pointer_cast;
48 using std::shared_ptr;
65 :
Text(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time)
66 , _png_image (png_image)
86 :
Text(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time)
87 , _png_image (png_image)
95 TextImage::read_png_file(boost::filesystem::path file)
103 TextImage::write_png_file(boost::filesystem::path file)
const
106 png_image().write (
file);
114 a.png_image() == b.png_image() &&
118 a.h_position() == b.h_position() &&
119 a.h_align() == b.h_align() &&
121 a.v_align() == b.v_align() &&
122 a.z_position() == b.z_position() &&
123 a.fade_up_time() == b.fade_up_time() &&
124 a.fade_down_time() == b.fade_down_time()
137 TextImage::equals(shared_ptr<const Text> other_sub,
EqualityOptions const& options, NoteHandler note)
const
139 if (!Text::equals(other_sub, options, note)) {
143 auto other = dynamic_pointer_cast<const TextImage>(other_sub);
145 note(NoteType::ERROR,
"Text types differ: string vs image");
149 if (png_image() != other->png_image()) {
150 note (NoteType::ERROR,
"text image PNG data differs");
152 string const base =
"dcpdiff_text_";
153 if (filesystem::exists(base +
"A.png")) {
154 note (NoteType::ERROR,
"could not export text as " + base +
"A.png already exists");
156 png_image().write(base +
"A.png");
158 if (filesystem::exists(base +
"B.png")) {
159 note (NoteType::ERROR,
"could not export text as " + base +
"B.png already exists");
161 other->png_image().write(base +
"B.png");
172 dcp::operator<<(ostream& s,
TextImage const& text)
174 s <<
"\n[IMAGE] from " << text.
in() <<
" to " << text.
out() <<
";\n"
175 <<
"fade up " << text.fade_up_time() <<
", fade down " << text.fade_down_time() <<
";\n"
176 <<
"v pos " << text.
v_position() <<
", valign " << ((int) text.v_align())
177 <<
", hpos " << text.h_position() <<
", halign " << ((int) text.h_align())
178 <<
", zpos " << text.z_position() <<
"\n";
Class to hold an arbitrary block of data.
A class to describe what "equality" means for a particular test.
bool export_differing_texts
A bitmap subtitle or caption with all the associated attributes.
boost::optional< boost::filesystem::path > file() const
A representation of time within a DCP.
Class to describe what equality means when calling Asset::equals().
Namespace for everything in libdcp.
Utility methods and classes.