3 Part of the swftools package.
5 Copyright (c) 2007 Matthias Kramm <kramm@quiss.org>
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.
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.
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 */
28 #include "../gfxdevice.h"
29 #include "../gfxtools.h"
31 typedef struct _internal {
35 int dummy_setparameter(gfxdevice_t*dev, const char*key, const char*value)
37 internal_t*i = (internal_t*)dev->internal;
38 return i->out->setparameter(i->out,key,value);
41 void dummy_startpage(gfxdevice_t*dev, int width, int height)
43 internal_t*i = (internal_t*)dev->internal;
44 i->out->startpage(i->out,width,height);
46 void dummy_startclip(gfxdevice_t*dev, gfxline_t*line)
48 internal_t*i = (internal_t*)dev->internal;
49 i->out->startclip(i->out,line);
51 void dummy_endclip(gfxdevice_t*dev)
53 internal_t*i = (internal_t*)dev->internal;
54 i->out->endclip(i->out);
56 void dummy_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
58 internal_t*i = (internal_t*)dev->internal;
59 i->out->stroke(i->out, line, width, color, cap_style, joint_style, miterLimit);
62 void dummy_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color)
64 internal_t*i = (internal_t*)dev->internal;
65 i->out->fill(i->out, line, color);
68 void dummy_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform)
70 internal_t*i = (internal_t*)dev->internal;
71 i->out->fillbitmap(i->out, line, img, matrix, cxform);
74 void dummy_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
76 internal_t*i = (internal_t*)dev->internal;
77 i->out->fillgradient(i->out, line, gradient, type, matrix);
80 void dummy_addfont(gfxdevice_t*dev, gfxfont_t*font)
82 internal_t*i = (internal_t*)dev->internal;
83 i->out->addfont(i->out, font);
86 void dummy_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
88 internal_t*i = (internal_t*)dev->internal;
89 i->out->drawchar(i->out, font, glyphnr, color, matrix);
92 void dummy_drawlink(gfxdevice_t*dev, gfxline_t*line, char*action)
94 internal_t*i = (internal_t*)dev->internal;
95 i->out->drawlink(i->out, line, action);
98 void dummy_endpage(gfxdevice_t*dev)
100 internal_t*i = (internal_t*)dev->internal;
101 i->out->endpage(i->out);
104 gfxresult_t* dummy_finish(gfxdevice_t*dev)
106 internal_t*i = (internal_t*)dev->internal;
107 gfxdevice_t*out = i->out;
108 free(dev->internal);dev->internal = 0;i=0;
109 return out->finish(out);
112 void gfxdevice_dummy_init(gfxdevice_t*dev, gfxdevice_t*out)
114 internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
115 memset(dev, 0, sizeof(gfxdevice_t));
121 dev->setparameter = dummy_setparameter;
122 dev->startpage = dummy_startpage;
123 dev->startclip = dummy_startclip;
124 dev->endclip = dummy_endclip;
125 dev->stroke = dummy_stroke;
126 dev->fill = dummy_fill;
127 dev->fillbitmap = dummy_fillbitmap;
128 dev->fillgradient = dummy_fillgradient;
129 dev->addfont = dummy_addfont;
130 dev->drawchar = dummy_drawchar;
131 dev->drawlink = dummy_drawlink;
132 dev->endpage = dummy_endpage;
133 dev->finish = dummy_finish;