… | |
… | |
124 | |
124 | |
125 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV |
125 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV |
126 | |
126 | |
127 | PROTOTYPES: ENABLE |
127 | PROTOTYPES: ENABLE |
128 | |
128 | |
|
|
129 | # missing in Gtk2 perl module |
|
|
130 | |
|
|
131 | gboolean |
|
|
132 | gdk_net_wm_supports (GdkAtom property) |
|
|
133 | CODE: |
|
|
134 | #if defined(GDK_WINDOWING_X11) && !defined(GDK_MULTIHEAD_SAFE) |
|
|
135 | RETVAL = gdk_net_wm_supports (property); |
|
|
136 | #else |
|
|
137 | RETVAL = 0; |
|
|
138 | #endif |
|
|
139 | OUTPUT: |
|
|
140 | RETVAL |
|
|
141 | |
129 | GdkPixbuf_noinc * |
142 | GdkPixbuf_noinc * |
130 | transpose (GdkPixbuf *pb) |
143 | transpose (GdkPixbuf *pb) |
131 | CODE: |
144 | CODE: |
132 | { |
145 | { |
133 | int w = gdk_pixbuf_get_width (pb); |
146 | int w = gdk_pixbuf_get_width (pb); |
… | |
… | |
225 | { |
238 | { |
226 | cinfo.dct_method = JDCT_FASTEST; |
239 | cinfo.dct_method = JDCT_FASTEST; |
227 | cinfo.do_fancy_upsampling = FALSE; |
240 | cinfo.do_fancy_upsampling = FALSE; |
228 | |
241 | |
229 | while (cinfo.scale_denom < 8 |
242 | while (cinfo.scale_denom < 8 |
230 | && (cinfo.output_width >> 1) >= IW |
243 | && cinfo.output_width >= IW*4 |
231 | && (cinfo.output_height >> 1) >= IH) |
244 | && cinfo.output_height >= IH*4) |
232 | { |
245 | { |
233 | cinfo.scale_denom <<= 1; |
246 | cinfo.scale_denom <<= 1; |
234 | jpeg_calc_output_dimensions (&cinfo); |
247 | jpeg_calc_output_dimensions (&cinfo); |
235 | } |
248 | } |
236 | } |
249 | } |
… | |
… | |
313 | OUTPUT: |
326 | OUTPUT: |
314 | RETVAL |
327 | RETVAL |
315 | |
328 | |
316 | GdkPixbuf_noinc * |
329 | GdkPixbuf_noinc * |
317 | p7_to_pb (int w, int h, guchar *src) |
330 | p7_to_pb (int w, int h, guchar *src) |
|
|
331 | PROTOTYPE: @ |
318 | CODE: |
332 | CODE: |
319 | { |
333 | { |
320 | int x, y; |
334 | int x, y; |
321 | guchar *dst, *d; |
335 | guchar *dst, *d; |
322 | int dstr; |
336 | int dstr; |
… | |
… | |
394 | } |
408 | } |
395 | } |
409 | } |
396 | OUTPUT: |
410 | OUTPUT: |
397 | RETVAL |
411 | RETVAL |
398 | |
412 | |
399 | SV * |
|
|
400 | make_histogram (SV *ar) |
|
|
401 | CODE: |
|
|
402 | { |
|
|
403 | int i; |
|
|
404 | AV *av, *result; |
|
|
405 | |
|
|
406 | if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV) |
|
|
407 | croak ("Not an array ref as first argument to make_histogram"); |
|
|
408 | |
|
|
409 | av = (AV *) SvRV (ar); |
|
|
410 | result = newAV (); |
|
|
411 | |
|
|
412 | for (i = 0; i <= av_len (av); ++i) |
|
|
413 | { |
|
|
414 | const int HISTSIZE = 64; |
|
|
415 | |
|
|
416 | int j; |
|
|
417 | SV *sv = *av_fetch (av, i, 1); |
|
|
418 | STRLEN len; |
|
|
419 | char *buf = SvPVbyte (sv, len); |
|
|
420 | |
|
|
421 | int tmphist[HISTSIZE]; |
|
|
422 | float *hist; |
|
|
423 | |
|
|
424 | SV *histsv = newSV (HISTSIZE * sizeof (float) + 1); |
|
|
425 | SvPOK_on (histsv); |
|
|
426 | SvCUR_set (histsv, HISTSIZE * sizeof (float)); |
|
|
427 | hist = (float *)SvPVX (histsv); |
|
|
428 | |
|
|
429 | Zero (tmphist, sizeof (tmphist), char); |
|
|
430 | |
|
|
431 | for (j = len; j--; ) |
|
|
432 | { |
|
|
433 | unsigned int idx |
|
|
434 | = ((*buf & 0xc0) >> 2) |
|
|
435 | | ((*buf & 0x18) >> 1) |
|
|
436 | | (*buf & 0x03); |
|
|
437 | |
|
|
438 | ++tmphist[idx]; |
|
|
439 | ++buf; |
|
|
440 | } |
|
|
441 | |
|
|
442 | for (j = 0; j < HISTSIZE; ++j) |
|
|
443 | hist[j] = (float)tmphist[j] / (len + 1e-30); |
|
|
444 | |
|
|
445 | av_push (result, histsv); |
|
|
446 | } |
|
|
447 | |
|
|
448 | RETVAL = newRV_noinc ((SV *)result); |
|
|
449 | } |
|
|
450 | OUTPUT: |
|
|
451 | RETVAL |
|
|
452 | |
|
|
453 | ############################################################################# |
413 | ############################################################################# |
454 | |
414 | |
455 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript |
415 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript |
456 | |
416 | |
457 | void |
417 | void |
… | |
… | |
580 | } |
540 | } |
581 | } |
541 | } |
582 | OUTPUT: |
542 | OUTPUT: |
583 | RETVAL |
543 | RETVAL |
584 | |
544 | |
|
|
545 | ############################################################################# |
585 | |
546 | |
|
|
547 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Plugin::RCluster |
586 | |
548 | |
|
|
549 | SV * |
|
|
550 | make_histograms (SV *ar) |
|
|
551 | CODE: |
|
|
552 | { |
|
|
553 | int i; |
|
|
554 | AV *av, *result; |
|
|
555 | |
|
|
556 | if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV) |
|
|
557 | croak ("Not an array ref as first argument to make_histogram"); |
|
|
558 | |
|
|
559 | av = (AV *) SvRV (ar); |
|
|
560 | result = newAV (); |
|
|
561 | |
|
|
562 | for (i = 0; i <= av_len (av); ++i) |
|
|
563 | { |
|
|
564 | const int HISTSIZE = 64; |
|
|
565 | |
|
|
566 | int j; |
|
|
567 | SV *sv = *av_fetch (av, i, 1); |
|
|
568 | STRLEN len; |
|
|
569 | char *buf = SvPVbyte (sv, len); |
|
|
570 | |
|
|
571 | int tmphist[HISTSIZE]; |
|
|
572 | float *hist; |
|
|
573 | |
|
|
574 | SV *histsv = newSV (HISTSIZE * sizeof (float) + 1); |
|
|
575 | SvPOK_on (histsv); |
|
|
576 | SvCUR_set (histsv, HISTSIZE * sizeof (float)); |
|
|
577 | hist = (float *)SvPVX (histsv); |
|
|
578 | |
|
|
579 | Zero (tmphist, sizeof (tmphist), char); |
|
|
580 | |
|
|
581 | for (j = len; j--; ) |
|
|
582 | { |
|
|
583 | unsigned int idx |
|
|
584 | = ((*buf & 0xc0) >> 2) |
|
|
585 | | ((*buf & 0x18) >> 1) |
|
|
586 | | (*buf & 0x03); |
|
|
587 | |
|
|
588 | ++tmphist[idx]; |
|
|
589 | ++buf; |
|
|
590 | } |
|
|
591 | |
|
|
592 | for (j = 0; j < HISTSIZE; ++j) |
|
|
593 | hist[j] = (float)tmphist[j] / (len + 1e-30); |
|
|
594 | |
|
|
595 | av_push (result, histsv); |
|
|
596 | } |
|
|
597 | |
|
|
598 | RETVAL = newRV_noinc ((SV *)result); |
|
|
599 | } |
|
|
600 | OUTPUT: |
|
|
601 | RETVAL |
|
|
602 | |
|
|
603 | |