ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/CV.xs
(Generate patch)

Comparing CV/CV.xs (file contents):
Revision 1.23 by root, Tue Aug 16 23:50:39 2005 UTC vs.
Revision 1.27 by root, Sun Aug 21 02:23:52 2005 UTC

140#endif 140#endif
141 OUTPUT: 141 OUTPUT:
142 RETVAL 142 RETVAL
143 143
144GdkPixbuf_noinc * 144GdkPixbuf_noinc *
145dealpha_expose (GdkPixbuf *pb)
146 CODE:
147{
148 int w = gdk_pixbuf_get_width (pb);
149 int h = gdk_pixbuf_get_height (pb);
150 int bpp = gdk_pixbuf_get_n_channels (pb);
151 int x, y, i;
152 guchar *src = gdk_pixbuf_get_pixels (pb), *dst;
153 int sstr = gdk_pixbuf_get_rowstride (pb), dstr;
154
155 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h);
156
157 dst = gdk_pixbuf_get_pixels (RETVAL);
158 dstr = gdk_pixbuf_get_rowstride (RETVAL);
159
160 for (x = 0; x < w; x++)
161 for (y = 0; y < h; y++)
162 for (i = 0; i < 3; i++)
163 dst[x * 3 + y * dstr + i] = src[x * bpp + y * sstr + i];
164}
165 OUTPUT:
166 RETVAL
167
168GdkPixbuf_noinc *
145transpose (GdkPixbuf *pb) 169transpose (GdkPixbuf *pb)
146 CODE: 170 CODE:
147{ 171{
148 int w = gdk_pixbuf_get_width (pb); 172 int w = gdk_pixbuf_get_width (pb);
149 int h = gdk_pixbuf_get_height (pb); 173 int h = gdk_pixbuf_get_height (pb);
296foldcase (SV *pathsv) 320foldcase (SV *pathsv)
297 PROTOTYPE: $ 321 PROTOTYPE: $
298 CODE: 322 CODE:
299{ 323{
300 STRLEN plen; 324 STRLEN plen;
301 U8 *path = SvPVutf8 (pathsv, plen); 325 U8 *path = (U8 *)SvPVutf8 (pathsv, plen);
302 U8 *pend = path + plen; 326 U8 *pend = path + plen;
303 U8 dst [plen * 6 * 3], *dstp = dst; 327 U8 dst [plen * 6 * 3], *dstp = dst;
304 328
305 while (path < pend) 329 while (path < pend)
306 { 330 {
327 dstp += cl; 351 dstp += cl;
328 path += is_utf8_char (path); 352 path += is_utf8_char (path);
329 } 353 }
330 } 354 }
331 355
332 RETVAL = newSVpvn (dst, dstp - dst); 356 RETVAL = newSVpvn ((const char *)dst, dstp - dst);
333} 357}
334 OUTPUT: 358 OUTPUT:
335 RETVAL 359 RETVAL
336 360
337GdkPixbuf_noinc * 361GdkPixbuf_noinc *
338p7_to_pb (int w, int h, guchar *src) 362p7_to_pb (int w, int h, SV *src_sv)
339 PROTOTYPE: @ 363 PROTOTYPE: @
340 CODE: 364 CODE:
341{ 365{
342 int x, y; 366 int x, y;
343 guchar *dst, *d; 367 guchar *dst, *d;
344 int dstr; 368 int dstr;
369 guchar *src = (guchar *)SvPVbyte_nolen (src_sv);
345 370
346 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h); 371 RETVAL = gdk_pixbuf_new (GDK_COLORSPACE_RGB, 0, 8, w, h);
347 dst = gdk_pixbuf_get_pixels (RETVAL); 372 dst = gdk_pixbuf_get_pixels (RETVAL);
348 dstr = gdk_pixbuf_get_rowstride (RETVAL); 373 dstr = gdk_pixbuf_get_rowstride (RETVAL);
349 374
376 401
377 RETVAL = newSV (w * h); 402 RETVAL = newSV (w * h);
378 SvPOK_only (RETVAL); 403 SvPOK_only (RETVAL);
379 SvCUR_set (RETVAL, w * h); 404 SvCUR_set (RETVAL, w * h);
380 405
381 dst = SvPVX (RETVAL); 406 dst = (guchar *)SvPVX (RETVAL);
382 407
383 memset (Er, 0, sizeof (int) * IW); 408 memset (Er, 0, sizeof (int) * IW);
384 memset (Eg, 0, sizeof (int) * IW); 409 memset (Eg, 0, sizeof (int) * IW);
385 memset (Eb, 0, sizeof (int) * IW); 410 memset (Eb, 0, sizeof (int) * IW);
386 411
480 505
481 RETVAL = newSV (6 * 8 * 12 / 8); 506 RETVAL = newSV (6 * 8 * 12 / 8);
482 SvPOK_only (RETVAL); 507 SvPOK_only (RETVAL);
483 SvCUR_set (RETVAL, 6 * 8 * 12 / 8); 508 SvCUR_set (RETVAL, 6 * 8 * 12 / 8);
484 509
485 dst = SvPVX (RETVAL); 510 dst = (guchar *)SvPVX (RETVAL);
486 511
487 /* some primitive error distribution + random dithering */ 512 /* some primitive error distribution + random dithering */
488 513
489 for (y = 0; y < h; y++) 514 for (y = 0; y < h; y++)
490 { 515 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines