1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
11 #ifndef __MOON_POINT_H__
12 #define __MOON_POINT_H__
23 Point () : x(0), y(0) {}
25 Point (double x
, double y
)
31 Point
operator+ (const Point
&point
)
33 return Point (x
+ point
.x
,
37 Point
operator- (const Point
&point
)
39 return Point (x
- point
.x
,
43 Point
operator* (double v
)
45 return Point (x
* v
, y
* v
);
48 bool operator == (const Point
&point
) const
50 return fabs (point
.x
-x
) < DBL_EPSILON
&& fabs (point
.y
-y
) < DBL_EPSILON
;
53 bool operator != (const Point
&point
) const
55 return !(*this == point
);
58 Point
Transform (cairo_matrix_t
*matrix
);
62 // Parses @s and return a new point in @p. Returns true if
63 // this was successful, false otherwise.
65 static bool FromStr (const char *s
, Point
*p
);
68 #endif /* __MOON_POINT_H__ */