chalk

kis_point.h
1/*
2 * Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#ifndef KIS_POINT_H_
19#define KIS_POINT_H_
20
21#include <tqvaluevector.h>
22#include <KoPoint.h>
23
28class KisPoint : public KoPoint {
29 typedef KoPoint super;
30public:
31 KisPoint() {}
32 KisPoint(double x, double y) : super(x, y) {}
33 KisPoint(const TQPoint& pt) : super(pt) {}
34 KisPoint(const KoPoint& pt) : super(pt) {}
35
36 int floorX() const { return static_cast<int>(x()); }
37 int floorY() const { return static_cast<int>(y()); }
38 int roundX() const { return tqRound(x()); }
39 int roundY() const { return tqRound(y()); }
40
41 TQPoint floorTQPoint() const { return TQPoint(static_cast<int>(x()), static_cast<int>(y())); }
42 TQPoint roundTQPoint() const { return TQPoint(tqRound(x()), tqRound(y())); }
43};
44
45typedef TQValueVector<KisPoint> vKisPoint;
46
47#endif // KIS_POINT_H_
48
A double-based point class that can return it's coordinates approximated to integers.
Definition kis_point.h:28