X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Fswf.c;h=24b090ad21e1e5a9f4d388c405c3ce86dceb9305;hb=36dda3dbc6f9fb51d1f9dafa0f06e52a097df9ea;hp=ab6734fa0dd8253f8b53c98b579bc90e971dd436;hpb=80cc20b7784cccc9d8baf9839f9781db6bb6f539;p=swftools.git diff --git a/lib/devices/swf.c b/lib/devices/swf.c index ab6734f..24b090a 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -79,6 +79,7 @@ typedef struct _swfoutput_internal int config_insertstoptag; int config_flashversion; int config_reordertags; + int config_showclipshapes; int config_splinemaxerror; int config_fontsplinemaxerror; int config_filloverlap; @@ -235,6 +236,7 @@ static swfoutput_internal* init_internal_struct() i->config_filloverlap=0; i->config_protect=0; i->config_bboxvars=0; + i->config_showclipshapes=0; i->config_minlinewidth=0.05; i->config_caplinewidth=1; i->config_linktarget=0; @@ -1775,6 +1777,8 @@ int swf_setparameter(gfxdevice_t*dev, const char*name, const char*value) i->config_enablezlib = atoi(value); } else if(!strcmp(name, "bboxvars")) { i->config_bboxvars = atoi(value); + } else if(!strcmp(name, "showclipshapes")) { + i->config_showclipshapes = atoi(value); } else if(!strcmp(name, "reordertags")) { i->config_reordertags = atoi(value); } else if(!strcmp(name, "internallinkfunction")) { @@ -2045,6 +2049,34 @@ static void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxm swf_ObjectPlace(i->tag,myshapeid,getNewDepth(dev),&i->page_matrix,&cxform2,NULL); } +static RGBA col_black = {255,0,0,0}; + +static void drawoutline(gfxdevice_t*dev, gfxline_t*line) +{ + swfoutput_internal*i = (swfoutput_internal*)dev->internal; + + int myshapeid = getNewID(dev); + i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3); + + SHAPE*shape; + swf_ShapeNew(&shape); + int lsid = swf_ShapeAddLineStyle(shape,1,&col_black); + + swf_SetU16(i->tag,myshapeid); + SRECT r = gfxline_getSWFbbox(line); + swf_SetRect(i->tag,&r); + swf_SetShapeStyles(i->tag,shape); + swf_ShapeCountBits(shape,NULL,NULL); + swf_SetShapeBits(i->tag,shape); + swf_ShapeSetAll(i->tag,shape,UNDEFINED_COORD,UNDEFINED_COORD,lsid,0,0); + drawgfxline(dev, line); + swf_ShapeSetEnd(i->tag); + swf_ShapeFree(shape); + + i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); + swf_ObjectPlace(i->tag, myshapeid, getNewDepth(dev), 0,0,0); +} + static void swf_startclip(gfxdevice_t*dev, gfxline_t*line) { swfoutput_internal*i = (swfoutput_internal*)dev->internal; @@ -2058,6 +2090,9 @@ static void swf_startclip(gfxdevice_t*dev, gfxline_t*line) i->clippos --; } + if(i->config_showclipshapes) + drawoutline(dev, line); + int myshapeid = getNewID(dev); i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3); RGBA col; @@ -2078,7 +2113,16 @@ static void swf_startclip(gfxdevice_t*dev, gfxline_t*line) swf_SetShapeBits(i->tag,shape); swf_ShapeSetAll(i->tag,shape,UNDEFINED_COORD,UNDEFINED_COORD,0,fsid,0); i->swflastx = i->swflasty = UNDEFINED_COORD; + i->shapeisempty = 1; drawgfxline(dev, line); + if(i->shapeisempty) { + /* an empty clip shape is equivalent to a shape with no area */ + int x = line?line->x:0; + int y = line?line->y:0; + moveto(dev, i->tag, x,y); + lineto(dev, i->tag, x,y); + lineto(dev, i->tag, x,y); + } swf_ShapeSetEnd(i->tag); swf_ShapeFree(shape); @@ -2332,7 +2376,7 @@ static void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*grad msg(" Gradient filling not implemented yet"); } -static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, char* id) +static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, const char* id) { SWFFONT*swffont = (SWFFONT*)rfx_calloc(sizeof(SWFFONT)); int t; @@ -2473,7 +2517,7 @@ static void swf_addfont(gfxdevice_t*dev, gfxfont_t*font) } } -static void swf_switchfont(gfxdevice_t*dev, char*fontid) +static void swf_switchfont(gfxdevice_t*dev, const char*fontid) { swfoutput_internal*i = (swfoutput_internal*)dev->internal;