X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxtools.h;h=24deef0e2239b4fd9bd9fea287b87dc7e72aae90;hp=1e9bf70558eaf8e0caa2de35e92353847ce8f15f;hb=395359a0831639fcc30aab4ea897e23ff8ab420c;hpb=a820344c783a6d2876799fced4b4c047112fea6a diff --git a/lib/gfxtools.h b/lib/gfxtools.h index 1e9bf70..24deef0 100644 --- a/lib/gfxtools.h +++ b/lib/gfxtools.h @@ -27,8 +27,8 @@ extern "C" { #endif -//#include "../lib/mem.h" -#include "../lib/rfxswf.h" +#include +#include "../lib/mem.h" #include "../lib/gfxdevice.h" typedef struct _gfxdrawer @@ -38,6 +38,7 @@ typedef struct _gfxdrawer void (*moveTo)(struct _gfxdrawer*d, gfxcoord_t x, gfxcoord_t y); void (*lineTo)(struct _gfxdrawer*d, gfxcoord_t x, gfxcoord_t y); void (*splineTo)(struct _gfxdrawer*d, gfxcoord_t sx, gfxcoord_t sy, gfxcoord_t x, gfxcoord_t y); + void (*close)(struct _gfxdrawer*d); void* (*result)(struct _gfxdrawer*d); } gfxdrawer_t; @@ -46,19 +47,73 @@ typedef struct _gfxpoint gfxcoord_t x,y; } gfxpoint_t; +typedef struct _gfxfontlist +{ + gfxfont_t*font; + void*user; + struct _gfxfontlist*next; +} gfxfontlist_t; + void gfxdrawer_target_gfxline(gfxdrawer_t*d); void gfxtool_draw_dashed_line(gfxdrawer_t*d, gfxline_t*line, float*dashes, float phase); gfxline_t* gfxtool_dash_line(gfxline_t*line, float*dashes, float phase); void gfxline_dump(gfxline_t*l, FILE*fi, char*prefix); +gfxline_t* gfxline_append(gfxline_t*line1, gfxline_t*line2); void gfxline_free(gfxline_t*l); +gfxline_t* gfxline_clone(gfxline_t*line); +void gfxline_optimize(gfxline_t*line); -void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, double c2y, double x, double y); +void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, double c2y, double x, double y, double quality); +void gfxdraw_conicTo(gfxdrawer_t*draw, double cx, double cy, double tox, double toy, double quality); gfxbbox_t gfxline_getbbox(gfxline_t*line); gfxbbox_t gfxbbox_expand_to_point(gfxbbox_t box, gfxcoord_t x, gfxcoord_t y); - +void gfxbbox_intersect(gfxbbox_t*box1, gfxbbox_t*box2); + +void gfxline_transform(gfxline_t*line, gfxmatrix_t*matrix); + +/* tries to remove unnecessary moveTos from the gfxline */ +gfxline_t* gfxline_restitch(gfxline_t*line); +/* reverses in place */ +gfxline_t* gfxline_reverse(gfxline_t*line); + +void gfxmatrix_dump(gfxmatrix_t*l, FILE*fi, char*prefix); +void gfxmatrix_transform(gfxmatrix_t*m, gfxcoord_t* v1, gfxcoord_t*dest); +void gfxmatrix_invert(gfxmatrix_t*src, gfxmatrix_t*dest); +void gfxmatrix_unit(gfxmatrix_t*m); +void gfxmatrix_multiply(gfxmatrix_t*m1, gfxmatrix_t*m2, gfxmatrix_t*dest); + +gfxfontlist_t* gfxfontlist_create(); +gfxfontlist_t*gfxfontlist_addfont(gfxfontlist_t*list, gfxfont_t*font); +gfxfontlist_t*gfxfontlist_addfont2(gfxfontlist_t*list, gfxfont_t*font, void*user); +gfxfont_t*gfxfontlist_findfont(gfxfontlist_t*list, char*id); +char gfxfontlist_hasfont(gfxfontlist_t*list, gfxfont_t*font); +void* gfxfontlist_getuserdata(gfxfontlist_t*list, const char*id); +void gfxfontlist_free(gfxfontlist_t*list, char deletefonts); + +gfxbbox_t* gfxline_isrectangle(gfxline_t*_l); +gfxbbox_t gfxbbox_expand_to_bbox(gfxbbox_t box, gfxbbox_t box2); + +gfxline_t*gfxline_makerectangle(double x1, double y1, double x2, double y2); +gfxline_t*gfxline_makecircle(double x,double y,double rx, double ry); +void gfxline_show(gfxline_t*line, FILE*fi); + +void gfxgradient_destroy(gfxgradient_t*gradient); + +typedef struct _gfxparam { + const char*key; + const char*value; + struct _gfxparam* next; +} gfxparam_t; +typedef struct _gfxparams { + gfxparam_t*params; + gfxparam_t*last; +} gfxparams_t; +gfxparams_t* gfxparams_new(); +void gfxparams_store(gfxparams_t*params, const char*name, const char*value); +void gfxparams_free(gfxparams_t*params); #ifdef __cplusplus }