+
+///////////
+/*
+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;
+ char lastwasmoveto;
+ while(1) {
+ if(!line)
+ break;
+ /* check whether the next segment is zero */
+ if(line->type == gfx_moveTo) {
+ msg("<trace> ======== moveTo %.2f %.2f", line->x, line->y);
+ moveto(obj, i->tag, line->x, line->y);
+ px = lastx = line->x;
+ py = lasty = line->y;
+ lastwasmoveto = 1;
+ } if(line->type == gfx_lineTo) {
+ msg("<trace> ======== lineTo %.2f %.2f", line->x, line->y);
+ lineto(obj, i->tag, line->x, line->y);
+ px = line->x;
+ py = line->y;
+ lastwasmoveto = 0;
+ } else if(line->type == gfx_splineTo) {
+ msg("<trace> ======== splineTo %.2f %.2f", line->x, line->y);
+ 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;
+ lastwasmoveto = 0;
+ }
+ 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,