-// Old main routine
-
-/*
-int ConvertJPEG2SWF(char * sname,char * dname,int quality)
-{ RGBA rgb;
- SWF swf;
- TAG * t;
-
- SHAPE * s;
- SRECT r;
- MATRIX m;
- int fs;
-
- struct jpeg_decompress_struct cinfo;
- struct jpeg_error_mgr jerr;
- LPJPEGBITS out;
- FILE * f;
- U8 * scanline;
-
- int handle;
-
- cinfo.err = jpeg_std_error(&jerr);
- jpeg_create_decompress(&cinfo);
-
- if ((f=fopen(sname,"rb"))==NULL)
- { fprintf(stderr,"Read access failed: %s\n",sname);
- return -1;
- }
-
- jpeg_stdio_src(&cinfo,f);
- jpeg_read_header(&cinfo, TRUE);
- jpeg_start_decompress(&cinfo);
-
- memset(&swf,0x00,sizeof(SWF));
-
- swf.FileVersion = 4;
- swf.FrameRate = 0x1000;
- swf.MovieSize.xmax = cinfo.output_width*20;
- swf.MovieSize.ymax = cinfo.output_height*20;
-
- printf("dx = %i, dy = %i\n",cinfo.output_width,cinfo.output_height);
-
- t = swf.FirstTag = InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
-
- rgb.r = rgb.g = rgb.b = rgb.a = 0x00;
- SetRGB(t,&rgb);
-
- t = InsertTag(t,ST_DEFINEBITSJPEG2);
-
- SetU16(t,1); // id
-
- out = SetJPEGBitsStart(t,cinfo.output_width,cinfo.output_height,quality);
- scanline = (U8*)malloc(4*cinfo.output_width);
-
- if (scanline)
- { int y;
- U8 * js = scanline;
- for (y=0;y<cinfo.output_height;y++)
- { jpeg_read_scanlines(&cinfo,&js,1);
- SetJPEGBitsLines(out,(U8**)&js,1);
- }
- free(scanline);
- }
-
- SetJPEGBitsFinish(out);
-
- printf("JPEG Tag-Length: %06x\n",GetDataSize(t));
-
- t = InsertTag(t,ST_DEFINESHAPE);
-
- NewShape(&s);
- GetMatrix(NULL,&m);
- m.sx = 20*0x10000;
- m.sy = 20*0x10000;
- rgb.r = 0xff;
- fs = ShapeAddBitmapFillStyle(s,&m,1,0);
-// fs = ShapeAddSolidFillStyle(s,&rgb);
-
- SetU16(t,2); // id
- SetRect(t,&swf.MovieSize);
- SetShapeHeader(t,s);
-
- ShapeSetAll(t,s,0,0,0,fs,0);
- ShapeSetLine(t,s,swf.MovieSize.xmax,0);
- ShapeSetLine(t,s,0,swf.MovieSize.ymax);
- ShapeSetLine(t,s,-swf.MovieSize.xmax,0);
- ShapeSetLine(t,s,0,-swf.MovieSize.ymax);
-
- ShapeSetEnd(t);
-
- t = InsertTag(t,ST_PLACEOBJECT2);
-
- ObjectPlace(t,2,1,NULL,NULL,NULL);
-
- t = InsertTag(t,ST_SHOWFRAME);
-
- t = InsertTag(t,ST_END);
-
- jpeg_finish_decompress(&cinfo);
- fclose(f);
-
- handle = open(dname,O_BINARY|O_RDWR|O_CREAT|O_TRUNC,0666);
- if FAILED(WriteSWF(handle,&swf)) fprintf(stderr,"WriteSWF() failed.\n");
- close(handle);
-
- return 0;
-}
-*/