more horizontal refactoring
[swftools.git] / lib / gfxpoly / wind.h
1 #ifndef __wind_h__
2 #define __wind_h__
3
4 /* Every segment has an original direction, which is the direction
5    the segment had in the input data.
6    as our scanline moves from minimum y to maximum y, "DOWN" means
7    the the (original) segment's y2 is larger than its y1 */
8 typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t;
9
10 #define DIR_INVERT(d) ((d)^=(DIR_UP^DIR_DOWN))
11
12 typedef struct _edgestyle {
13     void*internal;
14 } edgestyle_t;
15
16 extern edgestyle_t edgestyle_default;
17
18 typedef struct _windstate
19 {
20     char is_filled;
21     int wind_nr;
22 } windstate_t;
23
24 typedef struct _windcontext
25 {
26     int num_polygons;
27 } windcontext_t;
28
29 typedef struct _windrule
30 {
31     windstate_t (*start)(windcontext_t* num_polygons);
32     windstate_t (*add)(windcontext_t*context, windstate_t left, edgestyle_t*edge, segment_dir_t dir, int polygon_nr);
33     edgestyle_t* (*diff)(windstate_t*left, windstate_t*right);
34 } windrule_t;
35
36 extern windrule_t windrule_evenodd;
37 extern windrule_t windrule_circular;
38 extern windrule_t windrule_intersect;
39 extern windrule_t windrule_union;
40
41 #endif