reworked edgestyle logic
[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 typedef struct _edgestyle {
11     void*internal;
12 } edgestyle_t;
13
14 extern edgestyle_t edgestyle_default;
15
16 typedef struct _windstate
17 {
18     char is_filled;
19     int wind_nr;
20 } windstate_t;
21
22 typedef struct _windcontext
23 {
24     int num_polygons;
25 } windcontext_t;
26
27 typedef struct _windrule
28 {
29     windstate_t (*start)(windcontext_t* num_polygons);
30     windstate_t (*add)(windcontext_t*context, windstate_t left, edgestyle_t*edge, segment_dir_t dir, int polygon_nr);
31     edgestyle_t* (*diff)(windstate_t*left, windstate_t*right);
32 } windrule_t;
33
34 extern windrule_t windrule_evenodd;
35 extern windrule_t windrule_circular;
36 extern windrule_t windrule_intersect;
37 extern windrule_t windrule_union;
38
39 #endif