added alpha and font filter drafts
[swftools.git] / lib / gfxfilter.h
1 /* gfxfilter.h
2
3    Part of the swftools package.
4
5    Copyright (c) 2010 Matthias Kramm <kramm@quiss.org> 
6  
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
20
21 #ifndef __gfxfilter_h__
22 #define __gfxfilter_h__
23
24 #include "gfxdevice.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 typedef struct _gfxfilter
31 {
32     int num_passes;
33     const char*name;
34     int pass;
35
36     int (*setparameter)(struct _gfxfilter*in, const char*key, const char*value, struct _gfxdevice*out);
37     void (*startpage)(struct _gfxfilter*in, int width, int height, struct _gfxdevice*out);
38     void (*startclip)(struct _gfxfilter*in, gfxline_t*line, struct _gfxdevice*out);
39     void (*endclip)(struct _gfxfilter*in, struct _gfxdevice*out);
40     void (*stroke)(struct _gfxfilter*in, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit, struct _gfxdevice*out);
41     void (*fill)(struct _gfxfilter*in, gfxline_t*line, gfxcolor_t*color, struct _gfxdevice*out);
42     void (*fillbitmap)(struct _gfxfilter*in, gfxline_t*line, gfximage_t*img, gfxmatrix_t*imgcoord2devcoord, gfxcxform_t*cxform, struct _gfxdevice*out); //cxform? tiling?
43     void (*fillgradient)(struct _gfxfilter*in, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*gradcoord2devcoord, struct _gfxdevice*out); //?
44     void (*addfont)(struct _gfxfilter*in, gfxfont_t*font, struct _gfxdevice*out);
45     void (*drawchar)(struct _gfxfilter*in, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix, struct _gfxdevice*out);
46     void (*drawlink)(struct _gfxfilter*in, gfxline_t*line, const char*action, struct _gfxdevice*out);
47     void (*endpage)(struct _gfxfilter*in, struct _gfxdevice*out);
48     gfxresult_t* (*finish)(struct _gfxfilter*in, struct _gfxdevice*out);
49     void* internal;
50 } gfxfilter_t;
51
52 typedef struct _gfxtwopassfilter
53 {
54     gfxfilter_t pass1;
55     gfxfilter_t pass2;
56 } gfxtwopassfilter_t;
57
58 gfxdevice_t*gfxfilter_apply(gfxfilter_t*filter, gfxdevice_t*dev);
59 gfxdevice_t*gfxtwopassfilter_apply(gfxtwopassfilter_t*filter, gfxdevice_t*dev);
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif //__gfxfilter_h__