1 #define PERL_NO_GET_CONTEXT
8 #define NEED_newRV_noinc
9 #define NEED_sv_2pv_nolen
10 #define NEED_sv_2pvbyte
16 #define i_int_hlines_testing() 1
23 #include "imextpltypes.h"
26 #if i_int_hlines_testing()
34 Allocate memory that will be discarded when mortals are discarded.
39 malloc_temp(pTHX_ size_t size) {
40 SV *sv = sv_2mortal(newSV(size));
45 /* These functions are all shared - then comes platform dependant code */
46 static int getstr(void *hv_t,char *key,char **store) {
51 mm_log((1,"getstr(hv_t %p, key %s, store %p)\n",hv_t,key,store));
53 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
55 svpp=hv_fetch(hv, key, strlen(key), 0);
56 *store=SvPV(*svpp, PL_na );
61 static int getint(void *hv_t,char *key,int *store) {
66 mm_log((1,"getint(hv_t %p, key %s, store %p)\n",hv_t,key,store));
68 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
70 svpp=hv_fetch(hv, key, strlen(key), 0);
71 *store=(int)SvIV(*svpp);
75 static int getdouble(void *hv_t,char* key,double *store) {
80 mm_log((1,"getdouble(hv_t %p, key %s, store %p)\n",hv_t,key,store));
82 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
83 svpp=hv_fetch(hv, key, strlen(key), 0);
84 *store=(double)SvNV(*svpp);
88 static int getvoid(void *hv_t,char* key,void **store) {
93 mm_log((1,"getvoid(hv_t %p, key %s, store %p)\n",hv_t,key,store));
95 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
97 svpp=hv_fetch(hv, key, strlen(key), 0);
98 *store = INT2PTR(void*, SvIV(*svpp));
103 static int getobj(void *hv_t,char *key,char *type,void **store) {
108 mm_log((1,"getobj(hv_t %p, key %s,type %s, store %p)\n",hv_t,key,type,store));
110 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
112 svpp=hv_fetch(hv, key, strlen(key), 0);
114 if (sv_derived_from(*svpp,type)) {
115 IV tmp = SvIV((SV*)SvRV(*svpp));
116 *store = INT2PTR(void*, tmp);
118 mm_log((1,"getobj: key exists in hash but is not of correct type"));
125 UTIL_table_t i_UTIL_table={getstr,getint,getdouble,getvoid,getobj};
127 void my_SvREFCNT_dec(void *p) {
129 SvREFCNT_dec((SV*)p);
134 i_log_entry(char *string, int level) {
135 mm_log((level, "%s", string));
139 #define CBDATA_BUFSIZE 8192
142 /* the SVs we use to call back to Perl */
150 call_reader(struct cbdata *cbd, void *buf, size_t size,
158 if (!SvOK(cbd->readcb))
165 PUSHs(sv_2mortal(newSViv(size)));
166 PUSHs(sv_2mortal(newSViv(maxread)));
169 count = perl_call_sv(cbd->readcb, G_SCALAR);
174 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
180 char *ptr = SvPVbyte(data, len);
182 croak("Too much data returned in reader callback (wanted %d, got %d, expected %d)",
183 (int)size, (int)len, (int)maxread);
185 memcpy(buf, ptr, len);
200 io_seeker(void *p, off_t offset, int whence) {
202 struct cbdata *cbd = p;
207 if (!SvOK(cbd->seekcb))
214 PUSHs(sv_2mortal(newSViv(offset)));
215 PUSHs(sv_2mortal(newSViv(whence)));
218 count = perl_call_sv(cbd->seekcb, G_SCALAR);
223 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
235 io_writer(void *p, void const *data, size_t size) {
237 struct cbdata *cbd = p;
243 if (!SvOK(cbd->writecb))
250 PUSHs(sv_2mortal(newSVpv((char *)data, size)));
253 count = perl_call_sv(cbd->writecb, G_SCALAR);
257 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
260 success = SvTRUE(sv);
267 return success ? size : -1;
271 io_reader(void *p, void *data, size_t size) {
272 struct cbdata *cbd = p;
274 return call_reader(cbd, data, size, size);
277 static int io_closer(void *p) {
279 struct cbdata *cbd = p;
282 if (SvOK(cbd->closecb)) {
292 count = perl_call_sv(cbd->closecb, G_SCALAR);
297 success = SvTRUE(sv);
304 return success ? 0 : -1;
307 static void io_destroyer(void *p) {
309 struct cbdata *cbd = p;
311 SvREFCNT_dec(cbd->writecb);
312 SvREFCNT_dec(cbd->readcb);
313 SvREFCNT_dec(cbd->seekcb);
314 SvREFCNT_dec(cbd->closecb);
319 do_io_new_buffer(pTHX_ SV *data_sv) {
323 data = SvPVbyte(data_sv, length);
324 SvREFCNT_inc(data_sv);
325 return io_new_buffer(data, length, my_SvREFCNT_dec, data_sv);
329 do_io_new_cb(pTHX_ SV *writecb, SV *readcb, SV *seekcb, SV *closecb) {
332 cbd = mymalloc(sizeof(struct cbdata));
333 cbd->writecb = newSVsv(writecb);
334 cbd->readcb = newSVsv(readcb);
335 cbd->seekcb = newSVsv(seekcb);
336 cbd->closecb = newSVsv(closecb);
338 return io_new_cb(cbd, io_reader, io_writer, io_seeker, io_closer,
346 static int lookup_name(struct value_name *names, int count, char *name, int def_value)
349 for (i = 0; i < count; ++i)
350 if (strEQ(names[i].name, name))
351 return names[i].value;
355 static struct value_name transp_names[] =
358 { "threshold", tr_threshold },
359 { "errdiff", tr_errdiff },
360 { "ordered", tr_ordered, },
363 static struct value_name make_color_names[] =
365 { "none", mc_none, },
366 { "webmap", mc_web_map, },
367 { "addi", mc_addi, },
368 { "mediancut", mc_median_cut, },
369 { "mono", mc_mono, },
370 { "monochrome", mc_mono, },
373 static struct value_name translate_names[] =
375 { "giflib", pt_giflib, },
376 { "closest", pt_closest, },
377 { "perturb", pt_perturb, },
378 { "errdiff", pt_errdiff, },
381 static struct value_name errdiff_names[] =
383 { "floyd", ed_floyd, },
384 { "jarvis", ed_jarvis, },
385 { "stucki", ed_stucki, },
386 { "custom", ed_custom, },
389 static struct value_name orddith_names[] =
391 { "random", od_random, },
392 { "dot8", od_dot8, },
393 { "dot4", od_dot4, },
394 { "hline", od_hline, },
395 { "vline", od_vline, },
396 { "/line", od_slashline, },
397 { "slashline", od_slashline, },
398 { "\\line", od_backline, },
399 { "backline", od_backline, },
400 { "tiny", od_tiny, },
401 { "custom", od_custom, },
404 /* look through the hash for quantization options */
406 ip_handle_quant_opts(pTHX_ i_quantize *quant, HV *hv)
408 /*** POSSIBLY BROKEN: do I need to unref the SV from hv_fetch ***/
414 quant->mc_colors = mymalloc(quant->mc_size * sizeof(i_color));
416 sv = hv_fetch(hv, "transp", 6, 0);
417 if (sv && *sv && (str = SvPV(*sv, len))) {
419 lookup_name(transp_names, sizeof(transp_names)/sizeof(*transp_names),
421 if (quant->transp != tr_none) {
422 quant->tr_threshold = 127;
423 sv = hv_fetch(hv, "tr_threshold", 12, 0);
425 quant->tr_threshold = SvIV(*sv);
427 if (quant->transp == tr_errdiff) {
428 sv = hv_fetch(hv, "tr_errdiff", 10, 0);
429 if (sv && *sv && (str = SvPV(*sv, len)))
430 quant->tr_errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
432 if (quant->transp == tr_ordered) {
433 quant->tr_orddith = od_tiny;
434 sv = hv_fetch(hv, "tr_orddith", 10, 0);
435 if (sv && *sv && (str = SvPV(*sv, len)))
436 quant->tr_orddith = lookup_name(orddith_names, sizeof(orddith_names)/sizeof(*orddith_names), str, od_random);
438 if (quant->tr_orddith == od_custom) {
439 sv = hv_fetch(hv, "tr_map", 6, 0);
440 if (sv && *sv && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
441 AV *av = (AV*)SvRV(*sv);
442 len = av_len(av) + 1;
443 if (len > sizeof(quant->tr_custom))
444 len = sizeof(quant->tr_custom);
445 for (i = 0; i < len; ++i) {
446 SV **sv2 = av_fetch(av, i, 0);
448 quant->tr_custom[i] = SvIV(*sv2);
451 while (i < sizeof(quant->tr_custom))
452 quant->tr_custom[i++] = 0;
457 quant->make_colors = mc_median_cut;
458 sv = hv_fetch(hv, "make_colors", 11, 0);
459 if (sv && *sv && (str = SvPV(*sv, len))) {
461 lookup_name(make_color_names, sizeof(make_color_names)/sizeof(*make_color_names), str, mc_median_cut);
463 sv = hv_fetch(hv, "colors", 6, 0);
464 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
465 /* needs to be an array of Imager::Color
466 note that the caller allocates the mc_color array and sets mc_size
468 AV *av = (AV *)SvRV(*sv);
469 quant->mc_count = av_len(av)+1;
470 if (quant->mc_count > quant->mc_size)
471 quant->mc_count = quant->mc_size;
472 for (i = 0; i < quant->mc_count; ++i) {
473 SV **sv1 = av_fetch(av, i, 0);
474 if (sv1 && *sv1 && SvROK(*sv1) && sv_derived_from(*sv1, "Imager::Color")) {
475 i_color *col = INT2PTR(i_color *, SvIV((SV*)SvRV(*sv1)));
476 quant->mc_colors[i] = *col;
480 sv = hv_fetch(hv, "max_colors", 10, 0);
483 if (i <= quant->mc_size && i >= quant->mc_count)
487 quant->translate = pt_closest;
488 sv = hv_fetch(hv, "translate", 9, 0);
489 if (sv && *sv && (str = SvPV(*sv, len))) {
490 quant->translate = lookup_name(translate_names, sizeof(translate_names)/sizeof(*translate_names), str, pt_closest);
492 sv = hv_fetch(hv, "errdiff", 7, 0);
493 if (sv && *sv && (str = SvPV(*sv, len))) {
494 quant->errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
496 if (quant->translate == pt_errdiff && quant->errdiff == ed_custom) {
497 /* get the error diffusion map */
498 sv = hv_fetch(hv, "errdiff_width", 13, 0);
500 quant->ed_width = SvIV(*sv);
501 sv = hv_fetch(hv, "errdiff_height", 14, 0);
503 quant->ed_height = SvIV(*sv);
504 sv = hv_fetch(hv, "errdiff_orig", 12, 0);
506 quant->ed_orig = SvIV(*sv);
507 if (quant->ed_width > 0 && quant->ed_height > 0) {
509 quant->ed_map = mymalloc(sizeof(int)*quant->ed_width*quant->ed_height);
510 sv = hv_fetch(hv, "errdiff_map", 11, 0);
511 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
512 AV *av = (AV*)SvRV(*sv);
513 len = av_len(av) + 1;
514 if (len > quant->ed_width * quant->ed_height)
515 len = quant->ed_width * quant->ed_height;
516 for (i = 0; i < len; ++i) {
517 SV **sv2 = av_fetch(av, i, 0);
519 quant->ed_map[i] = SvIV(*sv2);
520 sum += quant->ed_map[i];
526 myfree(quant->ed_map);
528 quant->errdiff = ed_floyd;
532 sv = hv_fetch(hv, "perturb", 7, 0);
534 quant->perturb = SvIV(*sv);
538 ip_cleanup_quant_opts(pTHX_ i_quantize *quant) {
539 myfree(quant->mc_colors);
541 myfree(quant->ed_map);
544 /* copies the color map from the hv into the colors member of the HV */
546 ip_copy_colors_back(pTHX_ HV *hv, i_quantize *quant) {
552 sv = hv_fetch(hv, "colors", 6, 0);
553 if (!sv || !*sv || !SvROK(*sv) || SvTYPE(SvRV(*sv)) != SVt_PVAV) {
558 av = (AV *)SvRV(*sv);
560 av_extend(av, quant->mc_count+1);
561 for (i = 0; i < quant->mc_count; ++i) {
562 i_color *in = quant->mc_colors+i;
563 Imager__Color c = ICL_new_internal(in->rgb.r, in->rgb.g, in->rgb.b, 255);
564 work = sv_newmortal();
565 sv_setref_pv(work, "Imager::Color", (void *)c);
571 /* loads the segments of a fountain fill into an array */
572 static i_fountain_seg *
573 load_fount_segs(pTHX_ AV *asegs, int *count) {
574 /* Each element of segs must contain:
575 [ start, middle, end, c0, c1, segtype, colortrans ]
576 start, middle, end are doubles from 0 to 1
577 c0, c1 are Imager::Color::Float or Imager::Color objects
578 segtype, colortrans are ints
582 i_fountain_seg *segs;
586 *count = av_len(asegs)+1;
588 croak("i_fountain must have at least one segment");
589 segs = mymalloc(sizeof(i_fountain_seg) * *count);
590 for(i = 0; i < *count; i++) {
591 SV **sv1 = av_fetch(asegs, i, 0);
592 if (!sv1 || !*sv1 || !SvROK(*sv1)
593 || SvTYPE(SvRV(*sv1)) != SVt_PVAV) {
595 croak("i_fountain: segs must be an arrayref of arrayrefs");
597 aseg = (AV *)SvRV(*sv1);
598 if (av_len(aseg) != 7-1) {
600 croak("i_fountain: a segment must have 7 members");
602 for (j = 0; j < 3; ++j) {
603 SV **sv2 = av_fetch(aseg, j, 0);
606 croak("i_fountain: XS error");
608 work[j] = SvNV(*sv2);
610 segs[i].start = work[0];
611 segs[i].middle = work[1];
612 segs[i].end = work[2];
613 for (j = 0; j < 2; ++j) {
614 SV **sv3 = av_fetch(aseg, 3+j, 0);
615 if (!sv3 || !*sv3 || !SvROK(*sv3) ||
616 (!sv_derived_from(*sv3, "Imager::Color")
617 && !sv_derived_from(*sv3, "Imager::Color::Float"))) {
619 croak("i_fountain: segs must contain colors in elements 3 and 4");
621 if (sv_derived_from(*sv3, "Imager::Color::Float")) {
622 segs[i].c[j] = *INT2PTR(i_fcolor *, SvIV((SV *)SvRV(*sv3)));
625 i_color c = *INT2PTR(i_color *, SvIV((SV *)SvRV(*sv3)));
627 for (ch = 0; ch < MAXCHANNELS; ++ch) {
628 segs[i].c[j].channel[ch] = c.channel[ch] / 255.0;
632 for (j = 0; j < 2; ++j) {
633 SV **sv2 = av_fetch(aseg, j+5, 0);
636 croak("i_fountain: XS error");
638 worki[j] = SvIV(*sv2);
640 segs[i].type = worki[0];
641 segs[i].color = worki[1];
647 /* validates the indexes supplied to i_ppal
649 i_ppal() doesn't do that for speed, but I'm not comfortable doing that
654 validate_i_ppal(i_img *im, i_palidx const *indexes, int count) {
655 int color_count = i_colorcount(im);
658 if (color_count == -1)
659 croak("i_plin() called on direct color image");
661 for (i = 0; i < count; ++i) {
662 if (indexes[i] >= color_count) {
663 croak("i_plin() called with out of range color index %d (max %d)",
664 indexes[i], color_count-1);
670 /* I don't think ICLF_* names belong at the C interface
671 this makes the XS code think we have them, to let us avoid
672 putting function bodies in the XS code
674 #define ICLF_new_internal(r, g, b, a) i_fcolor_new((r), (g), (b), (a))
675 #define ICLF_DESTROY(cl) i_fcolor_destroy(cl)
678 #define i_log_enabled() 1
680 #define i_log_enabled() 0
683 #if i_int_hlines_testing()
685 typedef i_int_hlines *Imager__Internal__Hlines;
687 static i_int_hlines *
688 i_int_hlines_new(i_img_dim start_y, i_img_dim count_y, i_img_dim start_x, i_img_dim count_x) {
689 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
690 i_int_init_hlines(result, start_y, count_y, start_x, count_x);
695 static i_int_hlines *
696 i_int_hlines_new_img(i_img *im) {
697 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
698 i_int_init_hlines_img(result, im);
704 i_int_hlines_DESTROY(i_int_hlines *hlines) {
705 i_int_hlines_destroy(hlines);
709 #define i_int_hlines_CLONE_SKIP(cls) 1
711 static int seg_compare(const void *vleft, const void *vright) {
712 const i_int_hline_seg *left = vleft;
713 const i_int_hline_seg *right = vright;
715 return left->minx - right->minx;
719 i_int_hlines_dump(i_int_hlines *hlines) {
721 SV *dump = newSVpvf("start_y: %" i_DF " limit_y: %" i_DF " start_x: %" i_DF " limit_x: %" i_DF"\n",
722 i_DFc(hlines->start_y), i_DFc(hlines->limit_y), i_DFc(hlines->start_x), i_DFc(hlines->limit_x));
725 for (y = hlines->start_y; y < hlines->limit_y; ++y) {
726 i_int_hline_entry *entry = hlines->entries[y-hlines->start_y];
729 /* sort the segments, if any */
731 qsort(entry->segs, entry->count, sizeof(i_int_hline_seg), seg_compare);
733 sv_catpvf(dump, " %" i_DF " (%" i_DF "):", i_DFc(y), i_DFc(entry->count));
734 for (i = 0; i < entry->count; ++i) {
735 sv_catpvf(dump, " [%" i_DF ", %" i_DF ")", i_DFc(entry->segs[i].minx),
736 i_DFc(entry->segs[i].x_limit));
738 sv_catpv(dump, "\n");
748 i_sv_off_t(pTHX_ SV *sv) {
749 #if LSEEKSIZE > IVSIZE
750 return (off_t)SvNV(sv);
752 return (off_t)SvIV(sv);
757 i_new_sv_off_t(pTHX_ off_t off) {
758 #if LSEEKSIZE > IVSIZE
765 static im_pl_ext_funcs im_perl_funcs =
767 IMAGER_PL_API_VERSION,
769 ip_handle_quant_opts,
770 ip_cleanup_quant_opts,
774 #define PERL_PL_SET_GLOBAL_CALLBACKS \
775 sv_setiv(get_sv(PERL_PL_FUNCTION_TABLE_NAME, 1), PTR2IV(&im_perl_funcs));
778 #define i_exif_enabled() 1
780 #define i_exif_enabled() 0
783 /* trying to use more C style names, map them here */
784 #define i_io_DESTROY(ig) io_glue_destroy(ig)
786 #define i_img_get_width(im) ((im)->xsize)
787 #define i_img_get_height(im) ((im)->ysize)
789 #define i_img_epsilonf() (DBL_EPSILON * 4)
791 /* avoid some xsubpp strangeness */
794 MODULE = Imager PACKAGE = Imager::Color PREFIX = ICL_
797 ICL_new_internal(r,g,b,a)
809 ICL_set_internal(cl,r,g,b,a)
816 ICL_set_internal(cl, r, g, b, a);
830 PUSHs(sv_2mortal(newSVnv(cl->rgba.r)));
831 PUSHs(sv_2mortal(newSVnv(cl->rgba.g)));
832 PUSHs(sv_2mortal(newSVnv(cl->rgba.b)));
833 PUSHs(sv_2mortal(newSVnv(cl->rgba.a)));
839 RETVAL = mymalloc(sizeof(i_color));
841 i_hsv_to_rgb(RETVAL);
849 RETVAL = mymalloc(sizeof(i_color));
851 i_rgb_to_hsv(RETVAL);
857 MODULE = Imager PACKAGE = Imager::Color::Float PREFIX=ICLF_
860 ICLF_new_internal(r, g, b, a)
868 Imager::Color::Float cl
872 Imager::Color::Float cl
876 EXTEND(SP, MAXCHANNELS);
877 for (ch = 0; ch < MAXCHANNELS; ++ch) {
878 /* printf("%d: %g\n", ch, cl->channel[ch]); */
879 PUSHs(sv_2mortal(newSVnv(cl->channel[ch])));
883 ICLF_set_internal(cl,r,g,b,a)
884 Imager::Color::Float cl
899 Imager::Color::Float c
901 RETVAL = mymalloc(sizeof(i_fcolor));
903 i_hsv_to_rgbf(RETVAL);
909 Imager::Color::Float c
911 RETVAL = mymalloc(sizeof(i_fcolor));
913 i_rgb_to_hsvf(RETVAL);
917 MODULE = Imager PACKAGE = Imager::ImgRaw PREFIX = IIM_
931 MODULE = Imager PACKAGE = Imager
945 io_new_buffer(data_sv)
948 RETVAL = do_io_new_buffer(aTHX_ data_sv);
953 io_new_cb(writecb, readcb, seekcb, closecb, maxwrite = CBDATA_BUFSIZE)
960 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
972 tlength = io_slurp(ig, &data);
973 RETVAL = newSVpv((char *)data,tlength);
980 i_set_image_file_limits(width, height, bytes)
986 i_get_image_file_limits()
988 i_img_dim width, height;
991 if (i_get_image_file_limits(&width, &height, &bytes)) {
993 PUSHs(sv_2mortal(newSViv(width)));
994 PUSHs(sv_2mortal(newSViv(height)));
995 PUSHs(sv_2mortal(newSVuv(bytes)));
998 MODULE = Imager PACKAGE = Imager::IO PREFIX = io_
1001 io_new_fd(class, fd)
1004 RETVAL = io_new_fd(fd);
1009 io_new_buffer(class, data_sv)
1012 RETVAL = do_io_new_buffer(aTHX_ data_sv);
1017 io_new_cb(class, writecb, readcb, seekcb, closecb)
1023 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
1028 io_new_bufchain(class)
1030 RETVAL = io_new_bufchain();
1038 unsigned char* data;
1042 tlength = io_slurp(ig, &data);
1043 RETVAL = newSVpv((char *)data,tlength);
1048 MODULE = Imager PACKAGE = Imager::IO PREFIX = i_io_
1051 i_io_raw_write(ig, data_sv)
1059 if (SvUTF8(data_sv)) {
1060 data_sv = sv_2mortal(newSVsv(data_sv));
1061 /* yes, we want this to croak() if the SV can't be downgraded */
1062 sv_utf8_downgrade(data_sv, FALSE);
1065 data = SvPV(data_sv, size);
1066 RETVAL = i_io_raw_write(ig, data, size);
1071 i_io_raw_read(ig, buffer_sv, size)
1080 croak("size negative in call to i_io_raw_read()");
1081 /* prevent an undefined value warning if they supplied an
1083 Orginally conditional on !SvOK(), but this will prevent the
1084 downgrade from croaking */
1085 sv_setpvn(buffer_sv, "", 0);
1087 if (SvUTF8(buffer_sv))
1088 sv_utf8_downgrade(buffer_sv, FALSE);
1090 buffer = SvGROW(buffer_sv, size+1);
1091 result = i_io_raw_read(ig, buffer, size);
1093 SvCUR_set(buffer_sv, result);
1094 *SvEND(buffer_sv) = '\0';
1095 SvPOK_only(buffer_sv);
1097 PUSHs(sv_2mortal(newSViv(result)));
1103 i_io_raw_read2(ig, size)
1112 croak("size negative in call to i_io_read2()");
1113 buffer_sv = newSV(size);
1114 buffer = SvGROW(buffer_sv, size+1);
1115 result = i_io_raw_read(ig, buffer, size);
1117 SvCUR_set(buffer_sv, result);
1118 *SvEND(buffer_sv) = '\0';
1119 SvPOK_only(buffer_sv);
1121 PUSHs(sv_2mortal(buffer_sv));
1125 SvREFCNT_dec(buffer_sv);
1129 i_io_raw_seek(ig, position, whence)
1143 i_io_CLONE_SKIP(...)
1145 (void)items; /* avoid unused warning for XS variable */
1172 i_io_seek(ig, off, whence)
1178 i_io_peekn(ig, size)
1186 buffer_sv = newSV(size+1);
1187 buffer = SvGROW(buffer_sv, size+1);
1188 result = i_io_peekn(ig, buffer, size);
1190 SvCUR_set(buffer_sv, result);
1191 *SvEND(buffer_sv) = '\0';
1192 SvPOK_only(buffer_sv);
1194 PUSHs(sv_2mortal(buffer_sv));
1198 SvREFCNT_dec(buffer_sv);
1202 i_io_read(ig, buffer_sv, size)
1211 croak("size negative in call to i_io_read()");
1212 /* prevent an undefined value warning if they supplied an
1214 Orginally conditional on !SvOK(), but this will prevent the
1215 downgrade from croaking */
1216 sv_setpvn(buffer_sv, "", 0);
1218 if (SvUTF8(buffer_sv))
1219 sv_utf8_downgrade(buffer_sv, FALSE);
1221 buffer = SvGROW(buffer_sv, size+1);
1222 result = i_io_read(ig, buffer, size);
1224 SvCUR_set(buffer_sv, result);
1225 *SvEND(buffer_sv) = '\0';
1226 SvPOK_only(buffer_sv);
1228 PUSHs(sv_2mortal(newSViv(result)));
1234 i_io_read2(ig, size)
1243 croak("size zero in call to read2()");
1244 buffer_sv = newSV(size);
1245 buffer = SvGROW(buffer_sv, size+1);
1246 result = i_io_read(ig, buffer, size);
1248 SvCUR_set(buffer_sv, result);
1249 *SvEND(buffer_sv) = '\0';
1250 SvPOK_only(buffer_sv);
1252 PUSHs(sv_2mortal(buffer_sv));
1256 SvREFCNT_dec(buffer_sv);
1260 i_io_gets(ig, size = 8192, eol = NEWLINE)
1270 croak("size too small in call to gets()");
1271 buffer_sv = sv_2mortal(newSV(size+1));
1272 buffer = SvPVX(buffer_sv);
1273 result = i_io_gets(ig, buffer, size+1, eol);
1275 SvCUR_set(buffer_sv, result);
1276 *SvEND(buffer_sv) = '\0';
1277 SvPOK_only(buffer_sv);
1283 i_io_write(ig, data_sv)
1291 if (SvUTF8(data_sv)) {
1292 data_sv = sv_2mortal(newSVsv(data_sv));
1293 /* yes, we want this to croak() if the SV can't be downgraded */
1294 sv_utf8_downgrade(data_sv, FALSE);
1297 data = SvPV(data_sv, size);
1298 RETVAL = i_io_write(ig, data, size);
1303 i_io_dump(ig, flags = I_IO_DUMP_DEFAULT)
1308 i_io_set_buffered(ig, flag = 1)
1313 i_io_is_buffered(ig)
1324 MODULE = Imager PACKAGE = Imager
1335 while( (item=i_format_list[i++]) != NULL ) {
1337 PUSHs(sv_2mortal(newSVpv(item,0)));
1350 i_img_empty_ch(im,x,y,ch)
1357 i_sametype(im, x, y)
1363 i_sametype_chans(im, x, y, channels)
1370 i_init_log(name_sv,level)
1374 const char *name = SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
1376 RETVAL = i_init_log(name, level);
1381 i_log_entry(string,level)
1402 i_img_info(im,info);
1404 PUSHs(sv_2mortal(newSViv(info[0])));
1405 PUSHs(sv_2mortal(newSViv(info[1])));
1406 PUSHs(sv_2mortal(newSViv(info[2])));
1407 PUSHs(sv_2mortal(newSViv(info[3])));
1413 i_img_setmask(im,ch_mask)
1422 i_img_getchannels(im)
1431 sv_2mortal(newSVpv((char *)im->idata, im->bytes))
1439 i_img_get_height(im)
1444 i_img_is_monochrome(im)
1450 result = i_img_is_monochrome(im, &zero_is_white);
1452 if (GIMME_V == G_ARRAY) {
1455 PUSHs(sv_2mortal(newSViv(zero_is_white)));
1464 i_line(im,x1,y1,x2,y2,val,endp)
1474 i_line_aa(im,x1,y1,x2,y2,val,endp)
1484 i_box(im,x1,y1,x2,y2,val)
1493 i_box_filled(im,x1,y1,x2,y2,val)
1502 i_box_filledf(im,x1,y1,x2,y2,val)
1508 Imager::Color::Float val
1511 i_box_cfill(im,x1,y1,x2,y2,fill)
1517 Imager::FillHandle fill
1520 i_arc(im,x,y,rad,d1,d2,val)
1530 i_arc_aa(im,x,y,rad,d1,d2,val)
1540 i_arc_cfill(im,x,y,rad,d1,d2,fill)
1547 Imager::FillHandle fill
1550 i_arc_aa_cfill(im,x,y,rad,d1,d2,fill)
1557 Imager::FillHandle fill
1561 i_circle_aa(im,x,y,rad,val)
1569 i_circle_out(im,x,y,rad,val)
1577 i_circle_out_aa(im,x,y,rad,val)
1585 i_arc_out(im,x,y,rad,d1,d2,val)
1595 i_arc_out_aa(im,x,y,rad,d1,d2,val)
1606 i_bezier_multi(im,xc,yc,val)
1619 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1620 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1621 if (!SvROK(ST(2))) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1622 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1623 av1=(AV*)SvRV(ST(1));
1624 av2=(AV*)SvRV(ST(2));
1625 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_bezier_multi must be equal length\n");
1627 x=mymalloc( len*sizeof(double) );
1628 y=mymalloc( len*sizeof(double) );
1629 for(i=0;i<len;i++) {
1630 sv1=(*(av_fetch(av1,i,0)));
1631 sv2=(*(av_fetch(av2,i,0)));
1632 x[i]=(double)SvNV(sv1);
1633 y[i]=(double)SvNV(sv2);
1635 i_bezier_multi(im,len,x,y,val);
1641 i_poly_aa(im,xc,yc,val)
1654 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1655 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1656 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1657 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1658 av1=(AV*)SvRV(ST(1));
1659 av2=(AV*)SvRV(ST(2));
1660 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa must be equal length\n");
1662 x=mymalloc( len*sizeof(double) );
1663 y=mymalloc( len*sizeof(double) );
1664 for(i=0;i<len;i++) {
1665 sv1=(*(av_fetch(av1,i,0)));
1666 sv2=(*(av_fetch(av2,i,0)));
1667 x[i]=(double)SvNV(sv1);
1668 y[i]=(double)SvNV(sv2);
1670 RETVAL = i_poly_aa(im,len,x,y,val);
1677 i_poly_aa_cfill(im,xc,yc,fill)
1679 Imager::FillHandle fill
1689 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1690 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1691 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1692 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1693 av1=(AV*)SvRV(ST(1));
1694 av2=(AV*)SvRV(ST(2));
1695 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa_cfill must be equal length\n");
1697 x=mymalloc( len*sizeof(double) );
1698 y=mymalloc( len*sizeof(double) );
1699 for(i=0;i<len;i++) {
1700 sv1=(*(av_fetch(av1,i,0)));
1701 sv2=(*(av_fetch(av2,i,0)));
1702 x[i]=(double)SvNV(sv1);
1703 y[i]=(double)SvNV(sv2);
1705 RETVAL = i_poly_aa_cfill(im,len,x,y,fill);
1714 i_flood_fill(im,seedx,seedy,dcol)
1721 i_flood_cfill(im,seedx,seedy,fill)
1725 Imager::FillHandle fill
1728 i_flood_fill_border(im,seedx,seedy,dcol, border)
1733 Imager::Color border
1736 i_flood_cfill_border(im,seedx,seedy,fill, border)
1740 Imager::FillHandle fill
1741 Imager::Color border
1745 i_copyto(im,src,x1,y1,x2,y2,tx,ty)
1757 i_copyto_trans(im,src,x1,y1,x2,y2,tx,ty,trans)
1774 i_rubthru(im,src,tx,ty,src_minx,src_miny,src_maxx,src_maxy)
1785 i_compose(out, src, out_left, out_top, src_left, src_top, width, height, combine = ic_normal, opacity = 0.0)
1798 i_compose_mask(out, src, mask, out_left, out_top, src_left, src_top, mask_left, mask_top, width, height, combine = ic_normal, opacity = 0.0)
1814 i_combine(src_av, channels_av = NULL)
1818 i_img **imgs = NULL;
1820 int *channels = NULL;
1825 in_count = av_len(src_av) + 1;
1827 imgs = mymalloc(sizeof(i_img*) * in_count);
1828 channels = mymalloc(sizeof(int) * in_count);
1829 for (i = 0; i < in_count; ++i) {
1830 psv = av_fetch(src_av, i, 0);
1831 if (!psv || !*psv || !sv_derived_from(*psv, "Imager::ImgRaw")) {
1834 croak("imgs must contain only images");
1836 tmp = SvIV((SV*)SvRV(*psv));
1837 imgs[i] = INT2PTR(i_img*, tmp);
1839 (psv = av_fetch(channels_av, i, 0)) != NULL &&
1841 channels[i] = SvIV(*psv);
1848 RETVAL = i_combine(imgs, channels, in_count);
1855 i_flipxy(im, direction)
1860 i_rotate90(im, degrees)
1865 i_rotate_exact(im, amount, ...)
1869 i_color *backp = NULL;
1870 i_fcolor *fbackp = NULL;
1874 /* extract the bg colors if any */
1875 /* yes, this is kind of strange */
1876 for (i = 2; i < items; ++i) {
1878 if (sv_derived_from(sv1, "Imager::Color")) {
1879 IV tmp = SvIV((SV*)SvRV(sv1));
1880 backp = INT2PTR(i_color *, tmp);
1882 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1883 IV tmp = SvIV((SV*)SvRV(sv1));
1884 fbackp = INT2PTR(i_fcolor *, tmp);
1887 RETVAL = i_rotate_exact_bg(im, amount, backp, fbackp);
1892 i_matrix_transform(im, xsize, ysize, matrix, ...)
1902 i_color *backp = NULL;
1903 i_fcolor *fbackp = NULL;
1905 if (!SvROK(ST(3)) || SvTYPE(SvRV(ST(3))) != SVt_PVAV)
1906 croak("i_matrix_transform: parameter 4 must be an array ref\n");
1907 av=(AV*)SvRV(ST(3));
1911 for (i = 0; i < len; ++i) {
1912 sv1=(*(av_fetch(av,i,0)));
1913 matrix[i] = SvNV(sv1);
1917 /* extract the bg colors if any */
1918 /* yes, this is kind of strange */
1919 for (i = 4; i < items; ++i) {
1921 if (sv_derived_from(sv1, "Imager::Color")) {
1922 IV tmp = SvIV((SV*)SvRV(sv1));
1923 backp = INT2PTR(i_color *, tmp);
1925 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1926 IV tmp = SvIV((SV*)SvRV(sv1));
1927 fbackp = INT2PTR(i_fcolor *, tmp);
1930 RETVAL = i_matrix_transform_bg(im, xsize, ysize, matrix, backp, fbackp);
1935 i_gaussian(im,stdev)
1940 i_unsharp_mask(im,stdev,scale)
1955 len = av_len(coef) + 1;
1956 c_coef=mymalloc( len * sizeof(double) );
1957 for(i = 0; i < len; i++) {
1958 sv1 = (*(av_fetch(coef, i, 0)));
1959 c_coef[i] = (double)SvNV(sv1);
1961 RETVAL = i_conv(im, c_coef, len);
1967 i_convert(src, avmain)
1979 outchan = av_len(avmain)+1;
1980 /* find the biggest */
1982 for (j=0; j < outchan; ++j) {
1983 temp = av_fetch(avmain, j, 0);
1984 if (temp && SvROK(*temp) && SvTYPE(SvRV(*temp)) == SVt_PVAV) {
1985 avsub = (AV*)SvRV(*temp);
1986 len = av_len(avsub)+1;
1991 coeff = mymalloc(sizeof(double) * outchan * inchan);
1992 for (j = 0; j < outchan; ++j) {
1993 avsub = (AV*)SvRV(*av_fetch(avmain, j, 0));
1994 len = av_len(avsub)+1;
1995 for (i = 0; i < len; ++i) {
1996 temp = av_fetch(avsub, i, 0);
1998 coeff[i+j*inchan] = SvNV(*temp);
2000 coeff[i+j*inchan] = 0;
2003 coeff[i++ + j*inchan] = 0;
2005 RETVAL = i_convert(src, coeff, outchan, inchan);
2015 unsigned int mask = 0;
2021 unsigned char (*maps)[256];
2023 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
2024 croak("i_map: parameter 2 must be an arrayref\n");
2025 avmain = (AV*)SvRV(ST(1));
2026 len = av_len(avmain)+1;
2027 if (im->channels < len) len = im->channels;
2029 maps = mymalloc( len * sizeof(unsigned char [256]) );
2031 for (j=0; j<len ; j++) {
2032 temp = av_fetch(avmain, j, 0);
2033 if (temp && SvROK(*temp) && (SvTYPE(SvRV(*temp)) == SVt_PVAV) ) {
2034 avsub = (AV*)SvRV(*temp);
2035 if(av_len(avsub) != 255) continue;
2037 for (i=0; i<256 ; i++) {
2039 temp = av_fetch(avsub, i, 0);
2040 val = temp ? SvIV(*temp) : 0;
2042 if (val>255) val = 255;
2047 i_map(im, maps, mask);
2058 i_img_diffd(im1,im2)
2063 i_img_samef(im1, im2, epsilon = i_img_epsilonf(), what=NULL)
2073 _is_color_object(sv)
2077 RETVAL = SvOK(sv) && SvROK(sv) &&
2078 (sv_derived_from(sv, "Imager::Color")
2079 || sv_derived_from(sv, "Imager::Color::Float"));
2091 MODULE = Imager PACKAGE = Imager::Font::TT PREFIX=TT_
2093 #define TT_DESTROY(handle) i_tt_destroy(handle)
2097 Imager::Font::TT handle
2102 (void)items; /* avoid unused warning */
2108 MODULE = Imager PACKAGE = Imager
2112 i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
2113 Imager::Font::TT handle
2131 str = SvPV(str_sv, len);
2132 RETVAL = i_tt_text(handle, im, xb, yb, cl, points, str,
2133 len, smooth, utf8, align);
2139 i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
2140 Imager::Font::TT handle
2158 str = SvPV(str_sv, len);
2159 RETVAL = i_tt_cp(handle, im, xb, yb, channel, points, str, len,
2160 smooth, utf8, align);
2166 i_tt_bbox(handle,point,str_sv,len_ignored, utf8)
2167 Imager::Font::TT handle
2172 i_img_dim cords[BOUNDING_BOX_COUNT];
2182 str = SvPV(str_sv, len);
2183 if ((rc=i_tt_bbox(handle,point,str,len,cords, utf8))) {
2185 for (i = 0; i < rc; ++i) {
2186 PUSHs(sv_2mortal(newSViv(cords[i])));
2191 i_tt_has_chars(handle, text_sv, utf8)
2192 Imager::Font::TT handle
2203 if (SvUTF8(text_sv))
2206 text = SvPV(text_sv, len);
2207 work = mymalloc(len);
2208 count = i_tt_has_chars(handle, text, len, utf8, work);
2209 if (GIMME_V == G_ARRAY) {
2211 for (i = 0; i < count; ++i) {
2212 PUSHs(boolSV(work[i]));
2217 PUSHs(sv_2mortal(newSVpv(work, count)));
2222 i_tt_dump_names(handle)
2223 Imager::Font::TT handle
2226 i_tt_face_name(handle)
2227 Imager::Font::TT handle
2232 len = i_tt_face_name(handle, name, sizeof(name));
2235 PUSHs(sv_2mortal(newSVpv(name, len-1)));
2239 i_tt_glyph_name(handle, text_sv, utf8 = 0)
2240 Imager::Font::TT handle
2251 if (SvUTF8(text_sv))
2254 text = SvPV(text_sv, work_len);
2259 ch = i_utf8_advance(&text, &len);
2261 i_push_error(0, "invalid UTF8 character");
2270 if ((outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) != 0) {
2271 PUSHs(sv_2mortal(newSVpv(name, 0)));
2274 PUSHs(&PL_sv_undef);
2281 i_test_format_probe(ig, length)
2286 i_readpnm_wiol(ig, allow_incomplete)
2288 int allow_incomplete
2292 i_readpnm_multi_wiol(ig, allow_incomplete)
2294 int allow_incomplete
2300 imgs = i_readpnm_multi_wiol(ig, &count, allow_incomplete);
2303 for (i = 0; i < count; ++i) {
2304 SV *sv = sv_newmortal();
2305 sv_setref_pv(sv, "Imager::ImgRaw", (void *)imgs[i]);
2312 i_writeppm_wiol(im, ig)
2321 i_readraw_wiol(ig,x,y,datachannels,storechannels,intrl)
2330 i_writeraw_wiol(im,ig)
2335 i_writebmp_wiol(im,ig)
2340 i_readbmp_wiol(ig, allow_incomplete=0)
2342 int allow_incomplete
2346 i_writetga_wiol(im,ig, wierdpack, compress, idstring)
2355 idlen = SvCUR(ST(4));
2356 RETVAL = i_writetga_wiol(im, ig, wierdpack, compress, idstring, idlen);
2362 i_readtga_wiol(ig, length)
2370 i_scaleaxis(im,Value,Axis)
2376 i_scale_nn(im,scx,scy)
2382 i_scale_mixing(im, width, height)
2392 i_count_colors(im,maxc)
2397 i_get_anonymous_color_histo(im, maxc = 0x40000000)
2402 unsigned int * col_usage = NULL;
2405 col_cnt = i_get_anonymous_color_histo(im, &col_usage, maxc);
2406 EXTEND(SP, col_cnt);
2407 for (i = 0; i < col_cnt; i++) {
2408 PUSHs(sv_2mortal(newSViv( col_usage[i])));
2415 i_transform(im,opx,opy,parm)
2428 if (!SvROK(ST(1))) croak("Imager: Parameter 1 must be a reference to an array\n");
2429 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to an array\n");
2430 if (!SvROK(ST(3))) croak("Imager: Parameter 3 must be a reference to an array\n");
2431 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 must be a reference to an array\n");
2432 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 must be a reference to an array\n");
2433 if (SvTYPE(SvRV(ST(3))) != SVt_PVAV) croak("Imager: Parameter 3 must be a reference to an array\n");
2434 av=(AV*)SvRV(ST(1));
2436 opx=mymalloc( opxl*sizeof(int) );
2437 for(i=0;i<opxl;i++) {
2438 sv1=(*(av_fetch(av,i,0)));
2439 opx[i]=(int)SvIV(sv1);
2441 av=(AV*)SvRV(ST(2));
2443 opy=mymalloc( opyl*sizeof(int) );
2444 for(i=0;i<opyl;i++) {
2445 sv1=(*(av_fetch(av,i,0)));
2446 opy[i]=(int)SvIV(sv1);
2448 av=(AV*)SvRV(ST(3));
2449 parmlen=av_len(av)+1;
2450 parm=mymalloc( parmlen*sizeof(double) );
2451 for(i=0;i<parmlen;i++) { /* FIXME: Bug? */
2452 sv1=(*(av_fetch(av,i,0)));
2453 parm[i]=(double)SvNV(sv1);
2455 RETVAL=i_transform(im,opx,opxl,opy,opyl,parm,parmlen);
2459 ST(0) = sv_newmortal();
2460 if (RETVAL == 0) ST(0)=&PL_sv_undef;
2461 else sv_setref_pv(ST(0), "Imager::ImgRaw", (void*)RETVAL);
2466 i_transform2(sv_width,sv_height,channels,sv_ops,av_n_regs,av_c_regs,av_in_imgs)
2491 in_imgs_count = av_len(av_in_imgs)+1;
2492 for (i = 0; i < in_imgs_count; ++i) {
2493 sv1 = *av_fetch(av_in_imgs, i, 0);
2494 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2495 croak("sv_in_img must contain only images");
2498 if (in_imgs_count > 0) {
2499 in_imgs = mymalloc(in_imgs_count*sizeof(i_img*));
2500 for (i = 0; i < in_imgs_count; ++i) {
2501 sv1 = *av_fetch(av_in_imgs,i,0);
2502 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2503 croak("Parameter 5 must contain only images");
2505 tmp = SvIV((SV*)SvRV(sv1));
2506 in_imgs[i] = INT2PTR(i_img*, tmp);
2510 /* no input images */
2513 /* default the output size from the first input if possible */
2515 width = SvIV(sv_width);
2516 else if (in_imgs_count)
2517 width = in_imgs[0]->xsize;
2519 croak("No output image width supplied");
2521 if (SvOK(sv_height))
2522 height = SvIV(sv_height);
2523 else if (in_imgs_count)
2524 height = in_imgs[0]->ysize;
2526 croak("No output image height supplied");
2528 ops = (struct rm_op *)SvPV(sv_ops, ops_len);
2529 if (ops_len % sizeof(struct rm_op))
2530 croak("Imager: Parameter 3 must be a bitmap of regops\n");
2531 ops_count = ops_len / sizeof(struct rm_op);
2533 n_regs_count = av_len(av_n_regs)+1;
2534 n_regs = mymalloc(n_regs_count * sizeof(double));
2535 for (i = 0; i < n_regs_count; ++i) {
2536 sv1 = *av_fetch(av_n_regs,i,0);
2538 n_regs[i] = SvNV(sv1);
2540 c_regs_count = av_len(av_c_regs)+1;
2541 c_regs = mymalloc(c_regs_count * sizeof(i_color));
2542 /* I don't bother initializing the colou?r registers */
2544 RETVAL=i_transform2(width, height, channels, ops, ops_count,
2545 n_regs, n_regs_count,
2546 c_regs, c_regs_count, in_imgs, in_imgs_count);
2551 ST(0) = sv_newmortal();
2552 if (RETVAL == 0) ST(0)=&PL_sv_undef;
2553 else sv_setref_pv(ST(0), "Imager::ImgRaw", (void*)RETVAL);
2559 i_contrast(im,intensity)
2572 i_noise(im,amount,type)
2578 i_bumpmap(im,bump,channel,light_x,light_y,strength)
2588 i_bumpmap_complex(im,bump,channel,tx,ty,Lx,Ly,Lz,cd,cs,n,Ia,Il,Is)
2607 i_postlevels(im,levels)
2617 i_watermark(im,wmark,tx,ty,pixdiff)
2619 Imager::ImgRaw wmark
2626 i_autolevels(im,lsat,usat,skew)
2633 i_radnoise(im,xo,yo,rscale,ascale)
2641 i_turbnoise(im, xo, yo, scale)
2664 croak("Usage: i_gradgen(im, xo, yo, ival, dmeasure)");
2665 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2666 croak("i_gradgen: Second argument must be an array ref");
2667 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2668 croak("i_gradgen: Third argument must be an array ref");
2669 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2670 croak("i_gradgen: Fourth argument must be an array ref");
2671 axx = (AV *)SvRV(ST(1));
2672 ayy = (AV *)SvRV(ST(2));
2673 ac = (AV *)SvRV(ST(3));
2674 dmeasure = (int)SvIV(ST(4));
2676 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2677 num = num <= av_len(ac) ? num : av_len(ac);
2679 if (num < 2) croak("Usage: i_gradgen array refs must have more than 1 entry each");
2680 xo = mymalloc( sizeof(i_img_dim) * num );
2681 yo = mymalloc( sizeof(i_img_dim) * num );
2682 ival = mymalloc( sizeof(i_color) * num );
2683 for(i = 0; i<num; i++) {
2684 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2685 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2686 sv = *av_fetch(ac, i, 0);
2687 if ( !sv_derived_from(sv, "Imager::Color") ) {
2688 free(axx); free(ayy); free(ac);
2689 croak("i_gradgen: Element of fourth argument is not derived from Imager::Color");
2691 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2693 i_gradgen(im, num, xo, yo, ival, dmeasure);
2699 i_diff_image(im, im2, mindist=0)
2705 i_fountain(im, xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2715 double ssample_param
2719 i_fountain_seg *segs;
2721 if (!SvROK(ST(10)) || ! SvTYPE(SvRV(ST(10))))
2722 croak("i_fountain: argument 11 must be an array ref");
2724 asegs = (AV *)SvRV(ST(10));
2725 segs = load_fount_segs(aTHX_ asegs, &count);
2726 RETVAL = i_fountain(im, xa, ya, xb, yb, type, repeat, combine,
2727 super_sample, ssample_param, count, segs);
2733 i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2742 double ssample_param
2746 i_fountain_seg *segs;
2748 if (!SvROK(ST(9)) || ! SvTYPE(SvRV(ST(9))))
2749 croak("i_fountain: argument 11 must be an array ref");
2751 asegs = (AV *)SvRV(ST(9));
2752 segs = load_fount_segs(aTHX_ asegs, &count);
2753 RETVAL = i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine,
2754 super_sample, ssample_param, count, segs);
2760 i_new_fill_opacity(other_fill, alpha_mult)
2761 Imager::FillHandle other_fill
2772 errors = i_errors();
2774 while (errors[i].msg) {
2776 sv = newSVpv(errors[i].msg, strlen(errors[i].msg));
2777 if (!av_store(av, 0, sv)) {
2780 sv = newSViv(errors[i].code);
2781 if (!av_store(av, 1, sv)) {
2784 PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
2792 i_push_error(code, msg)
2797 i_nearest_color(im, ...)
2812 croak("Usage: i_nearest_color(im, xo, yo, ival, dmeasure)");
2813 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2814 croak("i_nearest_color: Second argument must be an array ref");
2815 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2816 croak("i_nearest_color: Third argument must be an array ref");
2817 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2818 croak("i_nearest_color: Fourth argument must be an array ref");
2819 axx = (AV *)SvRV(ST(1));
2820 ayy = (AV *)SvRV(ST(2));
2821 ac = (AV *)SvRV(ST(3));
2822 dmeasure = (int)SvIV(ST(4));
2824 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2825 num = num <= av_len(ac) ? num : av_len(ac);
2827 if (num < 2) croak("Usage: i_nearest_color array refs must have more than 1 entry each");
2828 xo = mymalloc( sizeof(i_img_dim) * num );
2829 yo = mymalloc( sizeof(i_img_dim) * num );
2830 ival = mymalloc( sizeof(i_color) * num );
2831 for(i = 0; i<num; i++) {
2832 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2833 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2834 sv = *av_fetch(ac, i, 0);
2835 if ( !sv_derived_from(sv, "Imager::Color") ) {
2836 free(axx); free(ayy); free(ac);
2837 croak("i_nearest_color: Element of fourth argument is not derived from Imager::Color");
2839 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2841 RETVAL = i_nearest_color(im, num, xo, yo, ival, dmeasure);
2855 rc=DSO_open(filename,&evstr);
2859 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2860 PUSHs(sv_2mortal(newSVpvn(evstr, strlen(evstr))));
2863 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2869 DSO_close(dso_handle)
2873 DSO_funclist(dso_handle_v)
2877 DSO_handle *dso_handle;
2878 func_ptr *functions;
2880 dso_handle=(DSO_handle*)dso_handle_v;
2881 functions = DSO_funclist(dso_handle);
2883 while( functions[i].name != NULL) {
2885 PUSHs(sv_2mortal(newSVpv(functions[i].name,0)));
2887 PUSHs(sv_2mortal(newSVpv(functions[i++].pcode,0)));
2891 DSO_call(handle,func_index,hv)
2897 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to a hash\n");
2898 hv=(HV*)SvRV(ST(2));
2899 if (SvTYPE(hv)!=SVt_PVHV) croak("Imager: Parameter 2 must be a reference to a hash\n");
2900 DSO_call( (DSO_handle *)handle,func_index,hv);
2903 i_get_pixel(im, x, y)
2910 color = (i_color *)mymalloc(sizeof(i_color));
2911 if (i_gpix(im, x, y, color) == 0) {
2912 RETVAL = NEWSV(0, 0);
2913 sv_setref_pv(RETVAL, "Imager::Color", (void *)color);
2917 RETVAL = &PL_sv_undef;
2924 i_ppix(im, x, y, cl)
2931 i_img_pal_new(x, y, channels, maxpal)
2938 i_img_to_pal(src, quant)
2944 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2945 croak("i_img_to_pal: second argument must be a hash ref");
2946 hv = (HV *)SvRV(ST(1));
2947 memset(&quant, 0, sizeof(quant));
2949 quant.mc_size = 256;
2950 ip_handle_quant_opts(aTHX_ &quant, hv);
2951 RETVAL = i_img_to_pal(src, &quant);
2953 ip_copy_colors_back(aTHX_ hv, &quant);
2955 ip_cleanup_quant_opts(aTHX_ &quant);
2974 work = mymalloc((r-l) * sizeof(i_palidx));
2975 count = i_gpal(im, l, r, y, work);
2976 if (GIMME_V == G_ARRAY) {
2978 for (i = 0; i < count; ++i) {
2979 PUSHs(sv_2mortal(newSViv(work[i])));
2984 PUSHs(sv_2mortal(newSVpv((char *)work, count * sizeof(i_palidx))));
2989 if (GIMME_V != G_ARRAY) {
2991 PUSHs(&PL_sv_undef);
2996 i_ppal(im, l, y, ...)
3005 work = malloc_temp(aTHX_ sizeof(i_palidx) * (items-3));
3006 for (i=0; i < items-3; ++i) {
3007 work[i] = SvIV(ST(i+3));
3009 validate_i_ppal(im, work, items - 3);
3010 RETVAL = i_ppal(im, l, l+items-3, y, work);
3019 i_ppal_p(im, l, y, data)
3025 i_palidx const *work;
3028 work = (i_palidx const *)SvPV(data, len);
3029 len /= sizeof(i_palidx);
3031 validate_i_ppal(im, work, len);
3032 RETVAL = i_ppal(im, l, l+len, y, work);
3041 i_addcolors(im, ...)
3049 croak("i_addcolors: no colors to add");
3050 colors = mymalloc((items-1) * sizeof(i_color));
3051 for (i=0; i < items-1; ++i) {
3052 if (sv_isobject(ST(i+1))
3053 && sv_derived_from(ST(i+1), "Imager::Color")) {
3054 IV tmp = SvIV((SV *)SvRV(ST(i+1)));
3055 colors[i] = *INT2PTR(i_color *, tmp);
3059 croak("i_addcolor: pixels must be Imager::Color objects");
3062 index = i_addcolors(im, colors, items-1);
3065 RETVAL = newSVpv("0 but true", 0);
3067 else if (index == -1) {
3068 RETVAL = &PL_sv_undef;
3071 RETVAL = newSViv(index);
3077 i_setcolors(im, index, ...)
3085 croak("i_setcolors: no colors to add");
3086 colors = mymalloc((items-2) * sizeof(i_color));
3087 for (i=0; i < items-2; ++i) {
3088 if (sv_isobject(ST(i+2))
3089 && sv_derived_from(ST(i+2), "Imager::Color")) {
3090 IV tmp = SvIV((SV *)SvRV(ST(i+2)));
3091 colors[i] = *INT2PTR(i_color *, tmp);
3095 croak("i_setcolors: pixels must be Imager::Color objects");
3098 RETVAL = i_setcolors(im, index, colors, items-2);
3104 i_getcolors(im, index, ...)
3113 croak("i_getcolors: too many arguments");
3115 count = SvIV(ST(2));
3117 croak("i_getcolors: count must be positive");
3118 colors = mymalloc(sizeof(i_color) * count);
3119 if (i_getcolors(im, index, colors, count)) {
3120 for (i = 0; i < count; ++i) {
3122 SV *sv = sv_newmortal();
3123 pv = mymalloc(sizeof(i_color));
3125 sv_setref_pv(sv, "Imager::Color", (void *)pv);
3141 i_findcolor(im, color)
3147 if (i_findcolor(im, color, &index)) {
3148 RETVAL = newSViv(index);
3151 RETVAL = &PL_sv_undef;
3169 i_gsamp(im, l, r, y, ...)
3181 croak("No channel numbers supplied to g_samp()");
3183 chan_count = items - 4;
3184 chans = mymalloc(sizeof(int) * chan_count);
3185 for (i = 0; i < chan_count; ++i)
3186 chans[i] = SvIV(ST(i+4));
3187 data = mymalloc(sizeof(i_sample_t) * (r-l) * chan_count); /* XXX: memleak? */
3188 count = i_gsamp(im, l, r, y, data, chans, chan_count);
3190 if (GIMME_V == G_ARRAY) {
3192 for (i = 0; i < count; ++i)
3193 PUSHs(sv_2mortal(newSViv(data[i])));
3197 PUSHs(sv_2mortal(newSVpv((char *)data, count * sizeof(i_sample_t))));
3202 if (GIMME_V != G_ARRAY) {
3204 PUSHs(&PL_sv_undef);
3209 i_gsamp_bits(im, l, r, y, bits, target, offset, ...)
3225 croak("No channel numbers supplied to g_samp()");
3227 chan_count = items - 7;
3228 chans = mymalloc(sizeof(int) * chan_count);
3229 for (i = 0; i < chan_count; ++i)
3230 chans[i] = SvIV(ST(i+7));
3231 data = mymalloc(sizeof(unsigned) * (r-l) * chan_count);
3232 count = i_gsamp_bits(im, l, r, y, data, chans, chan_count, bits);
3234 for (i = 0; i < count; ++i) {
3235 av_store(target, i+offset, newSVuv(data[i]));
3247 i_psamp_bits(im, l, y, bits, channels_sv, data_av, data_offset = 0, pixel_count = -1)
3265 if (SvOK(channels_sv)) {
3267 if (!SvROK(channels_sv) || SvTYPE(SvRV(channels_sv)) != SVt_PVAV) {
3268 croak("channels is not an array ref");
3270 channels_av = (AV *)SvRV(channels_sv);
3271 chan_count = av_len(channels_av) + 1;
3272 if (chan_count < 1) {
3273 croak("i_psamp_bits: no channels provided");
3275 channels = mymalloc(sizeof(int) * chan_count);
3276 for (i = 0; i < chan_count; ++i)
3277 channels[i] = SvIV(*av_fetch(channels_av, i, 0));
3280 chan_count = im->channels;
3284 data_count = av_len(data_av) + 1;
3285 if (data_offset < 0) {
3286 croak("data_offset must by non-negative");
3288 if (data_offset > data_count) {
3289 croak("data_offset greater than number of samples supplied");
3291 if (pixel_count == -1 ||
3292 data_offset + pixel_count * chan_count > data_count) {
3293 pixel_count = (data_count - data_offset) / chan_count;
3296 data_used = pixel_count * chan_count;
3297 data = mymalloc(sizeof(unsigned) * data_count);
3298 for (i = 0; i < data_used; ++i)
3299 data[i] = SvUV(*av_fetch(data_av, data_offset + i, 0));
3301 RETVAL = i_psamp_bits(im, l, l + pixel_count, y, data, channels,
3312 i_img_masked_new(targ, mask, x, y, w, h)
3322 if (!sv_isobject(ST(1))
3323 || !sv_derived_from(ST(1), "Imager::ImgRaw")) {
3324 croak("i_img_masked_new: parameter 2 must undef or an image");
3326 mask = INT2PTR(i_img *, SvIV((SV *)SvRV(ST(1))));
3330 RETVAL = i_img_masked_new(targ, mask, x, y, w, h);
3335 i_plin(im, l, y, ...)
3346 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3347 /* supplied as a byte string */
3348 work = (i_color *)SvPV(ST(3), len);
3349 count = len / sizeof(i_color);
3350 if (count * sizeof(i_color) != len) {
3351 croak("i_plin: length of scalar argument must be multiple of sizeof i_color");
3353 RETVAL = i_plin(im, l, l+count, y, work);
3356 work = mymalloc(sizeof(i_color) * (items-3));
3357 for (i=0; i < items-3; ++i) {
3358 if (sv_isobject(ST(i+3))
3359 && sv_derived_from(ST(i+3), "Imager::Color")) {
3360 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3361 work[i] = *INT2PTR(i_color *, tmp);
3365 croak("i_plin: pixels must be Imager::Color objects");
3368 RETVAL = i_plin(im, l, l+items-3, y, work);
3379 i_ppixf(im, x, y, cl)
3383 Imager::Color::Float cl
3386 i_gsampf(im, l, r, y, ...)
3398 croak("No channel numbers supplied to g_sampf()");
3400 chan_count = items - 4;
3401 chans = mymalloc(sizeof(int) * chan_count);
3402 for (i = 0; i < chan_count; ++i)
3403 chans[i] = SvIV(ST(i+4));
3404 data = mymalloc(sizeof(i_fsample_t) * (r-l) * chan_count);
3405 count = i_gsampf(im, l, r, y, data, chans, chan_count);
3407 if (GIMME_V == G_ARRAY) {
3409 for (i = 0; i < count; ++i)
3410 PUSHs(sv_2mortal(newSVnv(data[i])));
3414 PUSHs(sv_2mortal(newSVpv((void *)data, count * sizeof(i_fsample_t))));
3419 if (GIMME_V != G_ARRAY) {
3421 PUSHs(&PL_sv_undef);
3426 i_plinf(im, l, y, ...)
3437 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3438 /* supplied as a byte string */
3439 work = (i_fcolor *)SvPV(ST(3), len);
3440 count = len / sizeof(i_fcolor);
3441 if (count * sizeof(i_fcolor) != len) {
3442 croak("i_plin: length of scalar argument must be multiple of sizeof i_fcolor");
3444 RETVAL = i_plinf(im, l, l+count, y, work);
3447 work = mymalloc(sizeof(i_fcolor) * (items-3));
3448 for (i=0; i < items-3; ++i) {
3449 if (sv_isobject(ST(i+3))
3450 && sv_derived_from(ST(i+3), "Imager::Color::Float")) {
3451 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3452 work[i] = *INT2PTR(i_fcolor *, tmp);
3456 croak("i_plinf: pixels must be Imager::Color::Float objects");
3460 RETVAL = i_plinf(im, l, l+items-3, y, work);
3478 color = (i_fcolor *)mymalloc(sizeof(i_fcolor));
3479 if (i_gpixf(im, x, y, color) == 0) {
3480 RETVAL = NEWSV(0,0);
3481 sv_setref_pv(RETVAL, "Imager::Color::Float", (void *)color);
3485 RETVAL = &PL_sv_undef;
3501 vals = mymalloc((r-l) * sizeof(i_color));
3502 memset(vals, 0, (r-l) * sizeof(i_color));
3503 count = i_glin(im, l, r, y, vals);
3504 if (GIMME_V == G_ARRAY) {
3506 for (i = 0; i < count; ++i) {
3508 i_color *col = mymalloc(sizeof(i_color));
3510 sv = sv_newmortal();
3511 sv_setref_pv(sv, "Imager::Color", (void *)col);
3517 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_color))));
3523 i_glinf(im, l, r, y)
3533 for (i = 0; i < MAXCHANNELS; ++i)
3534 zero.channel[i] = 0;
3536 vals = mymalloc((r-l) * sizeof(i_fcolor));
3537 for (i = 0; i < r-l; ++i)
3539 count = i_glinf(im, l, r, y, vals);
3540 if (GIMME_V == G_ARRAY) {
3542 for (i = 0; i < count; ++i) {
3544 i_fcolor *col = mymalloc(sizeof(i_fcolor));
3546 sv = sv_newmortal();
3547 sv_setref_pv(sv, "Imager::Color::Float", (void *)col);
3553 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_fcolor))));
3559 i_img_16_new(x, y, ch)
3569 i_img_double_new(x, y, ch)
3579 i_tags_addn(im, name, code, idata)
3588 name = SvPV(ST(1), len);
3591 RETVAL = i_tags_addn(&im->tags, name, code, idata);
3596 i_tags_add(im, name, code, data, idata)
3606 name = SvPV(ST(1), len);
3610 data = SvPV(ST(3), len);
3615 RETVAL = i_tags_add(&im->tags, name, code, data, len, idata);
3620 i_tags_find(im, name, start)
3627 if (i_tags_find(&im->tags, name, start, &entry)) {
3629 RETVAL = newSVpv("0 but true", 0);
3631 RETVAL = newSViv(entry);
3633 RETVAL = &PL_sv_undef;
3639 i_tags_findn(im, code, start)
3646 if (i_tags_findn(&im->tags, code, start, &entry)) {
3648 RETVAL = newSVpv("0 but true", 0);
3650 RETVAL = newSViv(entry);
3653 RETVAL = &PL_sv_undef;
3659 i_tags_delete(im, entry)
3663 RETVAL = i_tags_delete(&im->tags, entry);
3668 i_tags_delbyname(im, name)
3672 RETVAL = i_tags_delbyname(&im->tags, name);
3677 i_tags_delbycode(im, code)
3681 RETVAL = i_tags_delbycode(&im->tags, code);
3686 i_tags_get(im, index)
3690 if (index >= 0 && index < im->tags.count) {
3691 i_img_tag *entry = im->tags.tags + index;
3695 PUSHs(sv_2mortal(newSVpv(entry->name, 0)));
3698 PUSHs(sv_2mortal(newSViv(entry->code)));
3701 PUSHs(sv_2mortal(newSVpvn(entry->data, entry->size)));
3704 PUSHs(sv_2mortal(newSViv(entry->idata)));
3709 i_tags_get_string(im, what_sv)
3713 char const *name = NULL;
3717 if (SvIOK(what_sv)) {
3718 code = SvIV(what_sv);
3722 name = SvPV_nolen(what_sv);
3725 if (i_tags_get_string(&im->tags, name, code, buffer, sizeof(buffer))) {
3727 PUSHs(sv_2mortal(newSVpv(buffer, 0)));
3734 RETVAL = im->tags.count;
3740 MODULE = Imager PACKAGE = Imager::FillHandle PREFIX=IFILL_
3744 Imager::FillHandle fill
3747 IFILL_CLONE_SKIP(...)
3749 (void)items; /* avoid unused warning for XS variable */
3754 MODULE = Imager PACKAGE = Imager
3757 i_new_fill_solid(cl, combine)
3762 i_new_fill_solidf(cl, combine)
3763 Imager::Color::Float cl
3767 i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
3775 unsigned char *cust_hatch;
3779 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3783 RETVAL = i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy);
3788 i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
3789 Imager::Color::Float fg
3790 Imager::Color::Float bg
3796 unsigned char *cust_hatch;
3800 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3804 RETVAL = i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy);
3809 i_new_fill_image(src, matrix, xoff, yoff, combine)
3826 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
3827 croak("i_new_fill_image: parameter must be an arrayref");
3828 av=(AV*)SvRV(ST(1));
3832 for (i = 0; i < len; ++i) {
3833 sv1=(*(av_fetch(av,i,0)));
3834 matrix[i] = SvNV(sv1);
3840 RETVAL = i_new_fill_image(src, matrixp, xoff, yoff, combine);
3844 MODULE = Imager PACKAGE = Imager::Internal::Hlines PREFIX=i_int_hlines_
3846 # this class is only exposed for testing
3849 i_int_hlines_testing()
3851 #if i_int_hlines_testing()
3853 Imager::Internal::Hlines
3854 i_int_hlines_new(start_y, count_y, start_x, count_x)
3860 Imager::Internal::Hlines
3861 i_int_hlines_new_img(im)
3865 i_int_hlines_add(hlines, y, minx, width)
3866 Imager::Internal::Hlines hlines
3872 i_int_hlines_DESTROY(hlines)
3873 Imager::Internal::Hlines hlines
3876 i_int_hlines_dump(hlines)
3877 Imager::Internal::Hlines hlines
3880 i_int_hlines_CLONE_SKIP(cls)
3885 PERL_SET_GLOBAL_CALLBACKS;
3886 PERL_PL_SET_GLOBAL_CALLBACKS;