ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/CV.xs
(Generate patch)

Comparing CV/CV.xs (file contents):
Revision 1.22 by root, Sun Aug 14 02:25:44 2005 UTC vs.
Revision 1.24 by root, Wed Aug 17 05:25:28 2005 UTC

4 4
5#include <string.h> 5#include <string.h>
6#include <setjmp.h> 6#include <setjmp.h>
7 7
8#include <jpeglib.h> 8#include <jpeglib.h>
9#include <glib.h>
10#include <gtk/gtk.h>
9#include <gdk-pixbuf/gdk-pixbuf.h> 11#include <gdk-pixbuf/gdk-pixbuf.h>
10 12
11#include <gperl.h> 13#include <gperl.h>
12#include <gtk2perl.h> 14#include <gtk2perl.h>
13 15
186} 188}
187 OUTPUT: 189 OUTPUT:
188 RETVAL 190 RETVAL
189 191
190GdkPixbuf_noinc * 192GdkPixbuf_noinc *
191load_jpeg (char *path, int thumbnail=0) 193load_jpeg (SV *path, int thumbnail=0)
192 CODE: 194 CODE:
193{ 195{
194 struct jpeg_decompress_struct cinfo; 196 struct jpeg_decompress_struct cinfo;
195 struct jpg_err_mgr jerr; 197 struct jpg_err_mgr jerr;
196 guchar *data; 198 guchar *data;
197 int rs; 199 int rs;
198 FILE *fp; 200 FILE *fp;
199 volatile GdkPixbuf *pb = 0; 201 volatile GdkPixbuf *pb = 0;
202 gchar *filename;
203
200 RETVAL = 0; 204 RETVAL = 0;
201 205
202 if (!(fp = fopen (path, "rb"))) 206 filename = g_filename_from_utf8 (SvPVutf8_nolen (path), -1, 0, 0, 0);
207 fp = fopen (filename, "rb");
208 g_free (filename);
209
210 if (!fp)
203 XSRETURN_UNDEF; 211 XSRETURN_UNDEF;
204 212
205 cinfo.err = jpeg_std_error (&jerr.err); 213 cinfo.err = jpeg_std_error (&jerr.err);
206 214
207 jerr.err.error_exit = cv_error_exit; 215 jerr.err.error_exit = cv_error_exit;
325} 333}
326 OUTPUT: 334 OUTPUT:
327 RETVAL 335 RETVAL
328 336
329GdkPixbuf_noinc * 337GdkPixbuf_noinc *
330p7_to_pb (int w, int h, guchar *src) 338p7_to_pb (int w, int h, SV *src_sv)
331 PROTOTYPE: @ 339 PROTOTYPE: @
332 CODE: 340 CODE:
333{ 341{
334 int x, y; 342 int x, y;
335 guchar *dst, *d; 343 guchar *dst, *d;
336 int dstr; 344 int dstr;
345 guchar *src = SvPVbyte_nolen (src_sv);
337 346
338 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h); 347 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h);
339 dst = gdk_pixbuf_get_pixels (RETVAL); 348 dst = gdk_pixbuf_get_pixels (RETVAL);
340 dstr = gdk_pixbuf_get_rowstride (RETVAL); 349 dstr = gdk_pixbuf_get_rowstride (RETVAL);
341 350

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines