fixed moments calculcation
[swftools.git] / lib / gfxpoly.h
blobb8329c821d879ca8461fccaaefe6bd49090d6e3e
1 /* gfxpoly.h
3 Various boolean polygon functions.
5 Part of the swftools package.
7 Copyright (c) 2005 Matthias Kramm <kramm@quiss.org>
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.
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.
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 */
23 #ifndef __gfxpoly_h__
24 #define __gfxpoly_h__
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 #include <stdio.h>
31 #include "mem.h"
32 #include "gfxdevice.h"
33 #include "gfxtools.h"
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)
40 typedef struct _gfxpoly {
41 } gfxpoly_t;
43 void gfxpoly_destroy(gfxpoly_t*poly);
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);
49 /* operators */
50 gfxpoly_t* gfxpoly_intersect(gfxpoly_t*p1, gfxpoly_t*p2);
51 gfxpoly_t* gfxpoly_union(gfxpoly_t*p1, gfxpoly_t*p2);
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* gfxline_from_gfxpoly_with_direction(gfxpoly_t*poly);
57 gfxline_t* gfxpoly_circular_to_evenodd(gfxline_t*line, double gridsize);
59 #ifdef __cplusplus
61 #endif
63 #endif //__gfxpoly_h__