fixed gfxfont_free() prototype
[swftools.git] / pdf2swf / swfoutput.cc
index ee7bebb..f855461 100644 (file)
@@ -59,9 +59,10 @@ struct fontlist_t
     fontlist_t*next;
 };
 
+double config_dumpfonts=0;
 double config_ppmsubpixels=0;
 double config_jpegsubpixels=0;
-int config_opennewwindow=0;
+int config_opennewwindow=1;
 int config_ignoredraworder=0;
 int config_drawonlyshapes=0;
 int config_jpegquality=85;
@@ -73,6 +74,7 @@ int config_splinemaxerror=1;
 int config_fontsplinemaxerror=1;
 int config_filloverlap=0;
 int config_protect=0;
+int config_bboxvars=0;
 float config_minlinewidth=0.05;
 double config_caplinewidth=1;
 
@@ -137,6 +139,8 @@ typedef struct _swfoutput_internal
     int firstpage;
     char pagefinished;
 
+    char overflow;
+
     /* during the transition to the gfxdevice interface:
        a device which uses this swfoutput as target */
     gfxdevice_t device;
@@ -151,7 +155,7 @@ void swf_endclip(gfxdevice_t*dev);
 void swf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit);
 void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color);
 void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform);
-void swf_fillgradient(gfxdevice_t*dev, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix);
+void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix);
 
 static swfoutput_internal* init_internal_struct()
 {
@@ -160,8 +164,9 @@ static swfoutput_internal* init_internal_struct()
 
     i->storefont = 0;
     i->currentswfid = 0;
-    i->depth = 1;
-    i->startdepth = 1;
+    i->depth = 0;
+    i->overflow = 0;
+    i->startdepth = 0;
     i->linewidth = 0;
     i->shapeid = -1;
     i->textid = -1;
@@ -197,6 +202,31 @@ static swfoutput_internal* init_internal_struct()
     return i;
 };
 
+static int id_error = 0;
+
+static U16 getNewID(struct swfoutput* obj)
+{
+    swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+    if(i->currentswfid == 65535) {
+       if(!id_error)
+           msg("<error> ID Table overflow");
+       id_error=1;
+       i->overflow = 1;
+    }
+    return ++i->currentswfid;
+}
+static U16 getNewDepth(struct swfoutput* obj)
+{
+    swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+    if(i->depth == 65535) {
+       if(!id_error)
+           msg("<error> Depth Table overflow");
+       id_error=1;
+       i->overflow = 1;
+    }
+    return ++i->depth;
+}
+
 static void startshape(struct swfoutput* obj);
 static void starttext(struct swfoutput* obj);
 static void endshape(struct swfoutput* obj);
@@ -685,6 +715,9 @@ static void putcharacter(struct swfoutput*obj, int fontid, int charid, int x,int
    If we set it to low, however, the char positions will be inaccurate */
 #define FONT_INTERNAL_SIZE 4
 
+static int font_active = 0;
+static char* font_active_filename = 0;
+
 /* process a character. */
 static int drawchar(struct swfoutput*obj, SWFFONT *swffont, char*character, int charnr, int u, swfmatrix*m, gfxcolor_t*col)
 {
@@ -695,12 +728,28 @@ static int drawchar(struct swfoutput*obj, SWFFONT *swffont, char*character, int
     }
 
     int charid = getCharID(swffont, charnr, character, u); 
+    if(font_active) {
+       char buf[1024];
+       sprintf(buf, "%s.usage", font_active_filename);
+       FILE*fi = fopen(buf, "ab+");
+       if(fi) {
+            fprintf(fi, "%d %d %d %s\n", charnr, u, charid, character);
+            fclose(fi);
+       } else 
+           msg("<error> Couldn't write to %s", buf);
+    }
     
     if(charid<0) {
        msg("<warning> Didn't find character '%s' (c=%d,u=%d) in current charset (%s, %d characters)", 
                FIXNULL(character),charnr, u, FIXNULL((char*)swffont->name), swffont->numchars);
        return 0;
     }
+    /*if(swffont->glyph[charid].shape->bitlen <= 16) {
+       msg("<warning> Character '%s' (c=%d,u=%d), glyph %d in current charset (%s, %d characters) is empty", 
+               FIXNULL(character),charnr, u, charid, FIXNULL((char*)swffont->name), swffont->numchars);
+       return 0;
+    }*/
+
 
     if(i->shapeid>=0)
        endshape(obj);
@@ -774,14 +823,15 @@ static void endtext(swfoutput*obj)
     swf_GetMatrix(0, &m); /* set unit matrix- the real matrix is in the placeobject */
     swf_SetMatrix(i->tag,&m);
 
+    msg("<trace> Placing text (%d characters) as ID %d", i->chardatapos, i->textid);
+
     putcharacters(obj, i->tag);
     swf_SetU8(i->tag,0);
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
-    //swf_ObjectPlace(i->tag,i->textid,/*depth*/i->depth++,&i->page_matrix,NULL,NULL);
     MATRIX m2;
     swf_MatrixJoin(&m2,&obj->fontmatrix, &i->page_matrix);
 
-    swf_ObjectPlace(i->tag,i->textid,/*depth*/i->depth++,&m2,NULL,NULL);
+    swf_ObjectPlace(i->tag,i->textid,getNewDepth(obj),&m2,NULL,NULL);
     i->textid = -1;
 }
 
@@ -831,11 +881,11 @@ int getCharID(SWFFONT *font, int charnr, char *charname, int u)
     return -1;
 }
 
-
 /* set's the t1 font index of the font to use for swfoutput_drawchar(). */
 void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename)
 {
     swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+    font_active = 0;
     fontlist_t*last=0,*iterator;
     if(!fontid) {
        msg("<error> No fontid");
@@ -867,6 +917,11 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename)
     swf_SetLoadFontParameters(64,/*skip unused*/0,/*full unicode*/1);
     SWFFONT*swffont = swf_LoadFont(filename);
 
+    if(config_dumpfonts) {
+       font_active = 1;
+       font_active_filename = strdup(filename);
+    }
+
     if(swffont == 0) {
        msg("<warning> Couldn't load font %s (%s)", fontid, filename);
        swffont = swf_LoadFont(0);
@@ -892,15 +947,19 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename)
             swffont->encoding = 255;
         }
     }
+    
+    if(swffont->encoding != FONT_ENCODING_UNICODE && swffont->encoding != 255) {
+       msg("<warning> Non-unicode mapping for font %s (%s)", fontid, filename);
+    }
 
-    swf_FontSetID(swffont, ++i->currentswfid);
+    swf_FontSetID(swffont, getNewID(obj));
     
     if(getScreenLogLevel() >= LOGLEVEL_DEBUG)  {
        // print font information
-       msg("<debug> Font %s (%s)",swffont->name, filename);
+       msg("<debug> Font %s (%s)",fontid, filename);
        msg("<debug> |   ID: %d", swffont->id);
        msg("<debug> |   Version: %d", swffont->version);
-       msg("<debug> |   Name: %s", fontid);
+       msg("<debug> |   Name: %s", swffont->name);
        msg("<debug> |   Numchars: %d", swffont->numchars);
        msg("<debug> |   Maxascii: %d", swffont->maxascii);
        msg("<debug> |   Style: %d", swffont->style);
@@ -1017,7 +1076,7 @@ void swfoutput_pagefeed(struct swfoutput*obj)
     i->tag = swf_InsertTag(i->tag,ST_SHOWFRAME);
     i->frameno ++;
     
-    for(i->depth--;i->depth>=i->startdepth;i->depth--) {
+    for(i->depth;i->depth>i->startdepth;i->depth--) {
         i->tag = swf_InsertTag(i->tag,ST_REMOVEOBJECT2);
         swf_SetU16(i->tag,i->depth);
     }
@@ -1032,7 +1091,7 @@ static void setBackground(struct swfoutput*obj, int x1, int y1, int x2, int y2)
     SRECT r;
     SHAPE* s;
     int ls1=0,fs1=0;
-    int shapeid = ++i->currentswfid;
+    int shapeid = getNewID(obj);
     r.xmin = x1;
     r.ymin = y1;
     r.xmax = x2;
@@ -1051,9 +1110,9 @@ static void setBackground(struct swfoutput*obj, int x1, int y1, int x2, int y2)
     swf_ShapeSetEnd(i->tag);
     swf_ShapeFree(s);
     i->tag = swf_InsertTag(i->tag, ST_PLACEOBJECT2);
-    swf_ObjectPlace(i->tag,shapeid,i->depth++,0,0,0);
+    swf_ObjectPlace(i->tag,shapeid,getNewDepth(obj),0,0,0);
     i->tag = swf_InsertTag(i->tag, ST_PLACEOBJECT2);
-    swf_ObjectPlaceClip(i->tag,shapeid,i->depth++,0,0,0,65535);
+    swf_ObjectPlaceClip(i->tag,shapeid,getNewDepth(obj),0,0,0,65535);
     i->cliptag = i->tag;
 }
 
@@ -1070,7 +1129,7 @@ void swfoutput_newpage(struct swfoutput*obj, int pageNum, int movex, int movey,
     if(i->cliptag && i->frameno == i->lastframeno) {
         SWFPLACEOBJECT obj;
         swf_GetPlaceObject(i->cliptag, &obj);
-        obj.clipdepth = i->depth++;
+        obj.clipdepth = i->depth;
         swf_ResetTag(i->cliptag, i->cliptag->id);
         swf_SetPlaceObject(i->cliptag, &obj);
         swf_PlaceObjectFree(&obj);
@@ -1132,7 +1191,7 @@ void swfoutput_init(struct swfoutput* obj)
     rgb.a = rgb.r = rgb.g = rgb.b = 0xff;
     swf_SetRGB(i->tag,&rgb);
 
-    i->startdepth = i->depth = 3; /* leave room for clip and background rectangle */
+    i->startdepth = i->depth = 0;
     
     if(config_protect)
       i->tag = swf_InsertTag(i->tag, ST_PROTECT);
@@ -1155,7 +1214,7 @@ static void startshape(struct swfoutput*obj)
     i->linestyleid = swf_ShapeAddLineStyle(i->shape,i->linewidth,&obj->strokergb);
     i->fillstyleid = swf_ShapeAddSolidFillStyle(i->shape,&obj->fillrgb);
 
-    i->shapeid = ++i->currentswfid;
+    i->shapeid = getNewID(obj);
     
     msg("<debug> Using shape id %d", i->shapeid);
 
@@ -1188,7 +1247,7 @@ static void starttext(struct swfoutput*obj)
     if(i->shapeid>=0)
         endshape(obj);
       
-    i->textid = ++i->currentswfid;
+    i->textid = getNewID(obj);
 
     i->swflastx=i->swflasty=0;
 }
@@ -1314,7 +1373,7 @@ static void endshape(swfoutput*obj)
     msg("<trace> Placing shape id %d", i->shapeid);
 
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
-    swf_ObjectPlace(i->tag,i->shapeid,/*depth*/i->depth++,&i->page_matrix,NULL,NULL);
+    swf_ObjectPlace(i->tag,i->shapeid,getNewDepth(obj),&i->page_matrix,NULL,NULL);
 
     swf_ShapeFree(i->shape);
     i->shape = 0;
@@ -1339,6 +1398,22 @@ static void endshape(swfoutput*obj)
     }*/
 }
 
+void wipeSWF(SWF*swf)
+{
+    TAG*tag = swf->firstTag;
+    while(tag) {
+       TAG*next = tag->next;
+       if(tag->id != ST_SETBACKGROUNDCOLOR &&
+          tag->id != ST_END &&
+          tag->id != ST_DOACTION &&
+          tag->id != ST_SHOWFRAME) {
+           swf_DeleteTag(tag);
+       }
+       tag = next;
+    }
+}
+
+
 void swfoutput_finalize(struct swfoutput*obj)
 {
     swfoutput_internal*i = (swfoutput_internal*)obj->internal;
@@ -1346,6 +1421,32 @@ void swfoutput_finalize(struct swfoutput*obj)
     if(i->tag && i->tag->id == ST_END)
         return; //already done
 
+    if(config_bboxvars) {
+       TAG* tag = swf_InsertTag(i->swf.firstTag, ST_DOACTION);
+       ActionTAG*a = 0;
+       a = action_PushString(a, "xmin");
+       a = action_PushFloat(a, i->swf.movieSize.xmin / 20.0);
+       a = action_SetVariable(a);
+       a = action_PushString(a, "ymin");
+       a = action_PushFloat(a, i->swf.movieSize.ymin / 20.0);
+       a = action_SetVariable(a);
+       a = action_PushString(a, "xmax");
+       a = action_PushFloat(a, i->swf.movieSize.xmax / 20.0);
+       a = action_SetVariable(a);
+       a = action_PushString(a, "ymax");
+       a = action_PushFloat(a, i->swf.movieSize.ymax / 20.0);
+       a = action_SetVariable(a);
+       a = action_PushString(a, "width");
+       a = action_PushFloat(a, (i->swf.movieSize.xmax - i->swf.movieSize.xmin) / 20.0);
+       a = action_SetVariable(a);
+       a = action_PushString(a, "height");
+       a = action_PushFloat(a, (i->swf.movieSize.ymax - i->swf.movieSize.ymin) / 20.0);
+       a = action_SetVariable(a);
+       a = action_End(a);
+       swf_ActionSet(tag, a);
+       swf_ActionFree(a);
+    }
+
     if(i->frameno == i->lastframeno) // fix: add missing pagefeed
         swfoutput_pagefeed(obj);
 
@@ -1372,6 +1473,10 @@ void swfoutput_finalize(struct swfoutput*obj)
         swf_DeleteTag(tag);
         tag = prev;
     }
+    
+    if(i->overflow) {
+       wipeSWF(&i->swf);
+    }
 }
 
 SWF* swfoutput_get(struct swfoutput*obj)
@@ -1418,7 +1523,6 @@ int swfoutput_save(struct swfoutput* obj, char*filename)
 
     if(filename)
      close(fi);
-    msg("<notice> SWF written\n");
     return 1;
 }
 
@@ -1511,7 +1615,7 @@ void swfoutput_linktourl(struct swfoutput*obj, char*url, swfcoord*points)
     if(i->textid>=0)
        endtext(obj);
     
-    if(config_opennewwindow)
+    if(!config_opennewwindow)
       actions = action_GetUrl(0, url, "_parent");
     else
       actions = action_GetUrl(0, url, "_this");
@@ -1602,7 +1706,7 @@ static void drawlink(struct swfoutput*obj, ActionTAG*actions1, ActionTAG*actions
     double posx = 0;
     double posy = 0;
     int t;
-    int buttonid = ++i->currentswfid;
+    int buttonid = getNewID(obj);
     for(t=1;t<4;t++)
     {
         if(points[t].x>xmax) xmax=points[t].x;
@@ -1624,7 +1728,7 @@ static void drawlink(struct swfoutput*obj, ActionTAG*actions1, ActionTAG*actions
     xmax -= posx; ymax -= posy;
     
     /* shape */
-    myshapeid = ++i->currentswfid;
+    myshapeid = getNewID(obj);
     i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3);
     swf_ShapeNew(&i->shape);
     rgb.r = rgb.b = rgb.a = rgb.g = 0; 
@@ -1648,7 +1752,7 @@ static void drawlink(struct swfoutput*obj, ActionTAG*actions1, ActionTAG*actions
     swf_ShapeSetEnd(i->tag);
 
     /* shape2 */
-    myshapeid2 = ++i->currentswfid;
+    myshapeid2 = getNewID(obj);
     i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3);
     swf_ShapeNew(&i->shape);
     rgb.r = rgb.b = rgb.a = rgb.g = 255;
@@ -1719,10 +1823,9 @@ static void drawlink(struct swfoutput*obj, ActionTAG*actions1, ActionTAG*actions
         m = i->page_matrix;
         m.tx = p.x;
         m.ty = p.y;
-       swf_ObjectPlace(i->tag, buttonid, i->depth++,&m,0,0);
-    }
-    else {
-       swf_ObjectPlace(i->tag, buttonid, i->depth++,&i->page_matrix,0,0);
+       swf_ObjectPlace(i->tag, buttonid, getNewDepth(obj),&m,0,0);
+    } else {
+       swf_ObjectPlace(i->tag, buttonid, getNewDepth(obj),&i->page_matrix,0,0);
     }
 }
 
@@ -1916,6 +2019,8 @@ void swfoutput_setparameter(char*name, char*value)
        config_storeallcharacters = atoi(value);
     } else if(!strcmp(name, "enablezlib")) {
        config_enablezlib = atoi(value);
+    } else if(!strcmp(name, "bboxvars")) {
+       config_bboxvars = atoi(value);
     } else if(!strcmp(name, "insertstop")) {
        config_insertstoptag = atoi(value);
     } else if(!strcmp(name, "protected")) {
@@ -1926,6 +2031,8 @@ void swfoutput_setparameter(char*name, char*value)
        config_minlinewidth = atof(value);
     } else if(!strcmp(name, "caplinewidth")) {
        config_caplinewidth = atof(value);
+    } else if(!strcmp(name, "dumpfonts")) {
+       config_dumpfonts = atoi(value);
     } else if(!strcmp(name, "jpegquality")) {
        int val = atoi(value);
        if(val<0) val=0;
@@ -2078,11 +2185,20 @@ gfxline_t* SVPtogfxline(ArtSVP*svp)
     }
 }
 
+/* TODO */
+static int imageInCache(swfoutput*obj, void*data, int width, int height)
+{
+    return -1;
+}
+static void addImageToCache(swfoutput*obj, void*data, int width, int height)
+{
+}
+    
 static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int targetheight, int* newwidth, int* newheight)
 {
+    swfoutput*obj = i->obj;
     RGBA*newpic = 0;
     RGBA*mem = (RGBA*)img->data;
-    int bitid = ++i->currentswfid;
     
     int sizex = img->width;
     int sizey = img->height;
@@ -2109,6 +2225,7 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
     *newheight  = sizey;
     
     if(newsizex<sizex || newsizey<sizey) {
+       msg("<notice> Scaling %dx%d image to %dx%d", sizex, sizey, newsizex, newsizey);
        newpic = swf_ImageScale(mem, sizex, sizey, newsizex, newsizey);
        *newwidth = sizex = newsizex;
        *newheight  = sizey = newsizey;
@@ -2128,11 +2245,30 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int
            /*newsizex, newsizey,*/
            num_colors>256?">":"", num_colors>256?256:num_colors);
 
-    i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality);
+    /*RGBA* pal = (RGBA*)rfx_alloc(sizeof(RGBA)*num_colors);
+    swf_ImageGetNumberOfPaletteEntries(mem,sizex,sizey,pal);
+    int t;
+    for(t=0;t<num_colors;t++) {
+       printf("%02x%02x%02x%02x ",
+               pal[t].r, pal[t].g, pal[t].b, pal[t].a);
+       if((t&7)==7)
+           printf("\n");
+    }
+    printf("\n");*/
+
+    int bitid = -1;
+    int cacheid = imageInCache(obj, mem, sizex, sizey);
+
+    if(cacheid<=0) {
+       bitid = getNewID(obj);
+       i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality);
+       addImageToCache(obj, mem, sizex, sizey);
+    } else {
+       bitid = cacheid;
+    }
 
     if(newpic)
        free(newpic);
-
     return bitid;
 }
 
@@ -2174,7 +2310,7 @@ void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t
     m.ty = (int)(matrix->ty*20);
   
     /* shape */
-    int myshapeid = ++i->currentswfid;
+    int myshapeid = getNewID(obj);
     i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE);
     SHAPE*shape;
     swf_ShapeNew(&shape);
@@ -2193,7 +2329,7 @@ void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t
 
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
     CXFORM cxform2 = gfxcxform_to_cxform(cxform);
-    swf_ObjectPlace(i->tag,myshapeid,/*depth*/i->depth++,&i->page_matrix,&cxform2,NULL);
+    swf_ObjectPlace(i->tag,myshapeid,getNewDepth(obj),&i->page_matrix,&cxform2,NULL);
 }
 
 void swf_startclip(gfxdevice_t*dev, gfxline_t*line)
@@ -2210,7 +2346,7 @@ void swf_startclip(gfxdevice_t*dev, gfxline_t*line)
         i->clippos --;
     } 
 
-    int myshapeid = ++i->currentswfid;
+    int myshapeid = getNewID(obj);
     i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE);
     RGBA col;
     memset(&col, 0, sizeof(RGBA));
@@ -2234,7 +2370,7 @@ void swf_startclip(gfxdevice_t*dev, gfxline_t*line)
     i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
     i->cliptags[i->clippos] = i->tag;
     i->clipshapes[i->clippos] = myshapeid;
-    i->clipdepths[i->clippos] = i->depth++;
+    i->clipdepths[i->clippos] = getNewDepth(obj);
     i->clippos++;
 }
 
@@ -2252,7 +2388,10 @@ void swf_endclip(gfxdevice_t*dev)
         return;
     }
     i->clippos--;
-    swf_ObjectPlaceClip(i->cliptags[i->clippos],i->clipshapes[i->clippos],i->clipdepths[i->clippos],&i->page_matrix,NULL,NULL,i->depth++);
+    /*swf_ObjectPlaceClip(i->cliptags[i->clippos],i->clipshapes[i->clippos],i->clipdepths[i->clippos],&i->page_matrix,NULL,NULL,
+           / * clip to depth: * / i->depth <= i->clipdepths[i->clippos]? i->depth : i->depth - 1);
+    i->depth ++;*/
+    swf_ObjectPlaceClip(i->cliptags[i->clippos],i->clipshapes[i->clippos],i->clipdepths[i->clippos],&i->page_matrix,NULL,NULL,i->depth);
 }
 int swf_setparameter(gfxdevice_t*dev, const char*key, const char*value)
 {
@@ -2373,6 +2512,8 @@ void swf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*co
        ArtSVP* svp = gfxstrokeToSVP(line, width, cap_style, joint_style, miterLimit);
        gfxline_t*gfxline = SVPtogfxline(svp);
        dev->fill(dev, gfxline, color);
+       free(gfxline);
+       art_svp_free(svp);
     }
 }
 void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color)
@@ -2389,7 +2530,7 @@ void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color)
     drawgfxline(obj, line);
     msg("<trace> end of swf_fill (shapeid=%d)", i->shapeid);
 }
-void swf_fillgradient(gfxdevice_t*dev, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
+void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix)
 {
     msg("<error> Gradient filling not implemented yet");
 }