fixed off-by-one bug
[swftools.git] / lib / gfxpoly / wind.h
bloba07ed6424d4285924f41f255cd58fee38b9ed2ba
1 #ifndef __wind_h__
2 #define __wind_h__
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;
10 #define DIR_INVERT(d) ((d)^(DIR_UP^DIR_DOWN))
12 typedef struct _edgestyle {
13 void*internal;
14 } edgestyle_t;
16 extern edgestyle_t edgestyle_default;
18 typedef struct _windstate
20 char is_filled;
21 int wind_nr;
22 } windstate_t;
24 typedef struct _windcontext
26 int num_polygons;
27 } windcontext_t;
29 typedef struct _windrule
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;
36 extern windrule_t windrule_evenodd;
37 extern windrule_t windrule_circular;
38 extern windrule_t windrule_intersect;
39 extern windrule_t windrule_union;
41 #endif