--- CV/CV.xs 2005/08/16 23:50:39 1.23 +++ CV/CV.xs 2005/08/21 02:23:52 1.27 @@ -142,6 +142,30 @@ RETVAL GdkPixbuf_noinc * +dealpha_expose (GdkPixbuf *pb) + CODE: +{ + int w = gdk_pixbuf_get_width (pb); + int h = gdk_pixbuf_get_height (pb); + int bpp = gdk_pixbuf_get_n_channels (pb); + int x, y, i; + guchar *src = gdk_pixbuf_get_pixels (pb), *dst; + int sstr = gdk_pixbuf_get_rowstride (pb), dstr; + + RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h); + + dst = gdk_pixbuf_get_pixels (RETVAL); + dstr = gdk_pixbuf_get_rowstride (RETVAL); + + for (x = 0; x < w; x++) + for (y = 0; y < h; y++) + for (i = 0; i < 3; i++) + dst[x * 3 + y * dstr + i] = src[x * bpp + y * sstr + i]; +} + OUTPUT: + RETVAL + +GdkPixbuf_noinc * transpose (GdkPixbuf *pb) CODE: { @@ -298,7 +322,7 @@ CODE: { STRLEN plen; - U8 *path = SvPVutf8 (pathsv, plen); + U8 *path = (U8 *)SvPVutf8 (pathsv, plen); U8 *pend = path + plen; U8 dst [plen * 6 * 3], *dstp = dst; @@ -329,19 +353,20 @@ } } - RETVAL = newSVpvn (dst, dstp - dst); + RETVAL = newSVpvn ((const char *)dst, dstp - dst); } OUTPUT: RETVAL GdkPixbuf_noinc * -p7_to_pb (int w, int h, guchar *src) +p7_to_pb (int w, int h, SV *src_sv) PROTOTYPE: @ CODE: { int x, y; guchar *dst, *d; int dstr; + guchar *src = (guchar *)SvPVbyte_nolen (src_sv); RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h); dst = gdk_pixbuf_get_pixels (RETVAL); @@ -378,7 +403,7 @@ SvPOK_only (RETVAL); SvCUR_set (RETVAL, w * h); - dst = SvPVX (RETVAL); + dst = (guchar *)SvPVX (RETVAL); memset (Er, 0, sizeof (int) * IW); memset (Eg, 0, sizeof (int) * IW); @@ -482,7 +507,7 @@ SvPOK_only (RETVAL); SvCUR_set (RETVAL, 6 * 8 * 12 / 8); - dst = SvPVX (RETVAL); + dst = (guchar *)SvPVX (RETVAL); /* some primitive error distribution + random dithering */