X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Frender.c;h=30a0b593fe26d93901c1b3e2e1859e82aec5ce62;hb=3fb27a120f9fa3bfb4c06d65ca2ae2b3119668a1;hp=20c4dd800bc7d834bf21eb06f67aec4c85984a9c;hpb=9ccf6217181fcc891d198ae75ebbd5d05b198b89;p=swftools.git diff --git a/lib/devices/render.c b/lib/devices/render.c index 20c4dd8..30a0b59 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -64,6 +64,7 @@ typedef struct _internal { int antialize; int zoom; int ymin, ymax; + int fillwhite; RGBA* img; @@ -448,10 +449,15 @@ int render_setparameter(struct _gfxdevice*dev, const char*key, const char*value) if(!strcmp(key, "antialize")) { i->antialize = atoi(value); i->zoom = i->antialize * i->multiply; + return 1; } else if(!strcmp(key, "multiply")) { i->multiply = atoi(value); i->zoom = i->antialize * i->multiply; fprintf(stderr, "Warning: multiply not implemented yet\n"); + return 1; + } else if(!strcmp(key, "fillwhite")) { + i->fillwhite = atoi(value); + return 1; } return 0; } @@ -491,9 +497,9 @@ void render_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxc internal_t*i = (internal_t*)dev->internal; double x,y; - if(cap_style != gfx_capRound || joint_style != gfx_joinRound) { + /*if(cap_style != gfx_capRound || joint_style != gfx_joinRound) { fprintf(stderr, "Warning: cap/joint style != round not yet supported\n"); - } + }*/ while(line) { int x1,y1,x2,y2,x3,y3; @@ -644,6 +650,10 @@ void render_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolo { internal_t*i = (internal_t*)dev->internal; + /* align characters to whole pixels */ + matrix->tx = (int)(matrix->tx * i->antialize) / i->antialize; + matrix->ty = (int)(matrix->ty * i->antialize) / i->antialize; + gfxglyph_t*glyph = &font->glyphs[glyphnr]; gfxline_t*line2 = gfxline_clone(glyph->line); gfxline_transform(line2, matrix); @@ -660,7 +670,7 @@ void render_result_write(gfxresult_t*r, int filedesc) } int render_result_save(gfxresult_t*r, char*filename) { - internal_result_t*i= (internal_result_t*)r->internal; + /*internal_result_t*i= (internal_result_t*)r->internal; if(i->next) { int nr=0; while(i->next) { @@ -669,7 +679,7 @@ int render_result_save(gfxresult_t*r, char*filename) } } else { writePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height); - } + }*/ return 1; } void*render_result_get(gfxresult_t*r, char*name) @@ -741,6 +751,10 @@ void render_startpage(struct _gfxdevice*dev, int width, int height) i->lines[y].num = 0; } i->img = (RGBA*)rfx_calloc(sizeof(RGBA)*i->width2*i->height2); + if(i->fillwhite) { + memset(i->img, 0xff, sizeof(RGBA)*i->width2*i->height2); + } + i->ymin = 0x7fffffff; i->ymax = -0x80000000;