2 Copyright (C) 2021 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/>.
22 #ifndef DCPOMATIC_PIXEL_QUANTA_H
23 #define DCPOMATIC_PIXEL_QUANTA_H
28 #include <libcxml/cxml.h>
29 #include <dcp/types.h>
30 DCPOMATIC_DISABLE_WARNINGS
31 #include <libxml++/libxml++.h>
32 DCPOMATIC_ENABLE_WARNINGS
43 /** @param x number of pixels that must not be split in the x direction; e.g. if x=2 scale should
44 * only happen to multiples of 2 width, and x crop should only happen at multiples of 2 position.
45 * @param y similar value for y / height.
47 PixelQuanta (int x_, int y_)
52 PixelQuanta (cxml::ConstNodePtr node);
54 void as_xml (xmlpp::Element* node) const;
56 int round_x (int x_) const;
57 int round_y (int y_) const;
58 dcp::Size round (dcp::Size size) const;
65 PixelQuanta max (PixelQuanta const& a, PixelQuanta const& b);