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;
39 return i->out->setparameter(i->out,key,value);
45 void dummy_startpage(gfxdevice_t*dev, int width, int height)
47 internal_t*i = (internal_t*)dev->internal;
49 i->out->startpage(i->out,width,height);
51 void dummy_startclip(gfxdevice_t*dev, gfxline_t*line)
53 internal_t*i = (internal_t*)dev->internal;
55 i->out->startclip(i->out,line);
57 void dummy_endclip(gfxdevice_t*dev)
59 internal_t*i = (internal_t*)dev->internal;
61 i->out->endclip(i->out);
63 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)
65 internal_t*i = (internal_t*)dev->internal;
67 i->out->stroke(i->out, line, width, color, cap_style, joint_style, miterLimit);
70 void dummy_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color)
72 internal_t*i = (internal_t*)dev->internal;
74 i->out->fill(i->out, line, color);
77 void dummy_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform)
79 internal_t*i = (internal_t*)dev->internal;
81 i->out->fillbitmap(i->out, line, img, matrix, cxform);
84 void dummy_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
86 internal_t*i = (internal_t*)dev->internal;
88 i->out->fillgradient(i->out, line, gradient, type, matrix);
91 void dummy_addfont(gfxdevice_t*dev, gfxfont_t*font)
93 internal_t*i = (internal_t*)dev->internal;
95 i->out->addfont(i->out, font);
98 void dummy_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
100 internal_t*i = (internal_t*)dev->internal;
102 i->out->drawchar(i->out, font, glyphnr, color, matrix);
105 void dummy_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action)
107 internal_t*i = (internal_t*)dev->internal;
109 i->out->drawlink(i->out, line, action);
112 void dummy_endpage(gfxdevice_t*dev)
114 internal_t*i = (internal_t*)dev->internal;
116 i->out->endpage(i->out);
119 gfxresult_t* dummy_finish(gfxdevice_t*dev)
121 internal_t*i = (internal_t*)dev->internal;
123 gfxdevice_t*out = i->out;
124 free(dev->internal);dev->internal = 0;i=0;
125 return out->finish(out);
127 free(dev->internal);dev->internal = 0;i=0;
132 void gfxdevice_dummy_init(gfxdevice_t*dev, gfxdevice_t*out)
134 internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
135 memset(dev, 0, sizeof(gfxdevice_t));
141 dev->setparameter = dummy_setparameter;
142 dev->startpage = dummy_startpage;
143 dev->startclip = dummy_startclip;
144 dev->endclip = dummy_endclip;
145 dev->stroke = dummy_stroke;
146 dev->fill = dummy_fill;
147 dev->fillbitmap = dummy_fillbitmap;
148 dev->fillgradient = dummy_fillgradient;
149 dev->addfont = dummy_addfont;
150 dev->drawchar = dummy_drawchar;
151 dev->drawlink = dummy_drawlink;
152 dev->endpage = dummy_endpage;
153 dev->finish = dummy_finish;