… | |
… | |
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 | } |
… | |
… | |
281 | U8 *pend = path + plen; |
294 | U8 *pend = path + plen; |
282 | U8 dst [plen * 6 * 3], *dstp = dst; |
295 | U8 dst [plen * 6 * 3], *dstp = dst; |
283 | |
296 | |
284 | while (path < pend) |
297 | while (path < pend) |
285 | { |
298 | { |
|
|
299 | U8 ch = *path; |
|
|
300 | |
286 | if (*path >= '0' && *path <= '9') |
301 | if (ch >= 'a' && ch <= 'z') |
|
|
302 | *dstp++ = *path++; |
|
|
303 | else if (ch >= '0' && ch <= '9') |
287 | { |
304 | { |
288 | STRLEN el, nl = 0; |
305 | STRLEN el, nl = 0; |
289 | while (*path >= '0' && *path <= '9') |
306 | while (*path >= '0' && *path <= '9' && path < pend) |
290 | path++, nl++; |
307 | path++, nl++; |
291 | |
308 | |
292 | for (el = nl; el < 6; el++) |
309 | for (el = nl; el < 6; el++) |
293 | *dstp++ = '0'; |
310 | *dstp++ = '0'; |
294 | |
311 | |
… | |
… | |
309 | OUTPUT: |
326 | OUTPUT: |
310 | RETVAL |
327 | RETVAL |
311 | |
328 | |
312 | GdkPixbuf_noinc * |
329 | GdkPixbuf_noinc * |
313 | p7_to_pb (int w, int h, guchar *src) |
330 | p7_to_pb (int w, int h, guchar *src) |
|
|
331 | PROTOTYPE: @ |
314 | CODE: |
332 | CODE: |
315 | { |
333 | { |
316 | int x, y; |
334 | int x, y; |
317 | guchar *dst, *d; |
335 | guchar *dst, *d; |
318 | int dstr; |
336 | int dstr; |
… | |
… | |
390 | } |
408 | } |
391 | } |
409 | } |
392 | OUTPUT: |
410 | OUTPUT: |
393 | RETVAL |
411 | RETVAL |
394 | |
412 | |
395 | SV * |
|
|
396 | make_histogram (SV *ar) |
|
|
397 | CODE: |
|
|
398 | { |
|
|
399 | int i; |
|
|
400 | AV *av, *result; |
|
|
401 | |
|
|
402 | if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV) |
|
|
403 | croak ("Not an array ref as first argument to make_histogram"); |
|
|
404 | |
|
|
405 | av = (AV *) SvRV (ar); |
|
|
406 | result = newAV (); |
|
|
407 | |
|
|
408 | for (i = 0; i <= av_len (av); ++i) |
|
|
409 | { |
|
|
410 | const int HISTSIZE = 64; |
|
|
411 | |
|
|
412 | int j; |
|
|
413 | SV *sv = *av_fetch (av, i, 1); |
|
|
414 | STRLEN len; |
|
|
415 | char *buf = SvPVbyte (sv, len); |
|
|
416 | |
|
|
417 | int tmphist[HISTSIZE]; |
|
|
418 | float *hist; |
|
|
419 | |
|
|
420 | SV *histsv = newSV (HISTSIZE * sizeof (float) + 1); |
|
|
421 | SvPOK_on (histsv); |
|
|
422 | SvCUR_set (histsv, HISTSIZE * sizeof (float)); |
|
|
423 | hist = (float *)SvPVX (histsv); |
|
|
424 | |
|
|
425 | Zero (tmphist, sizeof (tmphist), char); |
|
|
426 | |
|
|
427 | for (j = len; j--; ) |
|
|
428 | { |
|
|
429 | unsigned int idx |
|
|
430 | = ((*buf & 0xc0) >> 2) |
|
|
431 | | ((*buf & 0x18) >> 1) |
|
|
432 | | (*buf & 0x03); |
|
|
433 | |
|
|
434 | ++tmphist[idx]; |
|
|
435 | ++buf; |
|
|
436 | } |
|
|
437 | |
|
|
438 | for (j = 0; j < HISTSIZE; ++j) |
|
|
439 | hist[j] = (float)tmphist[j] / (len + 1e-30); |
|
|
440 | |
|
|
441 | av_push (result, histsv); |
|
|
442 | } |
|
|
443 | |
|
|
444 | RETVAL = newRV_noinc ((SV *)result); |
|
|
445 | } |
|
|
446 | OUTPUT: |
|
|
447 | RETVAL |
|
|
448 | |
|
|
449 | ############################################################################# |
413 | ############################################################################# |
450 | |
414 | |
451 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript |
415 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript |
452 | |
416 | |
453 | void |
417 | void |
… | |
… | |
576 | } |
540 | } |
577 | } |
541 | } |
578 | OUTPUT: |
542 | OUTPUT: |
579 | RETVAL |
543 | RETVAL |
580 | |
544 | |
|
|
545 | ############################################################################# |
581 | |
546 | |
|
|
547 | MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Plugin::RCluster |
582 | |
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 | |