X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Fwind.h;h=e1926ed8fe3fecf0ba8c1762ca77c49d3320f372;hp=e057544df2cec44f0ba80ae99a253ebf2c3a1f9a;hb=678260583255100b0dce559e0f8f2f813e6f162e;hpb=e5ec9f136f070b7e824e223c0b67e28efd8c70f0 diff --git a/lib/gfxpoly/wind.h b/lib/gfxpoly/wind.h index e057544..e1926ed 100644 --- a/lib/gfxpoly/wind.h +++ b/lib/gfxpoly/wind.h @@ -1,20 +1,41 @@ #ifndef __wind_h__ #define __wind_h__ -#include "poly.h" +/* Every segment has an original direction, which is the direction + the segment had in the input data. + as our scanline moves from minimum y to maximum y, "DOWN" means + the the (original) segment's y2 is larger than its y1 */ +typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t; + +#define DIR_INVERT(d) ((d)^=(DIR_UP^DIR_DOWN)) + +typedef struct _edgestyle { + void*internal; +} edgestyle_t; + +extern edgestyle_t edgestyle_default; typedef struct _windstate { char is_filled; + int wind_nr; } windstate_t; +typedef struct _windcontext +{ + int num_polygons; +} windcontext_t; + typedef struct _windrule { - windstate_t* (*add)(windstate_t*left, fillstyle_t*edge, segment_dir_t dir, gfxpoly_t*master); - fillstyle_t* (*diff)(windstate_t*left, windstate_t*right); + windstate_t (*start)(windcontext_t* num_polygons); + windstate_t (*add)(windcontext_t*context, windstate_t left, edgestyle_t*edge, segment_dir_t dir, int polygon_nr); + edgestyle_t* (*diff)(windstate_t*left, windstate_t*right); } windrule_t; -windrule_t* windrule_new_evenodd(); -windrule_t* windrule_new_circular(); +extern windrule_t windrule_evenodd; +extern windrule_t windrule_circular; +extern windrule_t windrule_intersect; +extern windrule_t windrule_union; #endif