2 Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic 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.
11 DCP-o-matic 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.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "bitmap_text.h"
23 #include "dcpomatic_socket.h"
24 #include <dcp/raw_convert.h>
26 using boost::shared_ptr;
27 using dcp::raw_convert;
30 operator== (BitmapText const & a, BitmapText const & b)
32 if (!a.rectangle.equal(b.rectangle, 0.000001)) {
36 return *a.image == *b.image;
40 operator!= (BitmapText const & a, BitmapText const & b)
46 BitmapText::transfer_xml (xmlpp::Node* node) const
48 node->add_child("Width")->add_child_text(raw_convert<std::string>(image->size().width));
49 node->add_child("Height")->add_child_text(raw_convert<std::string>(image->size().height));
50 node->add_child("RectX")->add_child_text(raw_convert<std::string>(rectangle.x));
51 node->add_child("RectY")->add_child_text(raw_convert<std::string>(rectangle.y));
52 node->add_child("RectWidth")->add_child_text(raw_convert<std::string>(rectangle.width));
53 node->add_child("RectHeight")->add_child_text(raw_convert<std::string>(rectangle.height));
57 BitmapText::transfer_binary (shared_ptr<Socket> socket) const
59 image->write_to_socket (socket);