/src/libmspub/src/lib/Coordinate.h
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libmspub project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #ifndef INCLUDED_COORDINATE_H |
11 | | #define INCLUDED_COORDINATE_H |
12 | | |
13 | | #include <cstdint> |
14 | | |
15 | | #include <boost/cstdint.hpp> |
16 | | |
17 | | #include "MSPUBConstants.h" |
18 | | |
19 | | namespace libmspub |
20 | | { |
21 | | struct Coordinate |
22 | | { |
23 | | Coordinate(int xs, int ys, int xe, int ye); |
24 | 222k | Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { } |
25 | | void arrange(); |
26 | | int m_xs, m_ys, m_xe, m_ye; |
27 | | double getXIn(double pageWidth) const |
28 | 70.6k | { |
29 | 70.6k | return pageWidth / 2 + double(m_xs) / EMUS_IN_INCH; |
30 | 70.6k | } |
31 | | double getYIn(double pageHeight) const |
32 | 70.6k | { |
33 | 70.6k | return pageHeight / 2 + double(m_ys) / EMUS_IN_INCH; |
34 | 70.6k | } |
35 | | double getWidthIn() const |
36 | 74.7k | { |
37 | 74.7k | return double(int64_t(m_xe) - m_xs) / EMUS_IN_INCH; |
38 | 74.7k | } |
39 | | double getHeightIn() const |
40 | 79.0k | { |
41 | 79.0k | return double(int64_t(m_ye) - m_ys) / EMUS_IN_INCH; |
42 | 79.0k | } |
43 | | }; |
44 | | } |
45 | | #endif |
46 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |