--- CV/CV.xs 2005/07/20 09:06:37 1.18 +++ CV/CV.xs 2005/08/14 02:25:44 1.22 @@ -126,6 +126,19 @@ PROTOTYPES: ENABLE +# missing in Gtk2 perl module + +gboolean +gdk_net_wm_supports (GdkAtom property) + CODE: +#if defined(GDK_WINDOWING_X11) && !defined(GDK_MULTIHEAD_SAFE) + RETVAL = gdk_net_wm_supports (property); +#else + RETVAL = 0; +#endif + OUTPUT: + RETVAL + GdkPixbuf_noinc * transpose (GdkPixbuf *pb) CODE: @@ -227,8 +240,8 @@ cinfo.do_fancy_upsampling = FALSE; while (cinfo.scale_denom < 8 - && (cinfo.output_width >> 1) >= IW - && (cinfo.output_height >> 1) >= IH) + && cinfo.output_width >= IW*4 + && cinfo.output_height >= IH*4) { cinfo.scale_denom <<= 1; jpeg_calc_output_dimensions (&cinfo); @@ -283,10 +296,14 @@ while (path < pend) { - if (*path >= '0' && *path <= '9') + U8 ch = *path; + + if (ch >= 'a' && ch <= 'z') + *dstp++ = *path++; + else if (ch >= '0' && ch <= '9') { STRLEN el, nl = 0; - while (*path >= '0' && *path <= '9') + while (*path >= '0' && *path <= '9' && path < pend) path++, nl++; for (el = nl; el < 6; el++) @@ -311,6 +328,7 @@ GdkPixbuf_noinc * p7_to_pb (int w, int h, guchar *src) + PROTOTYPE: @ CODE: { int x, y; @@ -392,60 +410,6 @@ OUTPUT: RETVAL -SV * -make_histogram (SV *ar) - CODE: -{ - int i; - AV *av, *result; - - if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV) - croak ("Not an array ref as first argument to make_histogram"); - - av = (AV *) SvRV (ar); - result = newAV (); - - for (i = 0; i <= av_len (av); ++i) - { - const int HISTSIZE = 64; - - int j; - SV *sv = *av_fetch (av, i, 1); - STRLEN len; - char *buf = SvPVbyte (sv, len); - - int tmphist[HISTSIZE]; - float *hist; - - SV *histsv = newSV (HISTSIZE * sizeof (float) + 1); - SvPOK_on (histsv); - SvCUR_set (histsv, HISTSIZE * sizeof (float)); - hist = (float *)SvPVX (histsv); - - Zero (tmphist, sizeof (tmphist), char); - - for (j = len; j--; ) - { - unsigned int idx - = ((*buf & 0xc0) >> 2) - | ((*buf & 0x18) >> 1) - | (*buf & 0x03); - - ++tmphist[idx]; - ++buf; - } - - for (j = 0; j < HISTSIZE; ++j) - hist[j] = (float)tmphist[j] / (len + 1e-30); - - av_push (result, histsv); - } - - RETVAL = newRV_noinc ((SV *)result); -} - OUTPUT: - RETVAL - ############################################################################# MODULE = Gtk2::CV PACKAGE = Gtk2::CV::PostScript @@ -578,5 +542,62 @@ OUTPUT: RETVAL +############################################################################# + +MODULE = Gtk2::CV PACKAGE = Gtk2::CV::Plugin::RCluster + +SV * +make_histograms (SV *ar) + CODE: +{ + int i; + AV *av, *result; + + if (!SvROK (ar) || SvTYPE (SvRV (ar)) != SVt_PVAV) + croak ("Not an array ref as first argument to make_histogram"); + + av = (AV *) SvRV (ar); + result = newAV (); + + for (i = 0; i <= av_len (av); ++i) + { + const int HISTSIZE = 64; + + int j; + SV *sv = *av_fetch (av, i, 1); + STRLEN len; + char *buf = SvPVbyte (sv, len); + + int tmphist[HISTSIZE]; + float *hist; + + SV *histsv = newSV (HISTSIZE * sizeof (float) + 1); + SvPOK_on (histsv); + SvCUR_set (histsv, HISTSIZE * sizeof (float)); + hist = (float *)SvPVX (histsv); + + Zero (tmphist, sizeof (tmphist), char); + + for (j = len; j--; ) + { + unsigned int idx + = ((*buf & 0xc0) >> 2) + | ((*buf & 0x18) >> 1) + | (*buf & 0x03); + + ++tmphist[idx]; + ++buf; + } + + for (j = 0; j < HISTSIZE; ++j) + hist[j] = (float)tmphist[j] / (len + 1e-30); + + av_push (result, histsv); + } + + RETVAL = newRV_noinc ((SV *)result); +} + OUTPUT: + RETVAL