3 Part of the swftools package.
5 Copyright (c) 2005 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 */
24 #include "../../config.h"
34 #include "../gfxdevice.h"
35 #include "../gfxtools.h"
42 typedef struct _state {
44 gfxcolor_t last_color[16];
45 gfxmatrix_t last_matrix[16];
48 typedef struct _internal {
49 gfxfontlist_t* fontlist;
58 typedef struct _internal_result {
66 #define OP_SETPARAM 0x01
67 #define OP_STROKE 0x02
68 #define OP_STARTCLIP 0x03
69 #define OP_ENDCLIP 0x04
71 #define OP_FILLBITMAP 0x06
72 #define OP_FILLGRADIENT 0x07
73 #define OP_ADDFONT 0x08
74 #define OP_DRAWCHAR 0x09
75 #define OP_DRAWLINK 0x0a
76 #define OP_STARTPAGE 0x0b
77 #define OP_ENDPAGE 0x0c
78 #define OP_FINISH 0x0d
80 #define FLAG_SAME_AS_LAST 0x10
82 #define LINE_MOVETO 0x0e
83 #define LINE_LINETO 0x0f
84 #define LINE_SPLINETO 0x10
86 static int record_setparameter(struct _gfxdevice*dev, const char*key, const char*value)
88 internal_t*i = (internal_t*)dev->internal;
89 msg("<trace> record: %08x SETPARAM %s %s\n", dev, key, value);
90 writer_writeU8(&i->w, OP_SETPARAM);
91 writer_writeString(&i->w, key);
92 writer_writeString(&i->w, value);
96 static void dumpLine(writer_t*w, gfxline_t*line)
99 if(line->type == gfx_moveTo) {
100 writer_writeU8(w, LINE_MOVETO);
101 writer_writeDouble(w, line->x);
102 writer_writeDouble(w, line->y);
103 } else if(line->type == gfx_lineTo) {
104 writer_writeU8(w, LINE_LINETO);
105 writer_writeDouble(w, line->x);
106 writer_writeDouble(w, line->y);
107 } else if(line->type == gfx_splineTo) {
108 writer_writeU8(w, LINE_SPLINETO);
109 writer_writeDouble(w, line->x);
110 writer_writeDouble(w, line->y);
111 writer_writeDouble(w, line->sx);
112 writer_writeDouble(w, line->sy);
116 writer_writeU8(w, OP_END);
118 static gfxline_t* readLine(reader_t*r)
120 gfxline_t*start = 0, *pos = 0;
122 unsigned char op = reader_readU8(r);
125 gfxline_t*line = (gfxline_t*)rfx_calloc(sizeof(gfxline_t));
132 if(op == LINE_MOVETO) {
133 line->type = gfx_moveTo;
134 line->x = reader_readDouble(r);
135 line->y = reader_readDouble(r);
136 } else if(op == LINE_LINETO) {
137 line->type = gfx_lineTo;
138 line->x = reader_readDouble(r);
139 line->y = reader_readDouble(r);
140 } else if(op == LINE_SPLINETO) {
141 line->type = gfx_splineTo;
142 line->x = reader_readDouble(r);
143 line->y = reader_readDouble(r);
144 line->sx = reader_readDouble(r);
145 line->sy = reader_readDouble(r);
150 static gfximage_t readImage(reader_t*r)
153 img.width = reader_readU16(r);
154 img.height = reader_readU16(r);
155 img.data = (gfxcolor_t*)rfx_alloc(img.width*img.height*4);
156 r->read(r, img.data, img.width*img.height*4);
159 static gfxmatrix_t readMatrix(reader_t*r)
162 matrix.m00 = reader_readDouble(r);
163 matrix.m01 = reader_readDouble(r);
164 matrix.m10 = reader_readDouble(r);
165 matrix.m11 = reader_readDouble(r);
166 matrix.tx = reader_readDouble(r);
167 matrix.ty = reader_readDouble(r);
170 static gfxcolor_t readColor(reader_t*r)
173 col.r = reader_readU8(r);
174 col.g = reader_readU8(r);
175 col.b = reader_readU8(r);
176 col.a = reader_readU8(r);
179 static void readXY(reader_t*r, gfxmatrix_t*m)
181 m->tx = reader_readDouble(r);
182 m->ty = reader_readDouble(r);
185 static gfxgradient_t* readGradient(reader_t*r)
187 gfxgradient_t*start = 0, *pos = 0;
189 U8 op = reader_readU8(r);
192 gfxgradient_t*g = (gfxgradient_t*)rfx_calloc(sizeof(gfxgradient_t));
199 g->color = readColor(r);
200 g->pos = reader_readFloat(r);
204 static gfxcxform_t* readCXForm(reader_t*r)
206 U8 type = reader_readU8(r);
209 gfxcxform_t* c = (gfxcxform_t*)rfx_calloc(sizeof(gfxcxform_t));
210 c->rr = reader_readFloat(r); c->rg = reader_readFloat(r); c->rb = reader_readFloat(r); c->ra = reader_readFloat(r);
211 c->gr = reader_readFloat(r); c->gg = reader_readFloat(r); c->gb = reader_readFloat(r); c->ga = reader_readFloat(r);
212 c->br = reader_readFloat(r); c->bg = reader_readFloat(r); c->bb = reader_readFloat(r); c->ba = reader_readFloat(r);
213 c->ar = reader_readFloat(r); c->ag = reader_readFloat(r); c->ab = reader_readFloat(r); c->aa = reader_readFloat(r);
217 static void dumpColor(writer_t*w, gfxcolor_t*color)
219 writer_writeU8(w, color->r);
220 writer_writeU8(w, color->g);
221 writer_writeU8(w, color->b);
222 writer_writeU8(w, color->a);
224 static void dumpMatrix(writer_t*w, gfxmatrix_t*matrix)
226 writer_writeDouble(w, matrix->m00);
227 writer_writeDouble(w, matrix->m01);
228 writer_writeDouble(w, matrix->m10);
229 writer_writeDouble(w, matrix->m11);
230 writer_writeDouble(w, matrix->tx);
231 writer_writeDouble(w, matrix->ty);
233 static void dumpXY(writer_t*w, gfxmatrix_t*matrix)
235 writer_writeDouble(w, matrix->tx);
236 writer_writeDouble(w, matrix->ty);
238 static void dumpGradient(writer_t*w, gfxgradient_t*gradient)
241 writer_writeU8(w, 1);
242 dumpColor(w, &gradient->color);
243 writer_writeFloat(w, gradient->pos);
244 gradient = gradient->next;
246 writer_writeU8(w, 0);
248 static void dumpImage(writer_t*w, gfximage_t*image)
250 writer_writeU16(w, image->width);
251 writer_writeU16(w, image->height);
252 w->write(w, image->data, image->width*image->height*4);
254 static void dumpCXForm(writer_t*w, gfxcxform_t*c)
257 writer_writeU8(w, 0);
259 writer_writeU8(w, 1);
260 writer_writeFloat(w, c->rr); writer_writeFloat(w, c->rg); writer_writeFloat(w, c->rb); writer_writeFloat(w, c->ra);
261 writer_writeFloat(w, c->gr); writer_writeFloat(w, c->gg); writer_writeFloat(w, c->gb); writer_writeFloat(w, c->ga);
262 writer_writeFloat(w, c->br); writer_writeFloat(w, c->bg); writer_writeFloat(w, c->bb); writer_writeFloat(w, c->ba);
263 writer_writeFloat(w, c->ar); writer_writeFloat(w, c->ag); writer_writeFloat(w, c->ab); writer_writeFloat(w, c->aa);
266 static void dumpFont(writer_t*w, gfxfont_t*font)
268 writer_writeString(w, font->id);
269 writer_writeU32(w, font->num_glyphs);
270 writer_writeU32(w, font->max_unicode);
271 writer_writeDouble(w, font->ascent);
272 writer_writeDouble(w, font->descent);
274 for(t=0;t<font->num_glyphs;t++) {
275 dumpLine(w, font->glyphs[t].line);
276 writer_writeDouble(w, font->glyphs[t].advance);
277 writer_writeU32(w, font->glyphs[t].unicode);
278 if(font->glyphs[t].name) {
279 writer_writeString(w,font->glyphs[t].name);
284 for(t=0;t<font->max_unicode;t++) {
285 writer_writeU32(w, font->unicode2glyph[t]);
287 writer_writeU32(w, font->kerning_size);
288 for(t=0;t<font->kerning_size;t++) {
289 writer_writeU32(w, font->kerning[t].c1);
290 writer_writeU32(w, font->kerning[t].c2);
291 writer_writeU32(w, font->kerning[t].advance);
294 static gfxfont_t*readFont(reader_t*r)
296 gfxfont_t* font = (gfxfont_t*)rfx_calloc(sizeof(gfxfont_t));
297 font->id = reader_readString(r);
298 font->num_glyphs = reader_readU32(r);
299 font->max_unicode = reader_readU32(r);
300 font->ascent = reader_readDouble(r);
301 font->descent = reader_readDouble(r);
302 font->glyphs = (gfxglyph_t*)rfx_calloc(sizeof(gfxglyph_t)*font->num_glyphs);
303 font->unicode2glyph = (int*)rfx_calloc(sizeof(font->unicode2glyph[0])*font->max_unicode);
305 for(t=0;t<font->num_glyphs;t++) {
306 font->glyphs[t].line = readLine(r);
307 font->glyphs[t].advance = reader_readDouble(r);
308 font->glyphs[t].unicode = reader_readU32(r);
309 font->glyphs[t].name = reader_readString(r);
310 if(!font->glyphs[t].name[0]) {
311 free((void*)(font->glyphs[t].name));
312 font->glyphs[t].name = 0;
315 for(t=0;t<font->max_unicode;t++) {
316 font->unicode2glyph[t] = reader_readU32(r);
318 font->kerning_size = reader_readU32(r);
319 if(font->kerning_size) {
320 font->kerning = malloc(sizeof(gfxkerning_t)*font->kerning_size);
321 for(t=0;t<font->kerning_size;t++) {
322 font->kerning[t].c1 = reader_readU32(r);
323 font->kerning[t].c2 = reader_readU32(r);
324 font->kerning[t].advance = reader_readU32(r);
330 static void record_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
332 internal_t*i = (internal_t*)dev->internal;
333 msg("<trace> record: %08x STROKE\n", dev);
334 writer_writeU8(&i->w, OP_STROKE);
335 writer_writeDouble(&i->w, width);
336 writer_writeDouble(&i->w, miterLimit);
337 dumpColor(&i->w, color);
338 writer_writeU8(&i->w, cap_style);
339 writer_writeU8(&i->w, joint_style);
340 dumpLine(&i->w, line);
343 static void record_startclip(struct _gfxdevice*dev, gfxline_t*line)
345 internal_t*i = (internal_t*)dev->internal;
346 msg("<trace> record: %08x STARTCLIP\n", dev);
347 writer_writeU8(&i->w, OP_STARTCLIP);
348 dumpLine(&i->w, line);
352 static void record_endclip(struct _gfxdevice*dev)
354 internal_t*i = (internal_t*)dev->internal;
355 msg("<trace> record: %08x ENDCLIP\n", dev);
356 writer_writeU8(&i->w, OP_ENDCLIP);
359 msg("<error> record: endclip() without startclip()");
363 static void record_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
365 internal_t*i = (internal_t*)dev->internal;
366 msg("<trace> record: %08x FILL\n", dev);
367 writer_writeU8(&i->w, OP_FILL);
368 dumpColor(&i->w, color);
369 dumpLine(&i->w, line);
372 static void record_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform)
374 internal_t*i = (internal_t*)dev->internal;
375 msg("<trace> record: %08x FILLBITMAP\n", dev);
376 writer_writeU8(&i->w, OP_FILLBITMAP);
377 dumpImage(&i->w, img);
378 dumpMatrix(&i->w, matrix);
379 dumpLine(&i->w, line);
380 dumpCXForm(&i->w, cxform);
383 static void record_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
385 internal_t*i = (internal_t*)dev->internal;
386 msg("<trace> record: %08x FILLGRADIENT %08x\n", dev, gradient);
387 writer_writeU8(&i->w, OP_FILLGRADIENT);
388 writer_writeU8(&i->w, type);
389 dumpGradient(&i->w, gradient);
390 dumpMatrix(&i->w, matrix);
391 dumpLine(&i->w, line);
394 static void record_addfont(struct _gfxdevice*dev, gfxfont_t*font)
396 internal_t*i = (internal_t*)dev->internal;
397 msg("<trace> record: %08x ADDFONT %s\n", dev, font->id);
398 if(font && !gfxfontlist_hasfont(i->fontlist, font)) {
399 writer_writeU8(&i->w, OP_ADDFONT);
400 dumpFont(&i->w, font);
401 i->fontlist = gfxfontlist_addfont(i->fontlist, font);
405 static void record_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
407 internal_t*i = (internal_t*)dev->internal;
408 if(font && !gfxfontlist_hasfont(i->fontlist, font)) {
409 record_addfont(dev, font);
412 msg("<trace> record: %08x DRAWCHAR %d\n", glyphnr, dev);
413 const char*font_id = font->id?font->id:"*NULL*";
415 gfxmatrix_t*l = &i->state.last_matrix[OP_DRAWCHAR];
417 char same_font = i->state.last_string[OP_DRAWCHAR] && !strcmp(i->state.last_string[OP_DRAWCHAR], font_id);
418 char same_matrix = (l->m00 == matrix->m00) && (l->m01 == matrix->m01) && (l->m10 == matrix->m10) && (l->m11 == matrix->m11);
419 char same_color = !memcmp(color, &i->state.last_color[OP_DRAWCHAR], sizeof(gfxcolor_t));
421 if(same_font && same_matrix && same_color)
422 flags |= FLAG_SAME_AS_LAST;
424 writer_writeU8(&i->w, OP_DRAWCHAR|flags);
425 writer_writeU32(&i->w, glyphnr);
426 if(!(flags&FLAG_SAME_AS_LAST)) {
427 writer_writeString(&i->w, font_id);
428 dumpColor(&i->w, color);
429 dumpMatrix(&i->w, matrix);
431 dumpXY(&i->w, matrix);
435 static void record_startpage(struct _gfxdevice*dev, int width, int height)
437 internal_t*i = (internal_t*)dev->internal;
438 msg("<trace> record: %08x STARTPAGE\n", dev);
439 writer_writeU8(&i->w, OP_STARTPAGE);
440 writer_writeU16(&i->w, width);
441 writer_writeU16(&i->w, height);
444 static void record_endpage(struct _gfxdevice*dev)
446 internal_t*i = (internal_t*)dev->internal;
447 msg("<trace> record: %08x ENDPAGE\n", dev);
448 writer_writeU8(&i->w, OP_ENDPAGE);
451 static void record_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
453 internal_t*i = (internal_t*)dev->internal;
454 msg("<trace> record: %08x DRAWLINK\n", dev);
455 writer_writeU8(&i->w, OP_DRAWLINK);
456 dumpLine(&i->w, line);
457 writer_writeString(&i->w, action);
460 static char* read_string(reader_t*r, state_t*state, U8 id, U8 flags)
462 assert(id>=0 && id<16);
463 if(flags&FLAG_SAME_AS_LAST) {
464 assert(state->last_string[id]);
465 return state->last_string[id];
467 char*s = reader_readString(r);
468 state->last_string[id] = strdup(s);
471 static gfxcolor_t read_color(reader_t*r, state_t*s, U8 id, U8 flags)
473 assert(id>=0 && id<16);
474 if(flags&FLAG_SAME_AS_LAST)
475 return s->last_color[id];
476 gfxcolor_t c = readColor(r);
477 s->last_color[id] = c;
480 static gfxmatrix_t read_matrix(reader_t*r, state_t*s, U8 id, U8 flags)
482 assert(id>=0 && id<16);
483 if(flags&FLAG_SAME_AS_LAST) {
484 gfxmatrix_t m = s->last_matrix[id];
488 gfxmatrix_t m = readMatrix(r);
489 s->last_matrix[id] = m;
493 static void replay(struct _gfxdevice*dev, gfxdevice_t*out, reader_t*r)
497 i = (internal_t*)dev->internal;
501 memset(&state, 0, sizeof(state));
503 gfxfontlist_t* fontlist = gfxfontlist_create();
507 if(r->read(r, &op, 1)!=1)
509 unsigned char flags = op&0xf0;
516 msg("<trace> replay: SETPARAM");
519 key = reader_readString(r);
520 value = reader_readString(r);
521 out->setparameter(out, key, value);
527 msg("<trace> replay: STARTPAGE");
528 U16 width = reader_readU16(r);
529 U16 height = reader_readU16(r);
530 out->startpage(out, width, height);
534 msg("<trace> replay: ENDPAGE");
539 msg("<trace> replay: FINISH");
543 msg("<trace> replay: STROKE");
544 double width = reader_readDouble(r);
545 double miterlimit = reader_readDouble(r);
546 gfxcolor_t color = readColor(r);
548 int v = reader_readU8(r);
550 case 0: captype = gfx_capButt; break;
551 case 1: captype = gfx_capRound; break;
552 case 2: captype = gfx_capSquare; break;
554 gfx_joinType jointtype;
555 v = reader_readU8(r);
557 case 0: jointtype = gfx_joinMiter; break;
558 case 1: jointtype = gfx_joinRound; break;
559 case 2: jointtype = gfx_joinBevel; break;
561 gfxline_t* line = readLine(r);
562 out->stroke(out, line, width, &color, captype, jointtype,miterlimit);
567 msg("<trace> replay: STARTCLIP");
568 gfxline_t* line = readLine(r);
569 out->startclip(out, line);
574 msg("<trace> replay: ENDCLIP");
579 msg("<trace> replay: FILL");
580 gfxcolor_t color = readColor(r);
581 gfxline_t* line = readLine(r);
582 out->fill(out, line, &color);
586 case OP_FILLBITMAP: {
587 msg("<trace> replay: FILLBITMAP");
588 gfximage_t img = readImage(r);
589 gfxmatrix_t matrix = readMatrix(r);
590 gfxline_t* line = readLine(r);
591 gfxcxform_t* cxform = readCXForm(r);
592 out->fillbitmap(out, line, &img, &matrix, cxform);
596 free(img.data);img.data=0;
599 case OP_FILLGRADIENT: {
600 msg("<trace> replay: FILLGRADIENT");
601 gfxgradienttype_t type;
602 int v = reader_readU8(r);
605 type = gfxgradient_radial; break;
607 type = gfxgradient_linear; break;
609 gfxgradient_t*gradient = readGradient(r);
610 gfxmatrix_t matrix = readMatrix(r);
611 gfxline_t* line = readLine(r);
612 out->fillgradient(out, line, gradient, type, &matrix);
616 msg("<trace> replay: DRAWLINK");
617 gfxline_t* line = readLine(r);
618 char* s = reader_readString(r);
619 out->drawlink(out,line,s);
625 msg("<trace> replay: ADDFONT out=%08x(%s)", out, out->name);
626 gfxfont_t*font = readFont(r);
627 fontlist = gfxfontlist_addfont(fontlist, font);
628 out->addfont(out, font);
632 U32 glyph = reader_readU32(r);
633 gfxmatrix_t m = {1,0,0, 0,1,0};
634 char* id = read_string(r, &state, op, flags);
635 gfxcolor_t color = read_color(r, &state, op, flags);
636 gfxmatrix_t matrix = read_matrix(r, &state, op, flags);
638 gfxfont_t*font = id?gfxfontlist_findfont(fontlist, id):0;
640 font = gfxfontlist_findfont(i->fontlist, id);
642 msg("<trace> replay: DRAWCHAR font=%s glyph=%d", id, glyph);
643 out->drawchar(out, font, glyph, &color, &matrix);
651 /* problem: if we just replayed into a device which stores the
652 font for later use (the record device itself is a nice example),
653 then we can't free it yet */
654 //gfxfontlist_free(fontlist, 1);
655 gfxfontlist_free(fontlist, 0);
657 void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device)
659 internal_result_t*i = (internal_result_t*)result->internal;
662 if(i->use_tempfile) {
663 reader_init_filereader2(&r, i->filename);
665 reader_init_memreader(&r, i->data, i->length);
668 replay(0, device, &r);
671 static void record_result_write(gfxresult_t*r, int filedesc)
673 internal_result_t*i = (internal_result_t*)r->internal;
675 write(filedesc, i->data, i->length);
678 static int record_result_save(gfxresult_t*r, const char*filename)
680 internal_result_t*i = (internal_result_t*)r->internal;
681 if(i->use_tempfile) {
682 move_file(i->filename, filename);
684 FILE*fi = fopen(filename, "wb");
686 fprintf(stderr, "Couldn't open file %s for writing\n", filename);
689 fwrite(i->data, i->length, 1, fi);
694 static void*record_result_get(gfxresult_t*r, const char*name)
696 internal_result_t*i = (internal_result_t*)r->internal;
697 if(!strcmp(name, "data")) {
699 } else if(!strcmp(name, "length")) {
704 static void record_result_destroy(gfxresult_t*r)
706 internal_result_t*i = (internal_result_t*)r->internal;
708 free(i->data);i->data = 0;
714 free(r->internal);r->internal = 0;
718 static unsigned char printable(unsigned char a)
720 if(a<32 || a==127) return '.';
724 static void hexdumpMem(unsigned char*data, int len)
729 printf("%02x ", data[t]);
730 ascii[t&15] = printable(data[t]);
731 if((t && ((t&15)==15)) || (t==len-1))
735 for(s=p-1;s<16;s++) {
738 printf(" %s\n", ascii);
743 void gfxdevice_record_flush(gfxdevice_t*dev, gfxdevice_t*out)
745 internal_t*i = (internal_t*)dev->internal;
747 if(!i->use_tempfile) {
749 void*data = writer_growmemwrite_memptr(&i->w, &len);
751 reader_init_memreader(&r, data, len);
752 replay(dev, out, &r);
753 writer_growmemwrite_reset(&i->w);
755 msg("<fatal> Flushing not supported for file based record device");
761 static gfxresult_t* record_finish(struct _gfxdevice*dev)
763 internal_t*i = (internal_t*)dev->internal;
764 msg("<trace> record: %08x END", dev);
767 msg("<error> Warning: unclosed cliplevels");
770 writer_writeU8(&i->w, OP_END);
772 gfxfontlist_free(i->fontlist, 0);
774 internal_result_t*ir = (internal_result_t*)rfx_calloc(sizeof(gfxresult_t));
776 ir->use_tempfile = i->use_tempfile;
777 if(i->use_tempfile) {
778 ir->filename = i->filename;
780 ir->data = writer_growmemwrite_getmem(&i->w);
781 ir->length = i->w.pos;
785 gfxresult_t*result= (gfxresult_t*)rfx_calloc(sizeof(gfxresult_t));
786 result->save = record_result_save;
787 result->get = record_result_get;
788 result->destroy = record_result_destroy;
789 result->internal = ir;
791 free(dev->internal);memset(dev, 0, sizeof(gfxdevice_t));
796 void gfxdevice_record_init(gfxdevice_t*dev, char use_tempfile)
798 internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
799 memset(dev, 0, sizeof(gfxdevice_t));
801 dev->name = "record";
805 i->use_tempfile = use_tempfile;
807 writer_init_growingmemwriter(&i->w, 1048576);
810 i->filename = strdup(mktempname(buffer, "gfx"));
811 writer_init_filewriter2(&i->w, i->filename);
813 i->fontlist = gfxfontlist_create();
816 dev->setparameter = record_setparameter;
817 dev->startpage = record_startpage;
818 dev->startclip = record_startclip;
819 dev->endclip = record_endclip;
820 dev->stroke = record_stroke;
821 dev->fill = record_fill;
822 dev->fillbitmap = record_fillbitmap;
823 dev->fillgradient = record_fillgradient;
824 dev->addfont = record_addfont;
825 dev->drawchar = record_drawchar;
826 dev->drawlink = record_drawlink;
827 dev->endpage = record_endpage;
828 dev->finish = record_finish;