cleanup specfile for packaging
[profile/ivi/cogl.git] / cogl / cogl-path.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2008,2009 Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  *
22  */
23
24 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <cogl/cogl.h> can be included directly."
26 #endif
27
28 #ifndef __COGL_PATH_H__
29 #define __COGL_PATH_H__
30
31 #include <cogl/cogl-types.h>
32
33 G_BEGIN_DECLS
34
35 /**
36  * SECTION:cogl-paths
37  * @short_description: Functions for constructing and drawing 2D paths.
38  *
39  * There are two levels on which drawing with cogl-paths can be used.
40  * The highest level functions construct various simple primitive
41  * shapes to be either filled or stroked. Using a lower-level set of
42  * functions more complex and arbitrary paths can be constructed by
43  * concatenating straight line, bezier curve and arc segments.
44  *
45  * When constructing arbitrary paths, the current pen location is
46  * initialized using the move_to command. The subsequent path segments
47  * implicitly use the last pen location as their first vertex and move
48  * the pen location to the last vertex they produce at the end. Also
49  * there are special versions of functions that allow specifying the
50  * vertices of the path segments relative to the last pen location
51  * rather then in the absolute coordinates.
52  */
53
54 typedef struct _CoglPath CoglPath;
55
56 #define COGL_PATH(obj) ((CoglPath *)(obj))
57
58 /**
59  * CoglPathFillRule:
60  * @COGL_PATH_FILL_RULE_NON_ZERO: Each time the line crosses an edge of
61  * the path from left to right one is added to a counter and each time
62  * it crosses from right to left the counter is decremented. If the
63  * counter is non-zero then the point will be filled. See <xref
64  * linkend="fill-rule-non-zero"/>.
65  * @COGL_PATH_FILL_RULE_EVEN_ODD: If the line crosses an edge of the
66  * path an odd number of times then the point will filled, otherwise
67  * it won't. See <xref linkend="fill-rule-even-odd"/>.
68  *
69  * #CoglPathFillRule is used to determine how a path is filled. There
70  * are two options - 'non-zero' and 'even-odd'. To work out whether any
71  * point will be filled imagine drawing an infinetely long line in any
72  * direction from that point. The number of times and the direction
73  * that the edges of the path crosses this line determines whether the
74  * line is filled as described below. Any open sub paths are treated
75  * as if there was an extra line joining the first point and the last
76  * point.
77  *
78  * The default fill rule is %COGL_PATH_FILL_RULE_EVEN_ODD. The fill
79  * rule is attached to the current path so preserving a path with
80  * cogl_get_path() also preserves the fill rule. Calling
81  * cogl_path_new() resets the current fill rule to the default.
82  *
83  * <figure id="fill-rule-non-zero">
84  *   <title>Example of filling various paths using the non-zero rule</title>
85  *   <graphic fileref="fill-rule-non-zero.png" format="PNG"/>
86  * </figure>
87  *
88  * <figure id="fill-rule-even-odd">
89  *   <title>Example of filling various paths using the even-odd rule</title>
90  *   <graphic fileref="fill-rule-even-odd.png" format="PNG"/>
91  * </figure>
92  *
93  * Since: 1.4
94  */
95 typedef enum {
96   COGL_PATH_FILL_RULE_NON_ZERO,
97   COGL_PATH_FILL_RULE_EVEN_ODD
98 } CoglPathFillRule;
99
100 G_END_DECLS
101
102 #include "cogl-path-functions.h"
103
104 #endif /* __COGL_PATH_H__ */
105