2009-06-17 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / src / point.cpp
bloba529bde9186b62aef951fe42640be230a9bd0937
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * point.cpp
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
8 *
9 */
11 #include <config.h>
12 #include <stdlib.h>
14 #include <glib.h>
16 #include "point.h"
17 #include "utils.h"
19 bool
20 Point::FromStr (const char *s, Point *p)
22 GArray *values = double_garray_from_str (s, 2);
24 if (!values)
25 return false;
27 *p = Point (g_array_index (values, double, 0), g_array_index (values, double, 1));
29 g_array_free (values, true);
31 return true;
34 Point
35 Point::Transform (cairo_matrix_t *matrix)
37 double nx = x;
38 double ny = y;
40 cairo_matrix_transform_point (matrix, &nx, &ny);
42 return Point (nx, ny);