X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Fpoly.h;h=417c6c12a35a3125f0bcda3a7cbc2996c8924ddc;hp=ff623d362038cdc84c8c6d44c73c7c5aeb02ba0a;hb=fec1ab31707e68c2396b186e0e4928632402d649;hpb=3513ae007a04da02f11cdca9f0d08ddda9eac245;ds=sidebyside diff --git a/lib/gfxpoly/poly.h b/lib/gfxpoly/poly.h index ff623d3..417c6c1 100644 --- a/lib/gfxpoly/poly.h +++ b/lib/gfxpoly/poly.h @@ -3,13 +3,14 @@ #include #include "../q.h" +#include "../types.h" //#define DEBUG #define CHECKS #define SPLAY typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t; -typedef enum {EVENT_CROSS, EVENT_END, EVENT_CORNER, EVENT_START, EVENT_HORIZONTAL} eventtype_t; +typedef enum {EVENT_CROSS, EVENT_END, EVENT_START, EVENT_HORIZONTAL} eventtype_t; typedef enum {SLOPE_POSITIVE, SLOPE_NEGATIVE} slope_t; typedef struct _point { @@ -21,16 +22,6 @@ typedef struct _fillstyle { char is_filled; } fillstyle_t; -typedef struct _edge { - point_t a; - point_t b; - fillstyle_t*style; -#ifdef DEBUG - int tmp; -#endif - struct _edge *next; -} edge_t; - typedef struct _windstate { char is_filled; @@ -52,6 +43,18 @@ typedef struct _windrule #define SEGNR(s) ((s)?(s)->nr:-1) +typedef struct _gfxpolystroke { + segment_dir_t dir; + int num_points; + point_t*points; + fillstyle_t*fs; + struct _gfxpolystroke*next; +} gfxpolystroke_t; +typedef struct _gfxpoly { + double gridsize; + gfxpolystroke_t*strokes; +} gfxpoly_t; + typedef struct _segment { point_t a; point_t b; @@ -68,7 +71,7 @@ typedef struct _segment { int polygon_nr; windstate_t wind; - int nr; + ptroff_t nr; #ifdef SPLAY struct _segment*parent; @@ -81,6 +84,9 @@ typedef struct _segment { point_t pos; + gfxpolystroke_t*stroke; + int stroke_pos; + dict_t scheduled_crossings; } segment_t; @@ -100,39 +106,14 @@ typedef struct _segment { #define XDIFF(s1,s2,ypos) (((s1)->k + (double)(s1)->delta.x*ypos)*(s2)->delta.y - \ ((s2)->k + (double)(s2)->delta.x*ypos)*(s1)->delta.y) -typedef struct _gfxpoly { - double gridsize; - edge_t*edges; -} gfxpoly_t; - -typedef struct _gfxstroke { - segment_dir_t dir; - int num_points; - point_t*points; - fillstyle_t*fs; -} gfxstroke_t; -typedef struct _gfxcompactpoly { - double gridsize; - int num_strokes; - gfxstroke_t*strokes; -} gfxcompactpoly_t; - void gfxpoly_fail(char*expr, char*file, int line, const char*function); -gfxpoly_t* gfxpoly_new(double gridsize); char gfxpoly_check(gfxpoly_t*poly); int gfxpoly_size(gfxpoly_t*poly); void gfxpoly_dump(gfxpoly_t*poly); -gfxpoly_t* gfxpoly_save(gfxpoly_t*poly, const char*filename); +void gfxpoly_save(gfxpoly_t*poly, const char*filename); gfxpoly_t* gfxpoly_process(gfxpoly_t*poly, windrule_t*windrule, windcontext_t*context); -typedef struct _event { - eventtype_t type; - point_t p; - segment_t*s1; - segment_t*s2; -} event_t; - #ifndef CHECKS #ifdef assert #undef assert