3 Part of the swftools package.
5 Copyright (c) 2005/2006/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 */
25 #include "../gfxdevice.h"
26 #include "../gfxtools.h"
28 #define PNG_INLINE_EXPORTS
34 typedef gfxcolor_t RGBA;
36 typedef struct _renderpoint
41 typedef struct _renderline
48 typedef struct _internal_result {
50 struct _internal_result*next;
54 typedef struct _clipbuffer {
56 struct _clipbuffer*next;
59 typedef struct _internal {
79 internal_result_t*results;
80 internal_result_t*result_next;
83 typedef enum {filltype_solid,filltype_clip,filltype_bitmap,filltype_gradient} filltype_t;
85 typedef struct _fillinfo {
96 static inline void add_pixel(internal_t*i, float x, int y)
100 if(x >= i->width2 || y >= i->height2 || y<0) return;
102 if(y<i->ymin) i->ymin = y;
103 if(y>i->ymax) i->ymax = y;
105 renderline_t*l = &i->lines[y];
107 if(l->num == l->size) {
109 l->points = (renderpoint_t*)rfx_realloc(l->points, l->size * sizeof(renderpoint_t));
111 l->points[l->num] = p;
115 /* set this to 0.777777 or something if the "both fillstyles set while not inside shape"
116 problem appears to often */
119 #define INT(x) ((int)((x)+16)-16)
121 static void add_line(gfxdevice_t*dev , double x1, double y1, double x2, double y2)
123 internal_t*i = (internal_t*)dev->internal;
125 double ny1, ny2, stepx;
127 int l = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
128 printf(" l[%d - %.2f/%.2f -> %.2f/%.2f]\n", l, x1/20.0, y1/20.0, x2/20.0, y2/20.0);
145 ny1 = INT(y1) + 1.0 + CUT;
148 ny2 = INT(y2) - 1.0 + CUT;
155 x1 = x1 + (ny1-y1)*stepx;
156 x2 = x2 + (ny2-y2)*stepx;
165 float xx = (float)(startx + posx);
166 add_pixel(i, xx ,posy);
172 #define PI 3.14159265358979
173 static void add_solidline(gfxdevice_t*dev, double x1, double y1, double x2, double y2, double width)
175 /* TODO: handle cap styles */
177 internal_t*i = (internal_t*)dev->internal;
190 /* Make sure the line is always at least one pixel wide */
192 /* That's what Macromedia's Player does at least at zoom level >= 1. */
195 /* That's what Macromedia's Player seems to do at zoom level 0. */
196 /* TODO: needs testing */
198 /* TODO: how does this interact with scaling? */
199 if(width * i->multiply < 1.0)
200 width = 1.0 / i->multiply;
203 sd = (double)dx*(double)dx+(double)dy*(double)dy;
225 add_line(dev, x1+vx, y1+vy, xx, yy);
228 for(t=1;t<segments;t++) {
229 double s = sin(t*PI/segments);
230 double c = cos(t*PI/segments);
231 xx = (x2 + vx*c - vy*s);
232 yy = (y2 + vx*s + vy*c);
233 add_line(dev, lastx, lasty, xx, yy);
240 add_line(dev, lastx, lasty, xx, yy);
245 add_line(dev, lastx, lasty, xx, yy);
248 for(t=1;t<segments;t++) {
249 double s = sin(t*PI/segments);
250 double c = cos(t*PI/segments);
251 xx = (x1 - vx*c + vy*s);
252 yy = (y1 - vx*s - vy*c);
253 add_line(dev, lastx, lasty, xx, yy);
257 add_line(dev, lastx, lasty, (x1+vx), (y1+vy));
260 static int compare_renderpoints(const void * _a, const void * _b)
262 renderpoint_t*a = (renderpoint_t*)_a;
263 renderpoint_t*b = (renderpoint_t*)_b;
264 if(a->x < b->x) return -1;
265 if(a->x > b->x) return 1;
269 static void fill_line_solid(RGBA*line, U32*z, int y, int x1, int x2, RGBA col)
273 U32 bit = 1<<(x1&31);
274 int bitpos = (x1/32);
277 int ainv = 255-col.a;
278 col.r = (col.r*col.a)>>8;
279 col.g = (col.g*col.a)>>8;
280 col.b = (col.b*col.a)>>8;
283 line[x].r = ((line[x].r*ainv)>>8)+col.r;
284 line[x].g = ((line[x].g*ainv)>>8)+col.g;
285 line[x].b = ((line[x].b*ainv)>>8)+col.b;
287 line[x].a = ((line[x].a*ainv)>>8)+col.a;
307 static void fill_line_bitmap(RGBA*line, U32*z, int y, int x1, int x2, fillinfo_t*info)
311 gfxmatrix_t*m = info->matrix;
312 gfximage_t*b = info->image;
314 if(!b || !b->width || !b->height) {
315 gfxcolor_t red = {255,255,0,0};
316 fill_line_solid(line, z, y, x1, x2, red);
320 double det = m->m00*m->m11 - m->m01*m->m10;
321 if(fabs(det) < 0.0005) {
322 /* x direction equals y direction- the image is invisible */
326 double xx1 = ( (-m->tx) * m->m11 - (y - m->ty) * m->m10) * det;
327 double yy1 = (- (-m->tx) * m->m01 + (y - m->ty) * m->m00) * det;
328 double xinc1 = m->m11 * det;
329 double yinc1 = m->m01 * det;
331 U32 bit = 1<<(x1&31);
332 int bitpos = (x1/32);
337 int xx = (int)(xx1 + x * xinc1);
338 int yy = (int)(yy1 - x * yinc1);
341 if(info->clip_or_radial) {
343 if(xx>=b->width) xx = b->width-1;
345 if(yy>=b->height) yy = b->height-1;
349 if(xx<0) xx += b->width;
350 if(yy<0) yy += b->height;
353 col = b->data[yy*b->width+xx];
356 /* needs bitmap with premultiplied alpha */
357 line[x].r = ((line[x].r*ainv)>>8)+col.r;
358 line[x].g = ((line[x].g*ainv)>>8)+col.g;
359 line[x].b = ((line[x].b*ainv)>>8)+col.b;
369 static void fill_line_gradient(RGBA*line, U32*z, int y, int x1, int x2, fillinfo_t*info)
373 gfxmatrix_t*m = info->matrix;
374 RGBA*g= info->gradient;
376 double det = m->m00*m->m11 - m->m01*m->m10;
377 if(fabs(det) < 0.0005) {
378 /* x direction equals y direction */
382 double xx1 = ( (-m->tx) * m->m11 - (y - m->ty) * m->m10) * det;
383 double yy1 = (- (-m->tx) * m->m01 + (y - m->ty) * m->m00) * det;
384 double xinc1 = m->m11 * det;
385 double yinc1 = m->m01 * det;
387 U32 bit = 1<<(x1&31);
388 int bitpos = (x1/32);
396 if(info->clip_or_radial) {
397 double xx = xx1 + x * xinc1;
398 double yy = yy1 + y * yinc1;
399 double r = sqrt(xx*xx + yy*yy);
401 pos = (int)(r*255.999);
403 double r = xx1 + x * xinc1;
406 pos = (int)((r+1)*127.999);
411 /* needs bitmap with premultiplied alpha */
412 line[x].r = ((line[x].r*ainv)>>8)+col.r;
413 line[x].g = ((line[x].g*ainv)>>8)+col.g;
414 line[x].b = ((line[x].b*ainv)>>8)+col.b;
424 static void fill_line_clip(RGBA*line, U32*z, int y, int x1, int x2)
428 U32 bit = 1<<(x1&31);
429 int bitpos = (x1/32);
440 void fill_line(gfxdevice_t*dev, RGBA*line, U32*zline, int y, int startx, int endx, fillinfo_t*fill)
442 if(fill->type == filltype_solid)
443 fill_line_solid(line, zline, y, startx, endx, *fill->color);
444 else if(fill->type == filltype_clip)
445 fill_line_clip(line, zline, y, startx, endx);
446 else if(fill->type == filltype_bitmap)
447 fill_line_bitmap(line, zline, y, startx, endx, fill);
448 else if(fill->type == filltype_gradient)
449 fill_line_gradient(line, zline, y, startx, endx, fill);
452 void fill(gfxdevice_t*dev, fillinfo_t*fill)
454 internal_t*i = (internal_t*)dev->internal;
457 for(y=i->ymin;y<=i->ymax;y++) {
458 renderpoint_t*points = i->lines[y].points;
459 RGBA*line = &i->img[i->width2*y];
460 U32*zline = &i->clipbuf->data[i->bitwidth*y];
463 int num = i->lines[y].num;
465 qsort(points, num, sizeof(renderpoint_t), compare_renderpoints);
468 renderpoint_t*p = &points[n];
469 renderpoint_t*next= n<num-1?&points[n+1]:0;
471 int endx = next?next->x:i->width2;
480 fill_line(dev, line, zline, y, startx, endx, fill);
483 if(endx == i->width2)
486 if(fill->type == filltype_clip) {
487 if(i->clipbuf->next) {
488 U32*line2 = &i->clipbuf->next->data[i->bitwidth*y];
490 for(x=0;x<i->bitwidth;x++)
491 zline[x] &= line2[x];
499 void fill_solid(gfxdevice_t*dev, gfxcolor_t* color)
502 memset(&info, 0, sizeof(info));
503 info.type = filltype_solid;
508 int render_setparameter(struct _gfxdevice*dev, const char*key, const char*value)
510 internal_t*i = (internal_t*)dev->internal;
511 if(!strcmp(key, "antialize") || !strcmp(key, "antialise")) {
512 i->antialize = atoi(value);
513 i->zoom = i->antialize * i->multiply;
515 } else if(!strcmp(key, "multiply")) {
516 i->multiply = atoi(value);
517 i->zoom = i->antialize * i->multiply;
518 fprintf(stderr, "Warning: multiply not implemented yet\n");
520 } else if(!strcmp(key, "fillwhite")) {
521 i->fillwhite = atoi(value);
523 } else if(!strcmp(key, "palette")) {
524 i->palette = atoi(value);
530 void newclip(struct _gfxdevice*dev)
532 internal_t*i = (internal_t*)dev->internal;
534 clipbuffer_t*c = (clipbuffer_t*)rfx_calloc(sizeof(clipbuffer_t));
535 c->data = (U32*)rfx_calloc(sizeof(U32) * i->bitwidth * i->height2);
536 c->next = i->clipbuf;
539 memcpy(c->data, c->next->data, i->bitwidth*i->height2);
541 memset(c->data, 0, sizeof(U32)*i->bitwidth*i->height2);
544 void endclip(struct _gfxdevice*dev, char removelast)
546 internal_t*i = (internal_t*)dev->internal;
548 /* test for at least one cliplevel (the one we created ourselves) */
549 if(!i->clipbuf || (!i->clipbuf->next && !removelast)) {
550 fprintf(stderr, "endclip without any active clip buffers\n");
554 clipbuffer_t*c = i->clipbuf;
555 i->clipbuf = i->clipbuf->next;
557 free(c->data);c->data = 0;
561 void render_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
563 internal_t*i = (internal_t*)dev->internal;
566 /*if(cap_style != gfx_capRound || joint_style != gfx_joinRound) {
567 fprintf(stderr, "Warning: cap/joint style != round not yet supported\n");
571 if(line->type == gfx_moveTo) {
572 } else if(line->type == gfx_lineTo) {
573 double x1=x*i->zoom,y1=y*i->zoom;
574 double x3=line->x*i->zoom,y3=line->y*i->zoom;
575 add_solidline(dev, x1, y1, x3, y3, width * i->zoom);
576 fill_solid(dev, color);
577 } else if(line->type == gfx_splineTo) {
581 double x1=x*i->zoom,y1=y*i->zoom;
582 double x2=line->sx*i->zoom,y2=line->sy*i->zoom;
583 double x3=line->x*i->zoom,y3=line->y*i->zoom;
585 double c = abs(x3-2*x2+x1) + abs(y3-2*y2+y1);
589 parts = (int)(sqrt(c)/3);
590 if(!parts) parts = 1;
592 for(t=1;t<=parts;t++) {
593 double nx = (double)(t*t*x3 + 2*t*(parts-t)*x2 + (parts-t)*(parts-t)*x1)/(double)(parts*parts);
594 double ny = (double)(t*t*y3 + 2*t*(parts-t)*y2 + (parts-t)*(parts-t)*y1)/(double)(parts*parts);
596 add_solidline(dev, xx, yy, nx, ny, width * i->zoom);
597 fill_solid(dev, color);
608 static void draw_line(gfxdevice_t*dev, gfxline_t*line)
610 internal_t*i = (internal_t*)dev->internal;
615 int x1,y1,x2,y2,x3,y3;
617 if(line->type == gfx_moveTo) {
618 } else if(line->type == gfx_lineTo) {
619 double x1=x*i->zoom,y1=y*i->zoom;
620 double x3=line->x*i->zoom,y3=line->y*i->zoom;
622 add_line(dev, x1, y1, x3, y3);
623 } else if(line->type == gfx_splineTo) {
624 int c,t,parts,qparts;
627 double x1=x*i->zoom,y1=y*i->zoom;
628 double x2=line->sx*i->zoom,y2=line->sy*i->zoom;
629 double x3=line->x*i->zoom,y3=line->y*i->zoom;
631 c = abs(x3-2*x2+x1) + abs(y3-2*y2+y1);
635 parts = (int)(sqrt(c));
636 if(!parts) parts = 1;
638 for(t=1;t<=parts;t++) {
639 double nx = (double)(t*t*x3 + 2*t*(parts-t)*x2 + (parts-t)*(parts-t)*x1)/(double)(parts*parts);
640 double ny = (double)(t*t*y3 + 2*t*(parts-t)*y2 + (parts-t)*(parts-t)*y1)/(double)(parts*parts);
642 add_line(dev, xx, yy, nx, ny);
653 void render_startclip(struct _gfxdevice*dev, gfxline_t*line)
655 internal_t*i = (internal_t*)dev->internal;
657 memset(&info, 0, sizeof(info));
659 info.type = filltype_clip;
660 draw_line(dev, line);
664 void render_endclip(struct _gfxdevice*dev)
666 internal_t*i = (internal_t*)dev->internal;
670 void render_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
672 internal_t*i = (internal_t*)dev->internal;
674 draw_line(dev, line);
675 fill_solid(dev, color);
678 void render_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform)
680 internal_t*i = (internal_t*)dev->internal;
682 gfxmatrix_t m2 = *matrix;
684 draw_line(dev, line);
687 memset(&info, 0, sizeof(info));
688 info.type = filltype_bitmap;
691 info.cxform = cxform;
693 m2.m00 *= i->zoom; m2.m01 *= i->zoom; m2.tx *= i->zoom;
694 m2.m10 *= i->zoom; m2.m11 *= i->zoom; m2.ty *= i->zoom;
699 void render_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
701 internal_t*i = (internal_t*)dev->internal;
703 gfxmatrix_t m2 = *matrix;
705 draw_line(dev, line);
709 memset(&info, 0, sizeof(info));
710 info.type = filltype_gradient;
714 m2.m00 *= i->zoom; m2.m01 *= i->zoom; m2.tx *= i->zoom;
715 m2.m10 *= i->zoom; m2.m11 *= i->zoom; m2.ty *= i->zoom;
717 info.clip_or_radial = type == gfxgradient_radial;
720 gfxcolor_t color = {0,0,0,0};
723 int nextpos = gradient->pos*256;
726 msg("<error> Invalid gradient- contains values > 1.0");
730 gfxcolor_t nextcolor = gradient->color;
734 double step = 1.0/(nextpos-pos);
736 for(t=pos;t<nextpos;t++) {
737 g[t].r = color.r*p0 + nextcolor.r*p1;
738 g[t].g = color.g*p0 + nextcolor.g*p1;
739 g[t].b = color.b*p0 + nextcolor.b*p1;
740 g[t].a = color.a*p0 + nextcolor.a*p1;
748 gradient = gradient->next;
751 msg("<error> Invalid gradient- doesn't end with 1.0");
757 void render_addfont(struct _gfxdevice*dev, gfxfont_t*font)
761 void render_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
763 internal_t*i = (internal_t*)dev->internal;
767 /* align characters to whole pixels */
768 matrix->tx = (int)(matrix->tx * i->antialize) / i->antialize;
769 matrix->ty = (int)(matrix->ty * i->antialize) / i->antialize;
771 gfxglyph_t*glyph = &font->glyphs[glyphnr];
772 gfxline_t*line2 = gfxline_clone(glyph->line);
773 gfxline_transform(line2, matrix);
774 draw_line(dev, line2);
775 fill_solid(dev, color);
781 void render_result_write(gfxresult_t*r, int filedesc)
783 internal_result_t*i= (internal_result_t*)r->internal;
785 int render_result_save(gfxresult_t*r, const char*filename)
787 internal_result_t*i= (internal_result_t*)r->internal;
789 return 0; // no pages drawn
793 char filenamebuf[256];
794 char*origname = strdup(filename);
795 int l = strlen(origname);
796 if(l>3 && strchr("gG",origname[l-1]) && strchr("nN",filename[l-2]) &&
797 strchr("pP",origname[l-3]) && filename[l-4]=='.') {
801 sprintf(filenamebuf, "%s.%d.png", origname, nr);
803 writePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
805 writePalettePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
811 writePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
815 char*gfximage_asXPM(gfximage_t*img, int depth)
818 char*str = (char*)malloc(img->width*img->height*4 + 500 + 16*depth*depth*depth);
820 p+= sprintf(p, "static char *noname[] = {\n\"%d %d 262144 3\",\n");
824 for(b=0;b<depth;b++) {
825 p += sprintf(p, "\"%c%c%c c #%02x%02x%02x\",\n", r+32,g+32,b+32, r*d,g*d,b*d);
828 for(y=0;y<img->height;y++) {
830 gfxcolor_t*col = &img->data[y*img->height];
832 for(x=0;x<img->width;x++) {
833 p+=sprintf(p, "%c%c%c", 32+(col->r/d), 32+(col->g/d), 32+(col->b/d));
835 p+=sprintf(p, "\",\n");
840 void*render_result_get(gfxresult_t*r, const char*name)
842 internal_result_t*i= (internal_result_t*)r->internal;
843 if(!strncmp(name,"xpm",3)) {
844 int pagenr = atoi(&name[3]);
853 return gfximage_asXPM(&i->img, 64);
854 } else if(!strncmp(name,"page",4)) {
855 int pagenr = atoi(&name[4]);
868 void render_result_destroy(gfxresult_t*r)
870 internal_result_t*i= (internal_result_t*)r->internal;
873 internal_result_t*next = i->next;
874 free(i->img.data);i->img.data = 0;
877 the following rfx_free causes a segfault on WIN32 machines,
886 gfxresult_t* render_finish(struct _gfxdevice*dev)
888 internal_t*i = (internal_t*)dev->internal;
890 gfxresult_t* res = (gfxresult_t*)rfx_calloc(sizeof(gfxresult_t));
892 res->internal = i->results;i->results = 0;
893 res->write = render_result_write;
894 res->save = render_result_save;
895 res->get = render_result_get;
896 res->destroy = render_result_destroy;
898 free(dev->internal); dev->internal = 0; i = 0;
903 void render_startpage(struct _gfxdevice*dev, int width, int height)
905 internal_t*i = (internal_t*)dev->internal;
908 if(i->width2 || i->height2) {
909 fprintf(stderr, "Error: startpage() called twice (no endpage()?)\n");
913 i->width = width*i->multiply;
914 i->height = height*i->multiply;
915 i->width2 = width*i->zoom;
916 i->height2 = height*i->zoom;
917 i->bitwidth = (i->width2+31)/32;
919 i->lines = (renderline_t*)rfx_alloc(i->height2*sizeof(renderline_t));
920 for(y=0;y<i->height2;y++) {
921 memset(&i->lines[y], 0, sizeof(renderline_t));
922 i->lines[y].points = 0;
925 i->img = (RGBA*)rfx_calloc(sizeof(RGBA)*i->width2*i->height2);
927 memset(i->img, 0xff, sizeof(RGBA)*i->width2*i->height2);
930 i->ymin = 0x7fffffff;
931 i->ymax = -0x80000000;
934 /* initialize initial clipping field, which doesn't clip anything yet */
936 memset(i->clipbuf->data, 255, sizeof(U32)*i->bitwidth*i->height2);
939 static void store_image(internal_t*i, internal_result_t*ir)
941 ir->img.data = (gfxcolor_t*)malloc(i->width*i->height*sizeof(gfxcolor_t));
942 ir->img.width = i->width;
943 ir->img.height = i->height;
945 gfxcolor_t*dest = ir->img.data;
947 if(i->antialize <= 1) /* no antializing */ {
949 for(y=0;y<i->height;y++) {
950 RGBA*line = &i->img[y*i->width];
951 memcpy(&dest[y*i->width], line, sizeof(RGBA)*i->width);
954 RGBA**lines = (RGBA**)rfx_calloc(sizeof(RGBA*)*i->antialize);
955 int q = i->antialize*i->antialize;
959 for(y=0;y<i->height2;y++) {
961 ypos = y % i->antialize;
962 lines[ypos] = &i->img[y*i->width2];
963 if(ypos == i->antialize-1) {
964 RGBA*out = &dest[(y2++)*i->width];
967 for(x=0;x<i->width;x++) {
968 int xpos = x*i->antialize;
971 for(yp=0;yp<i->antialize;yp++) {
972 RGBA*lp = &lines[yp][xpos];
974 for(xp=0;xp<i->antialize;xp++) {
993 void render_endpage(struct _gfxdevice*dev)
995 internal_t*i = (internal_t*)dev->internal;
997 if(!i->width2 || !i->height2) {
998 fprintf(stderr, "Error: endpage() called without corresponding startpage()\n");
1010 fprintf(stderr, "Warning: %d unclosed clip(s) while processing endpage()\n", unclosed);
1013 internal_result_t*ir= (internal_result_t*)rfx_calloc(sizeof(internal_result_t));
1014 ir->palette = i->palette;
1021 if(i->result_next) {
1022 i->result_next->next = ir;
1027 i->result_next = ir;
1029 for(y=0;y<i->height2;y++) {
1030 rfx_free(i->lines[y].points); i->lines[y].points = 0;
1032 rfx_free(i->lines);i->lines=0;
1034 if(i->img) {rfx_free(i->img);i->img = 0;}
1040 void render_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
1042 /* not supported for this output device */
1045 void gfxdevice_render_init(gfxdevice_t*dev)
1047 internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
1048 memset(dev, 0, sizeof(gfxdevice_t));
1050 dev->name = "render";
1062 dev->setparameter = render_setparameter;
1063 dev->startpage = render_startpage;
1064 dev->startclip = render_startclip;
1065 dev->endclip = render_endclip;
1066 dev->stroke = render_stroke;
1067 dev->fill = render_fill;
1068 dev->fillbitmap = render_fillbitmap;
1069 dev->fillgradient = render_fillgradient;
1070 dev->addfont = render_addfont;
1071 dev->drawchar = render_drawchar;
1072 dev->drawlink = render_drawlink;
1073 dev->endpage = render_endpage;
1074 dev->finish = render_finish;
1078 gfxdevice_t* gfxdevice_render_new()
1080 gfxdevice_t* d = (gfxdevice_t*)malloc(sizeof(gfxdevice_t));
1081 gfxdevice_render_init(d);