… | |
… | |
13 | #include <gtk/gtk.h> |
13 | #include <gtk/gtk.h> |
14 | #include <gdk-pixbuf/gdk-pixbuf.h> |
14 | #include <gdk-pixbuf/gdk-pixbuf.h> |
15 | |
15 | |
16 | #include <gperl.h> |
16 | #include <gperl.h> |
17 | #include <gtk2perl.h> |
17 | #include <gtk2perl.h> |
|
|
18 | |
|
|
19 | #include <assert.h> |
18 | |
20 | |
19 | #define IW 80 /* MUST match Schnauzer.pm! */ |
21 | #define IW 80 /* MUST match Schnauzer.pm! */ |
20 | #define IH 60 /* MUST match Schnauzer.pm! */ |
22 | #define IH 60 /* MUST match Schnauzer.pm! */ |
21 | |
23 | |
22 | #define RAND (seed = (seed + 7141) * 54773 % 134456) |
24 | #define RAND (seed = (seed + 7141) * 54773 % 134456) |
… | |
… | |
211 | { |
213 | { |
212 | static magic_t cookie; |
214 | static magic_t cookie; |
213 | |
215 | |
214 | if (!cookie) |
216 | if (!cookie) |
215 | { |
217 | { |
216 | cookie = magic_open (MAGIC_NONE); |
218 | cookie = magic_open (MAGIC_SYMLINK); |
217 | |
219 | |
218 | if (cookie) |
220 | if (cookie) |
219 | magic_load (cookie, 0); |
221 | magic_load (cookie, 0); |
220 | else |
222 | else |
221 | XSRETURN_UNDEF; |
223 | XSRETURN_UNDEF; |
… | |
… | |
232 | { |
234 | { |
233 | static magic_t cookie; |
235 | static magic_t cookie; |
234 | |
236 | |
235 | if (!cookie) |
237 | if (!cookie) |
236 | { |
238 | { |
237 | cookie = magic_open (MAGIC_MIME); |
239 | cookie = magic_open (MAGIC_MIME | MAGIC_SYMLINK); |
238 | |
240 | |
239 | if (cookie) |
241 | if (cookie) |
240 | magic_load (cookie, 0); |
242 | magic_load (cookie, 0); |
241 | else |
243 | else |
242 | XSRETURN_UNDEF; |
244 | XSRETURN_UNDEF; |
… | |
… | |
290 | RETVAL |
292 | RETVAL |
291 | |
293 | |
292 | GdkPixbuf_noinc * |
294 | GdkPixbuf_noinc * |
293 | rotate (GdkPixbuf *pb, int angle) |
295 | rotate (GdkPixbuf *pb, int angle) |
294 | CODE: |
296 | CODE: |
|
|
297 | if (angle < 0) |
|
|
298 | angle += 360; |
295 | RETVAL = gdk_pixbuf_rotate_simple (pb, angle == 0 ? GDK_PIXBUF_ROTATE_NONE |
299 | RETVAL = gdk_pixbuf_rotate_simple (pb, angle == 0 ? GDK_PIXBUF_ROTATE_NONE |
296 | : angle == 90 ? GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE |
300 | : angle == 90 ? GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE |
297 | : angle == 180 ? GDK_PIXBUF_ROTATE_UPSIDEDOWN |
301 | : angle == 180 ? GDK_PIXBUF_ROTATE_UPSIDEDOWN |
298 | : angle == 270 ? GDK_PIXBUF_ROTATE_CLOCKWISE |
302 | : angle == 270 ? GDK_PIXBUF_ROTATE_CLOCKWISE |
299 | : angle); |
303 | : angle); |
… | |
… | |
400 | compare (GdkPixbuf *a, GdkPixbuf *b) |
404 | compare (GdkPixbuf *a, GdkPixbuf *b) |
401 | PPCODE: |
405 | PPCODE: |
402 | { |
406 | { |
403 | int w = gdk_pixbuf_get_width (a); |
407 | int w = gdk_pixbuf_get_width (a); |
404 | int h = gdk_pixbuf_get_height (a); |
408 | int h = gdk_pixbuf_get_height (a); |
|
|
409 | |
405 | int sa = gdk_pixbuf_get_rowstride (a); |
410 | int sa = gdk_pixbuf_get_rowstride (a); |
406 | int sb = gdk_pixbuf_get_rowstride (b); |
411 | int sb = gdk_pixbuf_get_rowstride (b); |
407 | |
412 | |
408 | guchar *pa = gdk_pixbuf_get_pixels (a); |
413 | guchar *pa = gdk_pixbuf_get_pixels (a); |
409 | guchar *pb = gdk_pixbuf_get_pixels (b); |
414 | guchar *pb = gdk_pixbuf_get_pixels (b); |