X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Fpoly.h;h=3129ee2c036fff455ac856e3c26c4e861bf0b1ab;hp=7ef125cf521554758fb4cacfb2592598c6db2a06;hb=42bba07c1573e32b0cf504e76619fd1bd0eb3dcd;hpb=336f6de943b8c0bbeb0f64b7e35dd9511147a20a diff --git a/lib/gfxpoly/poly.h b/lib/gfxpoly/poly.h index 7ef125c..3129ee2 100644 --- a/lib/gfxpoly/poly.h +++ b/lib/gfxpoly/poly.h @@ -5,33 +5,25 @@ #include "../q.h" #include "../types.h" -//#define DEBUG -#define CHECKS +/* features */ #define SPLAY +#define DONT_REMEMBER_CROSSINGS typedef enum {DIR_UP, DIR_DOWN, DIR_UNKNOWN} segment_dir_t; typedef enum {EVENT_CROSS, EVENT_END, EVENT_START, EVENT_HORIZONTAL} eventtype_t; typedef enum {SLOPE_POSITIVE, SLOPE_NEGATIVE} slope_t; +#define INVALID_COORD (0x7fffffff) typedef struct _point { int32_t x; int32_t y; } point_t; +type_t point_type; typedef struct _fillstyle { - char is_filled; + void*internal; } 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; @@ -55,15 +47,16 @@ typedef struct _windrule typedef struct _gfxpolystroke { segment_dir_t dir; + int points_size; int num_points; point_t*points; fillstyle_t*fs; + struct _gfxpolystroke*next; } gfxpolystroke_t; -typedef struct _gfxcompactpoly { +typedef struct _gfxpoly { double gridsize; - int num_strokes; gfxpolystroke_t*strokes; -} gfxcompactpoly_t; +} gfxpoly_t; typedef struct _segment { point_t a; @@ -97,7 +90,9 @@ typedef struct _segment { gfxpolystroke_t*stroke; int stroke_pos; +#ifndef DONT_REMEMBER_CROSSINGS dict_t scheduled_crossings; +#endif } segment_t; #define LINE_EQ(p,s) ((double)(s)->delta.y*(p).x - (double)(s)->delta.x*(p).y - (s)->k) @@ -116,19 +111,17 @@ 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; - void gfxpoly_fail(char*expr, char*file, int line, const char*function); -gfxpoly_t* gfxpoly_new(double gridsize); -char gfxcompactpoly_check(gfxcompactpoly_t*poly); -int gfxcompactpoly_size(gfxcompactpoly_t*poly); -void gfxcompactpoly_dump(gfxcompactpoly_t*poly); -void gfxcompactpoly_save(gfxcompactpoly_t*poly, const char*filename); -gfxpoly_t* gfxpoly_process(gfxcompactpoly_t*poly, windrule_t*windrule, windcontext_t*context); +char gfxpoly_check(gfxpoly_t*poly); +int gfxpoly_num_segments(gfxpoly_t*poly); +int gfxpoly_size(gfxpoly_t*poly); +void gfxpoly_dump(gfxpoly_t*poly); +void gfxpoly_save(gfxpoly_t*poly, const char*filename); +gfxpoly_t* gfxpoly_process(gfxpoly_t*poly1, gfxpoly_t*poly2, windrule_t*windrule, windcontext_t*context); + +gfxpoly_t* gfxpoly_intersect(gfxpoly_t*p1, gfxpoly_t*p2); +gfxpoly_t* gfxpoly_union(gfxpoly_t*p1, gfxpoly_t*p2); #ifndef CHECKS #ifdef assert