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

Comparing CV/CV.xs (file contents):
Revision 1.20 by root, Fri Jul 22 06:14:25 2005 UTC vs.
Revision 1.23 by root, Tue Aug 16 23:50:39 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
124 126
125MODULE = Gtk2::CV PACKAGE = Gtk2::CV 127MODULE = Gtk2::CV PACKAGE = Gtk2::CV
126 128
127PROTOTYPES: ENABLE 129PROTOTYPES: ENABLE
128 130
131# missing in Gtk2 perl module
132
133gboolean
134gdk_net_wm_supports (GdkAtom property)
135 CODE:
136#if defined(GDK_WINDOWING_X11) && !defined(GDK_MULTIHEAD_SAFE)
137 RETVAL = gdk_net_wm_supports (property);
138#else
139 RETVAL = 0;
140#endif
141 OUTPUT:
142 RETVAL
143
129GdkPixbuf_noinc * 144GdkPixbuf_noinc *
130transpose (GdkPixbuf *pb) 145transpose (GdkPixbuf *pb)
131 CODE: 146 CODE:
132{ 147{
133 int w = gdk_pixbuf_get_width (pb); 148 int w = gdk_pixbuf_get_width (pb);
173} 188}
174 OUTPUT: 189 OUTPUT:
175 RETVAL 190 RETVAL
176 191
177GdkPixbuf_noinc * 192GdkPixbuf_noinc *
178load_jpeg (char *path, int thumbnail=0) 193load_jpeg (SV *path, int thumbnail=0)
179 CODE: 194 CODE:
180{ 195{
181 struct jpeg_decompress_struct cinfo; 196 struct jpeg_decompress_struct cinfo;
182 struct jpg_err_mgr jerr; 197 struct jpg_err_mgr jerr;
183 guchar *data; 198 guchar *data;
184 int rs; 199 int rs;
185 FILE *fp; 200 FILE *fp;
186 volatile GdkPixbuf *pb = 0; 201 volatile GdkPixbuf *pb = 0;
202 gchar *filename;
203
187 RETVAL = 0; 204 RETVAL = 0;
188 205
189 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)
190 XSRETURN_UNDEF; 211 XSRETURN_UNDEF;
191 212
192 cinfo.err = jpeg_std_error (&jerr.err); 213 cinfo.err = jpeg_std_error (&jerr.err);
193 214
194 jerr.err.error_exit = cv_error_exit; 215 jerr.err.error_exit = cv_error_exit;
225 { 246 {
226 cinfo.dct_method = JDCT_FASTEST; 247 cinfo.dct_method = JDCT_FASTEST;
227 cinfo.do_fancy_upsampling = FALSE; 248 cinfo.do_fancy_upsampling = FALSE;
228 249
229 while (cinfo.scale_denom < 8 250 while (cinfo.scale_denom < 8
230 && (cinfo.output_width >> 1) >= IW 251 && cinfo.output_width >= IW*4
231 && (cinfo.output_height >> 1) >= IH) 252 && cinfo.output_height >= IH*4)
232 { 253 {
233 cinfo.scale_denom <<= 1; 254 cinfo.scale_denom <<= 1;
234 jpeg_calc_output_dimensions (&cinfo); 255 jpeg_calc_output_dimensions (&cinfo);
235 } 256 }
236 } 257 }
313 OUTPUT: 334 OUTPUT:
314 RETVAL 335 RETVAL
315 336
316GdkPixbuf_noinc * 337GdkPixbuf_noinc *
317p7_to_pb (int w, int h, guchar *src) 338p7_to_pb (int w, int h, guchar *src)
339 PROTOTYPE: @
318 CODE: 340 CODE:
319{ 341{
320 int x, y; 342 int x, y;
321 guchar *dst, *d; 343 guchar *dst, *d;
322 int dstr; 344 int dstr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines