4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2008,2009 Intel Corporation.
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.
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.
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/>.
24 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <cogl/cogl.h> can be included directly."
28 #ifndef __COGL_PATH_H__
29 #define __COGL_PATH_H__
31 #include <cogl/cogl-types.h>
37 * @short_description: Functions for constructing and drawing 2D paths.
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.
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.
54 typedef struct _CoglPath CoglPath;
56 #define COGL_PATH(obj) ((CoglPath *)(obj))
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"/>.
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
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.
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"/>
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"/>
96 COGL_PATH_FILL_RULE_NON_ZERO,
97 COGL_PATH_FILL_RULE_EVEN_ODD
102 #include "cogl-path-functions.h"
104 #endif /* __COGL_PATH_H__ */