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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines