added swf_ActionCompile function
[swftools.git] / lib / modules / swfbits.c
index 0454f10..df8c1c9 100644 (file)
@@ -7,9 +7,19 @@
 
    Copyright (c) 2000, 2001 Rainer Böhme <rfxswf@reflex-studio.de>
  
-   This file is distributed under the GPL, see file COPYING for details 
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-*/
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #define OUTBUFFER_SIZE 0x8000
 
@@ -128,6 +138,26 @@ void swf_SetJPEGBits2(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality)
   swf_SetJPEGBitsFinish(jpeg);
 }
 
+void swf_GetJPEGSize(char * fname, int*width, int*height)
+{ struct jpeg_decompress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+  FILE * fi;
+  *width = 0;
+  *height = 0;
+  cinfo.err = jpeg_std_error(&jerr);
+  jpeg_create_decompress(&cinfo); 
+  if ((fi=fopen(fname,"rb"))==NULL) {
+      fprintf(stderr, "rfxswf: file open error\n");
+      return;
+  }
+  jpeg_stdio_src(&cinfo, fi);
+  jpeg_read_header(&cinfo, TRUE);
+  *width = cinfo.image_width;
+  *height = cinfo.image_height;
+  jpeg_destroy_decompress(&cinfo);
+  fclose(fi);
+}
+
 int swf_SetJPEGBits(TAG * t,char * fname,int quality)
 { struct jpeg_decompress_struct cinfo;
   struct jpeg_error_mgr jerr;