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