+ m = i->page_matrix;
+ m.tx = p.x;
+ m.ty = p.y;
+ swf_ObjectPlace(i->tag, buttonid, getNewDepth(dev),&m,0,0);
+ } else {
+ swf_ObjectPlace(i->tag, buttonid, getNewDepth(dev),&i->page_matrix,0,0);
+ }
+}
+
+
+///////////
+/*
+for(t=0;t<picpos;t++)
+ {
+ if(pic_xids[t] == xid &&
+ pic_yids[t] == yid) {
+ width = pic_width[t];
+ height = pic_height[t];
+ found = t;break;
+ }
+ }
+ pic_ids[picpos] = swfoutput_drawimagelosslessN(&output, pic, pal, width, height, x1,y1,x2,y2,x3,y3,x4,y4, numpalette);
+ pic_xids[picpos] = xid;
+ pic_yids[picpos] = yid;
+ pic_width[picpos] = width;
+ pic_height[picpos] = height;
+ if(picpos<1024)
+ picpos++;
+ pic[width*y+x] = buf[0];
+ xid+=x*buf[0]+1;
+ yid+=y*buf[0]*3+1;
+
+ xid += pal[1].r*3 + pal[1].g*11 + pal[1].b*17;
+ yid += pal[1].r*7 + pal[1].g*5 + pal[1].b*23;
+
+ int xid = 0;
+ int yid = 0;
+ xid += x*r+x*b*3+x*g*7+x*a*11;
+ yid += y*r*3+y*b*17+y*g*19+y*a*11;
+ int t,found = -1;
+ for(t=0;t<picpos;t++)
+ {
+ if(pic_xids[t] == xid &&
+ pic_yids[t] == yid) {
+ found = t;break;
+ }
+ }
+ if(found<0) {
+*/
+///////////
+
+
+int swf_setparameter(gfxdevice_t*dev, const char*name, const char*value)
+{
+ swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+
+ if(!strcmp(name, "jpegsubpixels")) {
+ i->config_jpegsubpixels = atof(value);
+ } else if(!strcmp(name, "ppmsubpixels")) {
+ i->config_ppmsubpixels = atof(value);
+ } else if(!strcmp(name, "drawonlyshapes")) {
+ i->config_drawonlyshapes = atoi(value);
+ } else if(!strcmp(name, "ignoredraworder")) {
+ i->config_ignoredraworder = atoi(value);
+ } else if(!strcmp(name, "filloverlap")) {
+ i->config_filloverlap = atoi(value);
+ } else if(!strcmp(name, "linksopennewwindow")) {
+ i->config_opennewwindow = atoi(value);
+ } else if(!strcmp(name, "opennewwindow")) {
+ i->config_opennewwindow = atoi(value);
+ } else if(!strcmp(name, "storeallcharacters")) {
+ i->config_storeallcharacters = atoi(value);
+ } else if(!strcmp(name, "enablezlib")) {
+ i->config_enablezlib = atoi(value);
+ } else if(!strcmp(name, "bboxvars")) {
+ i->config_bboxvars = atoi(value);
+ } else if(!strcmp(name, "insertstop")) {
+ i->config_insertstoptag = atoi(value);
+ } else if(!strcmp(name, "protected")) {
+ i->config_protect = atoi(value);
+ } else if(!strcmp(name, "flashversion")) {
+ i->config_flashversion = atoi(value);
+ } else if(!strcmp(name, "minlinewidth")) {
+ i->config_minlinewidth = atof(value);
+ } else if(!strcmp(name, "caplinewidth")) {
+ i->config_caplinewidth = atof(value);
+ } else if(!strcmp(name, "dumpfonts")) {
+ i->config_dumpfonts = atoi(value);
+ } else if(!strcmp(name, "next_bitmap_is_jpeg")) {
+ i->jpeg = 1;
+ } else if(!strcmp(name, "jpegquality")) {
+ int val = atoi(value);
+ if(val<0) val=0;
+ if(val>100) val=100;
+ i->config_jpegquality = val;
+ } else if(!strcmp(name, "splinequality")) {
+ int v = atoi(value);
+ v = 500-(v*5); // 100% = 0.25 pixel, 0% = 25 pixel
+ if(v<1) v = 1;
+ i->config_splinemaxerror = v;
+ } else if(!strcmp(name, "fontquality")) {
+ int v = atoi(value);
+ v = 500-(v*5); // 100% = 0.25 pixel, 0% = 25 pixel
+ if(v<1) v = 1;
+ i->config_fontsplinemaxerror = v;
+ } else {
+ fprintf(stderr, "unknown parameter: %s (=%s)\n", name, value);
+ return 0;
+ }
+ return 1;
+}
+
+// --------------------------------------------------------------------
+
+static CXFORM gfxcxform_to_cxform(gfxcxform_t* c)
+{
+ CXFORM cx;
+ swf_GetCXForm(0, &cx, 1);
+ if(!c)
+ return cx;
+ if(c->rg!=0 || c->rb!=0 || c->ra!=0 ||
+ c->gr!=0 || c->gb!=0 || c->ga!=0 ||
+ c->br!=0 || c->bg!=0 || c->ba!=0 ||
+ c->ar!=0 || c->ag!=0 || c->ab!=0)
+ msg("<warning> CXForm not SWF-compatible");
+
+ cx.a0 = (S16)(c->aa*256);
+ cx.r0 = (S16)(c->rr*256);
+ cx.g0 = (S16)(c->gg*256);
+ cx.b0 = (S16)(c->bb*256);
+ cx.a1 = c->t.a;
+ cx.r1 = c->t.r;
+ cx.g1 = c->t.g;
+ cx.b1 = c->t.b;
+ return cx;
+}
+
+static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line)
+{
+ ArtVpath *vec = NULL;
+ int pos=0,len=0;
+ gfxline_t*l2;
+ double x=0,y=0;
+
+ /* factor which determines into how many line fragments a spline is converted */
+ double subfraction = 2.4;//0.3
+
+ l2 = line;
+ while(l2) {
+ if(l2->type == gfx_moveTo) {
+ pos ++;
+ } if(l2->type == gfx_lineTo) {
+ pos ++;
+ } if(l2->type == gfx_splineTo) {
+ int parts = (int)(sqrt(fabs(l2->x-2*l2->sx+x) + fabs(l2->y-2*l2->sy+y))*subfraction);
+ if(!parts) parts = 1;
+ pos += parts + 1;
+ }
+ x = l2->x;
+ y = l2->y;
+ l2 = l2->next;