Blame src/lib/Coordinate.h

rpm-build 9243a4
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
rpm-build 9243a4
/*
rpm-build 9243a4
 * This file is part of the libmspub project.
rpm-build 9243a4
 *
rpm-build 9243a4
 * This Source Code Form is subject to the terms of the Mozilla Public
rpm-build 9243a4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
rpm-build 9243a4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
rpm-build 9243a4
 */
rpm-build 9243a4
rpm-build 9243a4
#ifndef INCLUDED_COORDINATE_H
rpm-build 9243a4
#define INCLUDED_COORDINATE_H
rpm-build 9243a4
rpm-build 9243a4
#include "MSPUBConstants.h"
rpm-build 9243a4
rpm-build 9243a4
namespace libmspub
rpm-build 9243a4
{
rpm-build 9243a4
struct Coordinate
rpm-build 9243a4
{
rpm-build 9243a4
  Coordinate(int xs, int ys, int xe, int ye) : m_xs(xs), m_ys(ys), m_xe(xe), m_ye(ye) { }
rpm-build 9243a4
  Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { }
rpm-build 9243a4
  int m_xs, m_ys, m_xe, m_ye;
rpm-build 9243a4
  double getXIn(double pageWidth) const
rpm-build 9243a4
  {
rpm-build 9243a4
    return pageWidth / 2 + double(m_xs) / EMUS_IN_INCH;
rpm-build 9243a4
  }
rpm-build 9243a4
  double getYIn(double pageHeight) const
rpm-build 9243a4
  {
rpm-build 9243a4
    return pageHeight / 2 + double(m_ys) / EMUS_IN_INCH;
rpm-build 9243a4
  }
rpm-build 9243a4
  double getWidthIn() const
rpm-build 9243a4
  {
rpm-build 9243a4
    return double(int64_t(m_xe) - m_xs) / EMUS_IN_INCH;
rpm-build 9243a4
  }
rpm-build 9243a4
  double getHeightIn() const
rpm-build 9243a4
  {
rpm-build 9243a4
    return double(int64_t(m_ye) - m_ys) / EMUS_IN_INCH;
rpm-build 9243a4
  }
rpm-build 9243a4
};
rpm-build 9243a4
}
rpm-build 9243a4
#endif
rpm-build 9243a4
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */