added quality parameters
[swftools.git] / lib / gfxtools.h
1 /* gfxtools.h 
2
3    Various utility functions for dealing with gfxdevices (header file).
4
5    Part of the swftools package.
6
7    Copyright (c) 2005 Matthias Kramm <kramm@quiss.org> 
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
22
23 #ifndef __gfxtools_h__
24 #define __gfxtools_h__
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 //#include "../lib/mem.h"
31 #include "../lib/rfxswf.h"
32 #include "../lib/gfxdevice.h"
33
34 typedef struct _gfxdrawer
35 {
36     void*internal;
37     gfxcoord_t x,y;
38     void (*moveTo)(struct _gfxdrawer*d, gfxcoord_t x, gfxcoord_t y);
39     void (*lineTo)(struct _gfxdrawer*d, gfxcoord_t x, gfxcoord_t y);
40     void (*splineTo)(struct _gfxdrawer*d, gfxcoord_t sx, gfxcoord_t sy, gfxcoord_t x, gfxcoord_t y);
41     void* (*result)(struct _gfxdrawer*d);
42 } gfxdrawer_t;
43
44 typedef struct _gfxpoint
45 {
46     gfxcoord_t x,y;
47 } gfxpoint_t;
48
49 void gfxdrawer_target_gfxline(gfxdrawer_t*d);
50
51 void gfxtool_draw_dashed_line(gfxdrawer_t*d, gfxline_t*line, float*dashes, float phase);
52 gfxline_t* gfxtool_dash_line(gfxline_t*line, float*dashes, float phase);
53
54 void gfxline_dump(gfxline_t*l, FILE*fi, char*prefix);
55 gfxline_t* gfxline_append(gfxline_t*line1, gfxline_t*line2);
56 void gfxline_free(gfxline_t*l);
57 gfxline_t* gfxline_clone(gfxline_t*line);
58
59 void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, double c2y, double x, double y, double quality);
60 void gfxdraw_conicTo(gfxdrawer_t*draw, double cx, double cy, double tox, double toy, double quality);
61
62 gfxbbox_t gfxline_getbbox(gfxline_t*line);
63 gfxbbox_t gfxbbox_expand_to_point(gfxbbox_t box, gfxcoord_t x, gfxcoord_t y);
64
65 void gfxline_transform(gfxline_t*line, gfxmatrix_t*matrix);
66
67 void gfxmatrix_dump(gfxmatrix_t*l, FILE*fi, char*prefix);
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif //__gfxtools_h__