]> git.sur5r.net Git - glabels/blob - src/cairo-ellipse-path.c
Imported Upstream version 3.0.0
[glabels] / src / cairo-ellipse-path.c
1 /*
2  *  cairo-ellipse-path.c
3  *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of gLabels.
6  *
7  *  gLabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  gLabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include <config.h>
22
23 #include "cairo-ellipse-path.h"
24
25 #include <math.h>
26
27 #include "debug.h"
28
29
30 /*===========================================*/
31 /* Private macros and constants.             */
32 /*===========================================*/
33
34 #define ARC_FINE   2
35
36
37 /*===========================================*/
38 /* Private types                             */
39 /*===========================================*/
40
41
42 /*===========================================*/
43 /* Private globals                           */
44 /*===========================================*/
45
46
47 /*===========================================*/
48 /* Local function prototypes                 */
49 /*===========================================*/
50
51
52 /*****************************************************************************/
53 /* Create ellipse path                                                       */
54 /*****************************************************************************/
55 void
56 gl_cairo_ellipse_path (cairo_t           *cr,
57                        gdouble            rx,
58                        gdouble            ry)
59 {
60         gdouble x, y;
61         gint i_theta;
62
63         gl_debug (DEBUG_VIEW, "START");
64
65         cairo_new_path (cr);
66         cairo_move_to (cr, 2*rx, ry);
67         for (i_theta = ARC_FINE; i_theta <= 360; i_theta += ARC_FINE) {
68                 x = rx + rx * cos (i_theta * G_PI / 180.0);
69                 y = ry + ry * sin (i_theta * G_PI / 180.0);
70                 cairo_line_to (cr, x, y);
71         }
72         cairo_close_path (cr);
73
74         gl_debug (DEBUG_VIEW, "END");
75 }
76
77
78
79 /*
80  * Local Variables:       -- emacs
81  * mode: C                -- emacs
82  * c-basic-offset: 8      -- emacs
83  * tab-width: 8           -- emacs
84  * indent-tabs-mode: nil  -- emacs
85  * End:                   -- emacs
86  */