- swf_SetRect(tag,&r);
- swf_SetShapeStyles(tag,shape);
- swf_ShapeCountBits(shape,NULL,NULL);
- swf_SetShapeBits(tag,shape);
- swf_ShapeSetAll(tag,shape,/*x*/0,/*y*/0,0,fsid,0);
- swflastx = swflasty = 0;
- moveto(tag, p1);
- lineto(tag, p2);
- lineto(tag, p3);
- lineto(tag, p4);
- lineto(tag, p1);
- swf_ShapeSetEnd(tag);
-
- tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
- swf_ObjectPlace(tag, buttonid, depth ++, 0,0,0);
-
- tag = swf_InsertTag(tag,ST_DEFINEBUTTON);
- swf_SetU16(tag,buttonid); //id
- swf_ButtonSetFlags(tag, 0); //menu=no
- swf_ButtonSetRecord(tag,0x01,myshapeid,depth,0,0);
- swf_ButtonSetRecord(tag,0x02,myshapeid2,depth,0,0);
- swf_ButtonSetRecord(tag,0x04,myshapeid2,depth,0,0);
- swf_ButtonSetRecord(tag,0x08,myshapeid,depth,0,0);
- swf_SetU8(tag,0);
- swf_SetActions(tag,actions);
- swf_SetU8(tag,0);
-
- tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
- swf_ObjectPlace(tag, buttonid, depth++,0,0,0);
-}
-
-void drawimage(struct swfoutput*obj, int bitid, int sizex,int sizey,
+ swf_SetRect(i->tag,&r);
+ swf_SetShapeStyles(i->tag,i->shape);
+ swf_ShapeCountBits(i->shape,NULL,NULL);
+ swf_SetShapeBits(i->tag,i->shape);
+ swf_ShapeSetAll(i->tag,i->shape,/*x*/0,/*y*/0,0,fsid,0);
+ i->swflastx = i->swflasty = 0;
+ moveto(obj, i->tag, p1);
+ lineto(obj, i->tag, p2);
+ lineto(obj, i->tag, p3);
+ lineto(obj, i->tag, p4);
+ lineto(obj, i->tag, p1);
+ swf_ShapeSetEnd(i->tag);
+
+ if(!mouseover)
+ {
+ i->tag = swf_InsertTag(i->tag,ST_DEFINEBUTTON);
+ swf_SetU16(i->tag,buttonid); //id
+ swf_ButtonSetFlags(i->tag, 0); //menu=no
+ swf_ButtonSetRecord(i->tag,0x01,myshapeid,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x02,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x04,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x08,myshapeid,i->depth,0,0);
+ swf_SetU8(i->tag,0);
+ swf_ActionSet(i->tag,actions1);
+ swf_SetU8(i->tag,0);
+ }
+ else
+ {
+ i->tag = swf_InsertTag(i->tag,ST_DEFINEBUTTON2);
+ swf_SetU16(i->tag,buttonid); //id
+ swf_ButtonSetFlags(i->tag, 0); //menu=no
+ swf_ButtonSetRecord(i->tag,0x01,myshapeid,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x02,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x04,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x08,myshapeid,i->depth,0,0);
+ swf_SetU8(i->tag,0); // end of button records
+ swf_ButtonSetCondition(i->tag, BC_IDLE_OVERUP);
+ swf_ActionSet(i->tag,actions1);
+ if(actions2) {
+ swf_ButtonSetCondition(i->tag, BC_OVERUP_IDLE);
+ swf_ActionSet(i->tag,actions2);
+ swf_SetU8(i->tag,0);
+ swf_ButtonPostProcess(i->tag, 2);
+ } else {
+ swf_SetU8(i->tag,0);
+ swf_ButtonPostProcess(i->tag, 1);
+ }
+ }
+
+ i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
+
+ if(posx!=0 || posy!=0) {
+ SPOINT p;
+ p.x = (int)(posx*20);
+ p.y = (int)(posy*20);
+ p = swf_TurnPoint(p, &i->page_matrix);
+ MATRIX m;
+ 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);
+ }
+}
+
+
+///////////
+/*
+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) {
+*/
+///////////
+
+static void drawgfxline(struct swfoutput*obj, gfxline_t*line)
+{
+ swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+ gfxcoord_t lastx=0,lasty=0,px=0,py=0;
+ int needsfix = 0;
+ while(1) {
+ if(!line)
+ break;
+ if(line->type == gfx_moveTo) {
+ moveto(obj, i->tag, line->x, line->y);
+ px = lastx = line->x;
+ py = lasty = line->y;
+ needsfix = 0;
+ } if(line->type == gfx_lineTo) {
+ lineto(obj, i->tag, line->x, line->y);
+ px = line->x;
+ py = line->y;
+ needsfix = 1;
+ } else if(line->type == gfx_splineTo) {
+ plotxy s,p;
+ s.x = line->sx;p.x = line->x;
+ s.y = line->sy;p.y = line->y;
+ splineto(obj, i->tag, s, p);
+ px = line->x;
+ py = line->y;
+ needsfix = 1;
+ }
+ line = line->next;
+ }
+}
+
+void swfoutput_drawgfxline(struct swfoutput*obj, gfxline_t*line, gfxcoord_t width, gfxcolor_t*col, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
+{
+ swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+ gfxdevice_t*dev = &i->device;
+ dev->stroke(dev, line, width, col, cap_style, joint_style, miterLimit);
+}
+void swfoutput_fillgfxline(struct swfoutput*obj, gfxline_t*line, gfxcolor_t*col)
+{
+ swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+ gfxdevice_t*dev = &i->device;
+ dev->fill(dev, line, col);
+}
+void swfoutput_startclip(struct swfoutput*obj, gfxline_t*line)
+{
+ swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+ gfxdevice_t*dev = &i->device;
+ dev->startclip(dev, line);
+}
+void swfoutput_endclip(struct swfoutput*obj)
+{
+ swfoutput_internal*i = (swfoutput_internal*)obj->internal;
+ gfxdevice_t*dev = &i->device;
+ dev->endclip(dev);
+}
+
+#define IMAGE_TYPE_JPEG 0
+#define IMAGE_TYPE_LOSSLESS 1
+
+static void swfoutput_drawimage(struct swfoutput*obj, RGBA* data, int sizex,int sizey,