fixed z-order problems in poly2bitmap
[swftools.git] / lib / gfxpoly.h
1 /* gfxpoly.h 
2
3    Various boolean polygon functions.
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 __gfxpoly_h__
24 #define __gfxpoly_h__
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #include <stdio.h>
31 #include "mem.h"
32 #include "gfxdevice.h"
33 #include "gfxtools.h"
34
35 /* A "grid" value is the granularity at which polygon intersection operates.
36    It usually makes sense this to the smallest value that can actually be represented
37    in the output device (like 0.05 = 1 twip for SWF).  */
38 #define DEFAULT_GRID (0.05)
39
40 typedef struct _gfxpoly {
41 } gfxpoly_t;
42
43 void gfxpoly_destroy(gfxpoly_t*poly);
44
45 /* constructors */
46 gfxpoly_t* gfxpoly_from_fill(gfxline_t*line, double gridsize);
47 gfxpoly_t* gfxpoly_from_stroke(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit, double gridsize);
48
49 /* operators */
50 gfxpoly_t* gfxpoly_intersect(gfxpoly_t*p1, gfxpoly_t*p2);
51 gfxpoly_t* gfxpoly_union(gfxpoly_t*p1, gfxpoly_t*p2);
52
53 /* conversion functions */
54 gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2, double gridsize);
55 gfxline_t* gfxline_from_gfxpoly(gfxpoly_t*poly);
56 gfxline_t* gfxpoly_circular_to_evenodd(gfxline_t*line, double gridsize);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif //__gfxpoly_h__
63