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()
32 /* used to represent channel lists parameters */
33 typedef struct i_channel_list_tag {
40 Allocate memory that will be discarded when mortals are discarded.
45 malloc_temp(pTHX_ size_t size) {
46 SV *sv = sv_2mortal(newSV(size));
51 /* These functions are all shared - then comes platform dependant code */
52 static int getstr(void *hv_t,char *key,char **store) {
57 mm_log((1,"getstr(hv_t %p, key %s, store %p)\n",hv_t,key,store));
59 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
61 svpp=hv_fetch(hv, key, strlen(key), 0);
62 *store=SvPV(*svpp, PL_na );
67 static int getint(void *hv_t,char *key,int *store) {
72 mm_log((1,"getint(hv_t %p, key %s, store %p)\n",hv_t,key,store));
74 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
76 svpp=hv_fetch(hv, key, strlen(key), 0);
77 *store=(int)SvIV(*svpp);
81 static int getdouble(void *hv_t,char* key,double *store) {
86 mm_log((1,"getdouble(hv_t %p, key %s, store %p)\n",hv_t,key,store));
88 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
89 svpp=hv_fetch(hv, key, strlen(key), 0);
90 *store=(double)SvNV(*svpp);
94 static int getvoid(void *hv_t,char* key,void **store) {
99 mm_log((1,"getvoid(hv_t %p, key %s, store %p)\n",hv_t,key,store));
101 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
103 svpp=hv_fetch(hv, key, strlen(key), 0);
104 *store = INT2PTR(void*, SvIV(*svpp));
109 static int getobj(void *hv_t,char *key,char *type,void **store) {
114 mm_log((1,"getobj(hv_t %p, key %s,type %s, store %p)\n",hv_t,key,type,store));
116 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
118 svpp=hv_fetch(hv, key, strlen(key), 0);
120 if (sv_derived_from(*svpp,type)) {
121 IV tmp = SvIV((SV*)SvRV(*svpp));
122 *store = INT2PTR(void*, tmp);
124 mm_log((1,"getobj: key exists in hash but is not of correct type"));
131 UTIL_table_t i_UTIL_table={getstr,getint,getdouble,getvoid,getobj};
133 void my_SvREFCNT_dec(void *p) {
135 SvREFCNT_dec((SV*)p);
140 i_log_entry(char *string, int level) {
141 mm_log((level, "%s", string));
145 make_i_color_sv(pTHX_ const i_color *c) {
147 i_color *col = mymalloc(sizeof(i_color));
150 sv_setref_pv(sv, "Imager::Color", (void *)col);
155 #define CBDATA_BUFSIZE 8192
158 /* the SVs we use to call back to Perl */
166 call_reader(struct cbdata *cbd, void *buf, size_t size,
174 if (!SvOK(cbd->readcb))
181 PUSHs(sv_2mortal(newSViv(size)));
182 PUSHs(sv_2mortal(newSViv(maxread)));
185 count = perl_call_sv(cbd->readcb, G_SCALAR);
190 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
196 char *ptr = SvPVbyte(data, len);
198 croak("Too much data returned in reader callback (wanted %d, got %d, expected %d)",
199 (int)size, (int)len, (int)maxread);
201 memcpy(buf, ptr, len);
216 io_seeker(void *p, off_t offset, int whence) {
218 struct cbdata *cbd = p;
223 if (!SvOK(cbd->seekcb))
230 PUSHs(sv_2mortal(newSViv(offset)));
231 PUSHs(sv_2mortal(newSViv(whence)));
234 count = perl_call_sv(cbd->seekcb, G_SCALAR);
239 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
251 io_writer(void *p, void const *data, size_t size) {
253 struct cbdata *cbd = p;
259 if (!SvOK(cbd->writecb))
266 PUSHs(sv_2mortal(newSVpv((char *)data, size)));
269 count = perl_call_sv(cbd->writecb, G_SCALAR);
273 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
276 success = SvTRUE(sv);
283 return success ? size : -1;
287 io_reader(void *p, void *data, size_t size) {
288 struct cbdata *cbd = p;
290 return call_reader(cbd, data, size, size);
293 static int io_closer(void *p) {
295 struct cbdata *cbd = p;
298 if (SvOK(cbd->closecb)) {
308 count = perl_call_sv(cbd->closecb, G_SCALAR);
313 success = SvTRUE(sv);
320 return success ? 0 : -1;
323 static void io_destroyer(void *p) {
325 struct cbdata *cbd = p;
327 SvREFCNT_dec(cbd->writecb);
328 SvREFCNT_dec(cbd->readcb);
329 SvREFCNT_dec(cbd->seekcb);
330 SvREFCNT_dec(cbd->closecb);
335 do_io_new_buffer(pTHX_ SV *data_sv) {
339 data = SvPVbyte(data_sv, length);
340 SvREFCNT_inc(data_sv);
341 return io_new_buffer(data, length, my_SvREFCNT_dec, data_sv);
345 do_io_new_cb(pTHX_ SV *writecb, SV *readcb, SV *seekcb, SV *closecb) {
348 cbd = mymalloc(sizeof(struct cbdata));
349 cbd->writecb = newSVsv(writecb);
350 cbd->readcb = newSVsv(readcb);
351 cbd->seekcb = newSVsv(seekcb);
352 cbd->closecb = newSVsv(closecb);
354 return io_new_cb(cbd, io_reader, io_writer, io_seeker, io_closer,
362 static int lookup_name(struct value_name *names, int count, char *name, int def_value)
365 for (i = 0; i < count; ++i)
366 if (strEQ(names[i].name, name))
367 return names[i].value;
371 static struct value_name transp_names[] =
374 { "threshold", tr_threshold },
375 { "errdiff", tr_errdiff },
376 { "ordered", tr_ordered, },
379 static struct value_name make_color_names[] =
381 { "none", mc_none, },
382 { "webmap", mc_web_map, },
383 { "addi", mc_addi, },
384 { "mediancut", mc_median_cut, },
385 { "mono", mc_mono, },
386 { "monochrome", mc_mono, },
387 { "gray", mc_gray, },
388 { "gray4", mc_gray4, },
389 { "gray16", mc_gray16, },
392 static struct value_name translate_names[] =
394 { "giflib", pt_giflib, },
395 { "closest", pt_closest, },
396 { "perturb", pt_perturb, },
397 { "errdiff", pt_errdiff, },
400 static struct value_name errdiff_names[] =
402 { "floyd", ed_floyd, },
403 { "jarvis", ed_jarvis, },
404 { "stucki", ed_stucki, },
405 { "custom", ed_custom, },
408 static struct value_name orddith_names[] =
410 { "random", od_random, },
411 { "dot8", od_dot8, },
412 { "dot4", od_dot4, },
413 { "hline", od_hline, },
414 { "vline", od_vline, },
415 { "/line", od_slashline, },
416 { "slashline", od_slashline, },
417 { "\\line", od_backline, },
418 { "backline", od_backline, },
419 { "tiny", od_tiny, },
420 { "custom", od_custom, },
423 /* look through the hash for quantization options */
425 ip_handle_quant_opts(pTHX_ i_quantize *quant, HV *hv)
427 /*** POSSIBLY BROKEN: do I need to unref the SV from hv_fetch ***/
433 quant->mc_colors = mymalloc(quant->mc_size * sizeof(i_color));
435 sv = hv_fetch(hv, "transp", 6, 0);
436 if (sv && *sv && (str = SvPV(*sv, len))) {
438 lookup_name(transp_names, sizeof(transp_names)/sizeof(*transp_names),
440 if (quant->transp != tr_none) {
441 quant->tr_threshold = 127;
442 sv = hv_fetch(hv, "tr_threshold", 12, 0);
444 quant->tr_threshold = SvIV(*sv);
446 if (quant->transp == tr_errdiff) {
447 sv = hv_fetch(hv, "tr_errdiff", 10, 0);
448 if (sv && *sv && (str = SvPV(*sv, len)))
449 quant->tr_errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
451 if (quant->transp == tr_ordered) {
452 quant->tr_orddith = od_tiny;
453 sv = hv_fetch(hv, "tr_orddith", 10, 0);
454 if (sv && *sv && (str = SvPV(*sv, len)))
455 quant->tr_orddith = lookup_name(orddith_names, sizeof(orddith_names)/sizeof(*orddith_names), str, od_random);
457 if (quant->tr_orddith == od_custom) {
458 sv = hv_fetch(hv, "tr_map", 6, 0);
459 if (sv && *sv && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
460 AV *av = (AV*)SvRV(*sv);
461 len = av_len(av) + 1;
462 if (len > sizeof(quant->tr_custom))
463 len = sizeof(quant->tr_custom);
464 for (i = 0; i < len; ++i) {
465 SV **sv2 = av_fetch(av, i, 0);
467 quant->tr_custom[i] = SvIV(*sv2);
470 while (i < sizeof(quant->tr_custom))
471 quant->tr_custom[i++] = 0;
476 quant->make_colors = mc_median_cut;
477 sv = hv_fetch(hv, "make_colors", 11, 0);
478 if (sv && *sv && (str = SvPV(*sv, len))) {
480 lookup_name(make_color_names, sizeof(make_color_names)/sizeof(*make_color_names), str, mc_median_cut);
482 sv = hv_fetch(hv, "colors", 6, 0);
483 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
484 /* needs to be an array of Imager::Color
485 note that the caller allocates the mc_color array and sets mc_size
487 AV *av = (AV *)SvRV(*sv);
488 quant->mc_count = av_len(av)+1;
489 if (quant->mc_count > quant->mc_size)
490 quant->mc_count = quant->mc_size;
491 for (i = 0; i < quant->mc_count; ++i) {
492 SV **sv1 = av_fetch(av, i, 0);
493 if (sv1 && *sv1 && SvROK(*sv1) && sv_derived_from(*sv1, "Imager::Color")) {
494 i_color *col = INT2PTR(i_color *, SvIV((SV*)SvRV(*sv1)));
495 quant->mc_colors[i] = *col;
499 sv = hv_fetch(hv, "max_colors", 10, 0);
502 if (i <= quant->mc_size && i >= quant->mc_count)
506 quant->translate = pt_closest;
507 sv = hv_fetch(hv, "translate", 9, 0);
508 if (sv && *sv && (str = SvPV(*sv, len))) {
509 quant->translate = lookup_name(translate_names, sizeof(translate_names)/sizeof(*translate_names), str, pt_closest);
511 sv = hv_fetch(hv, "errdiff", 7, 0);
512 if (sv && *sv && (str = SvPV(*sv, len))) {
513 quant->errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
515 if (quant->translate == pt_errdiff && quant->errdiff == ed_custom) {
516 /* get the error diffusion map */
517 sv = hv_fetch(hv, "errdiff_width", 13, 0);
519 quant->ed_width = SvIV(*sv);
520 sv = hv_fetch(hv, "errdiff_height", 14, 0);
522 quant->ed_height = SvIV(*sv);
523 sv = hv_fetch(hv, "errdiff_orig", 12, 0);
525 quant->ed_orig = SvIV(*sv);
526 if (quant->ed_width > 0 && quant->ed_height > 0) {
528 quant->ed_map = mymalloc(sizeof(int)*quant->ed_width*quant->ed_height);
529 sv = hv_fetch(hv, "errdiff_map", 11, 0);
530 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
531 AV *av = (AV*)SvRV(*sv);
532 len = av_len(av) + 1;
533 if (len > quant->ed_width * quant->ed_height)
534 len = quant->ed_width * quant->ed_height;
535 for (i = 0; i < len; ++i) {
536 SV **sv2 = av_fetch(av, i, 0);
538 quant->ed_map[i] = SvIV(*sv2);
539 sum += quant->ed_map[i];
545 myfree(quant->ed_map);
547 quant->errdiff = ed_floyd;
551 sv = hv_fetch(hv, "perturb", 7, 0);
553 quant->perturb = SvIV(*sv);
557 ip_cleanup_quant_opts(pTHX_ i_quantize *quant) {
558 myfree(quant->mc_colors);
560 myfree(quant->ed_map);
563 /* copies the color map from the hv into the colors member of the HV */
565 ip_copy_colors_back(pTHX_ HV *hv, i_quantize *quant) {
571 sv = hv_fetch(hv, "colors", 6, 0);
572 if (!sv || !*sv || !SvROK(*sv) || SvTYPE(SvRV(*sv)) != SVt_PVAV) {
577 av = (AV *)SvRV(*sv);
579 av_extend(av, quant->mc_count+1);
580 for (i = 0; i < quant->mc_count; ++i) {
581 i_color *in = quant->mc_colors+i;
582 Imager__Color c = ICL_new_internal(in->rgb.r, in->rgb.g, in->rgb.b, 255);
583 work = sv_newmortal();
584 sv_setref_pv(work, "Imager::Color", (void *)c);
590 /* loads the segments of a fountain fill into an array */
591 static i_fountain_seg *
592 load_fount_segs(pTHX_ AV *asegs, int *count) {
593 /* Each element of segs must contain:
594 [ start, middle, end, c0, c1, segtype, colortrans ]
595 start, middle, end are doubles from 0 to 1
596 c0, c1 are Imager::Color::Float or Imager::Color objects
597 segtype, colortrans are ints
601 i_fountain_seg *segs;
605 *count = av_len(asegs)+1;
607 croak("i_fountain must have at least one segment");
608 segs = mymalloc(sizeof(i_fountain_seg) * *count);
609 for(i = 0; i < *count; i++) {
610 SV **sv1 = av_fetch(asegs, i, 0);
611 if (!sv1 || !*sv1 || !SvROK(*sv1)
612 || SvTYPE(SvRV(*sv1)) != SVt_PVAV) {
614 croak("i_fountain: segs must be an arrayref of arrayrefs");
616 aseg = (AV *)SvRV(*sv1);
617 if (av_len(aseg) != 7-1) {
619 croak("i_fountain: a segment must have 7 members");
621 for (j = 0; j < 3; ++j) {
622 SV **sv2 = av_fetch(aseg, j, 0);
625 croak("i_fountain: XS error");
627 work[j] = SvNV(*sv2);
629 segs[i].start = work[0];
630 segs[i].middle = work[1];
631 segs[i].end = work[2];
632 for (j = 0; j < 2; ++j) {
633 SV **sv3 = av_fetch(aseg, 3+j, 0);
634 if (!sv3 || !*sv3 || !SvROK(*sv3) ||
635 (!sv_derived_from(*sv3, "Imager::Color")
636 && !sv_derived_from(*sv3, "Imager::Color::Float"))) {
638 croak("i_fountain: segs must contain colors in elements 3 and 4");
640 if (sv_derived_from(*sv3, "Imager::Color::Float")) {
641 segs[i].c[j] = *INT2PTR(i_fcolor *, SvIV((SV *)SvRV(*sv3)));
644 i_color c = *INT2PTR(i_color *, SvIV((SV *)SvRV(*sv3)));
646 for (ch = 0; ch < MAXCHANNELS; ++ch) {
647 segs[i].c[j].channel[ch] = c.channel[ch] / 255.0;
651 for (j = 0; j < 2; ++j) {
652 SV **sv2 = av_fetch(aseg, j+5, 0);
655 croak("i_fountain: XS error");
657 worki[j] = SvIV(*sv2);
659 segs[i].type = worki[0];
660 segs[i].color = worki[1];
666 /* validates the indexes supplied to i_ppal
668 i_ppal() doesn't do that for speed, but I'm not comfortable doing that
673 validate_i_ppal(i_img *im, i_palidx const *indexes, int count) {
674 int color_count = i_colorcount(im);
677 if (color_count == -1)
678 croak("i_plin() called on direct color image");
680 for (i = 0; i < count; ++i) {
681 if (indexes[i] >= color_count) {
682 croak("i_plin() called with out of range color index %d (max %d)",
683 indexes[i], color_count-1);
689 /* I don't think ICLF_* names belong at the C interface
690 this makes the XS code think we have them, to let us avoid
691 putting function bodies in the XS code
693 #define ICLF_new_internal(r, g, b, a) i_fcolor_new((r), (g), (b), (a))
694 #define ICLF_DESTROY(cl) i_fcolor_destroy(cl)
697 #define i_log_enabled() 1
699 #define i_log_enabled() 0
702 #if i_int_hlines_testing()
704 typedef i_int_hlines *Imager__Internal__Hlines;
706 static i_int_hlines *
707 i_int_hlines_new(i_img_dim start_y, i_img_dim count_y, i_img_dim start_x, i_img_dim count_x) {
708 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
709 i_int_init_hlines(result, start_y, count_y, start_x, count_x);
714 static i_int_hlines *
715 i_int_hlines_new_img(i_img *im) {
716 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
717 i_int_init_hlines_img(result, im);
723 i_int_hlines_DESTROY(i_int_hlines *hlines) {
724 i_int_hlines_destroy(hlines);
728 #define i_int_hlines_CLONE_SKIP(cls) 1
730 static int seg_compare(const void *vleft, const void *vright) {
731 const i_int_hline_seg *left = vleft;
732 const i_int_hline_seg *right = vright;
734 return left->minx - right->minx;
738 i_int_hlines_dump(i_int_hlines *hlines) {
740 SV *dump = newSVpvf("start_y: %" i_DF " limit_y: %" i_DF " start_x: %" i_DF " limit_x: %" i_DF"\n",
741 i_DFc(hlines->start_y), i_DFc(hlines->limit_y), i_DFc(hlines->start_x), i_DFc(hlines->limit_x));
744 for (y = hlines->start_y; y < hlines->limit_y; ++y) {
745 i_int_hline_entry *entry = hlines->entries[y-hlines->start_y];
748 /* sort the segments, if any */
750 qsort(entry->segs, entry->count, sizeof(i_int_hline_seg), seg_compare);
752 sv_catpvf(dump, " %" i_DF " (%" i_DF "):", i_DFc(y), i_DFc(entry->count));
753 for (i = 0; i < entry->count; ++i) {
754 sv_catpvf(dump, " [%" i_DF ", %" i_DF ")", i_DFc(entry->segs[i].minx),
755 i_DFc(entry->segs[i].x_limit));
757 sv_catpv(dump, "\n");
767 i_sv_off_t(pTHX_ SV *sv) {
768 #if LSEEKSIZE > IVSIZE
769 return (off_t)SvNV(sv);
771 return (off_t)SvIV(sv);
776 i_new_sv_off_t(pTHX_ off_t off) {
777 #if LSEEKSIZE > IVSIZE
784 static im_pl_ext_funcs im_perl_funcs =
786 IMAGER_PL_API_VERSION,
788 ip_handle_quant_opts,
789 ip_cleanup_quant_opts,
793 #define PERL_PL_SET_GLOBAL_CALLBACKS \
794 sv_setiv(get_sv(PERL_PL_FUNCTION_TABLE_NAME, 1), PTR2IV(&im_perl_funcs));
797 #define i_exif_enabled() 1
799 #define i_exif_enabled() 0
802 /* trying to use more C style names, map them here */
803 #define i_io_DESTROY(ig) io_glue_destroy(ig)
805 #define i_img_get_width(im) ((im)->xsize)
806 #define i_img_get_height(im) ((im)->ysize)
808 #define i_img_epsilonf() (DBL_EPSILON * 4)
810 /* avoid some xsubpp strangeness */
813 MODULE = Imager PACKAGE = Imager::Color PREFIX = ICL_
816 ICL_new_internal(r,g,b,a)
828 ICL_set_internal(cl,r,g,b,a)
835 ICL_set_internal(cl, r, g, b, a);
849 PUSHs(sv_2mortal(newSVnv(cl->rgba.r)));
850 PUSHs(sv_2mortal(newSVnv(cl->rgba.g)));
851 PUSHs(sv_2mortal(newSVnv(cl->rgba.b)));
852 PUSHs(sv_2mortal(newSVnv(cl->rgba.a)));
858 RETVAL = mymalloc(sizeof(i_color));
860 i_hsv_to_rgb(RETVAL);
868 RETVAL = mymalloc(sizeof(i_color));
870 i_rgb_to_hsv(RETVAL);
876 MODULE = Imager PACKAGE = Imager::Color::Float PREFIX=ICLF_
879 ICLF_new_internal(r, g, b, a)
887 Imager::Color::Float cl
891 Imager::Color::Float cl
895 EXTEND(SP, MAXCHANNELS);
896 for (ch = 0; ch < MAXCHANNELS; ++ch) {
897 /* printf("%d: %g\n", ch, cl->channel[ch]); */
898 PUSHs(sv_2mortal(newSVnv(cl->channel[ch])));
902 ICLF_set_internal(cl,r,g,b,a)
903 Imager::Color::Float cl
918 Imager::Color::Float c
920 RETVAL = mymalloc(sizeof(i_fcolor));
922 i_hsv_to_rgbf(RETVAL);
928 Imager::Color::Float c
930 RETVAL = mymalloc(sizeof(i_fcolor));
932 i_rgb_to_hsvf(RETVAL);
936 MODULE = Imager PACKAGE = Imager::ImgRaw PREFIX = IIM_
950 MODULE = Imager PACKAGE = Imager
964 io_new_buffer(data_sv)
967 RETVAL = do_io_new_buffer(aTHX_ data_sv);
972 io_new_cb(writecb, readcb, seekcb, closecb, maxwrite = CBDATA_BUFSIZE)
979 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
991 tlength = io_slurp(ig, &data);
992 RETVAL = newSVpv((char *)data,tlength);
999 i_set_image_file_limits(width, height, bytes)
1005 i_get_image_file_limits()
1007 i_img_dim width, height;
1010 if (i_get_image_file_limits(&width, &height, &bytes)) {
1012 PUSHs(sv_2mortal(newSViv(width)));
1013 PUSHs(sv_2mortal(newSViv(height)));
1014 PUSHs(sv_2mortal(newSVuv(bytes)));
1017 MODULE = Imager PACKAGE = Imager::IO PREFIX = io_
1020 io_new_fd(class, fd)
1023 RETVAL = io_new_fd(fd);
1028 io_new_buffer(class, data_sv)
1031 RETVAL = do_io_new_buffer(aTHX_ data_sv);
1036 io_new_cb(class, writecb, readcb, seekcb, closecb)
1042 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
1047 io_new_bufchain(class)
1049 RETVAL = io_new_bufchain();
1057 unsigned char* data;
1061 tlength = io_slurp(ig, &data);
1062 RETVAL = newSVpv((char *)data,tlength);
1067 MODULE = Imager PACKAGE = Imager::IO PREFIX = i_io_
1070 i_io_raw_write(ig, data_sv)
1078 if (SvUTF8(data_sv)) {
1079 data_sv = sv_2mortal(newSVsv(data_sv));
1080 /* yes, we want this to croak() if the SV can't be downgraded */
1081 sv_utf8_downgrade(data_sv, FALSE);
1084 data = SvPV(data_sv, size);
1085 RETVAL = i_io_raw_write(ig, data, size);
1090 i_io_raw_read(ig, buffer_sv, size)
1099 croak("size negative in call to i_io_raw_read()");
1100 /* prevent an undefined value warning if they supplied an
1102 Orginally conditional on !SvOK(), but this will prevent the
1103 downgrade from croaking */
1104 sv_setpvn(buffer_sv, "", 0);
1106 if (SvUTF8(buffer_sv))
1107 sv_utf8_downgrade(buffer_sv, FALSE);
1109 buffer = SvGROW(buffer_sv, size+1);
1110 result = i_io_raw_read(ig, buffer, size);
1112 SvCUR_set(buffer_sv, result);
1113 *SvEND(buffer_sv) = '\0';
1114 SvPOK_only(buffer_sv);
1116 PUSHs(sv_2mortal(newSViv(result)));
1122 i_io_raw_read2(ig, size)
1131 croak("size negative in call to i_io_read2()");
1132 buffer_sv = newSV(size);
1133 buffer = SvGROW(buffer_sv, size+1);
1134 result = i_io_raw_read(ig, buffer, size);
1136 SvCUR_set(buffer_sv, result);
1137 *SvEND(buffer_sv) = '\0';
1138 SvPOK_only(buffer_sv);
1140 PUSHs(sv_2mortal(buffer_sv));
1144 SvREFCNT_dec(buffer_sv);
1148 i_io_raw_seek(ig, position, whence)
1162 i_io_CLONE_SKIP(...)
1164 (void)items; /* avoid unused warning for XS variable */
1191 i_io_seek(ig, off, whence)
1197 i_io_peekn(ig, size)
1205 buffer_sv = newSV(size+1);
1206 buffer = SvGROW(buffer_sv, size+1);
1207 result = i_io_peekn(ig, buffer, size);
1209 SvCUR_set(buffer_sv, result);
1210 *SvEND(buffer_sv) = '\0';
1211 SvPOK_only(buffer_sv);
1213 PUSHs(sv_2mortal(buffer_sv));
1217 SvREFCNT_dec(buffer_sv);
1221 i_io_read(ig, buffer_sv, size)
1230 croak("size negative in call to i_io_read()");
1231 /* prevent an undefined value warning if they supplied an
1233 Orginally conditional on !SvOK(), but this will prevent the
1234 downgrade from croaking */
1235 sv_setpvn(buffer_sv, "", 0);
1237 if (SvUTF8(buffer_sv))
1238 sv_utf8_downgrade(buffer_sv, FALSE);
1240 buffer = SvGROW(buffer_sv, size+1);
1241 result = i_io_read(ig, buffer, size);
1243 SvCUR_set(buffer_sv, result);
1244 *SvEND(buffer_sv) = '\0';
1245 SvPOK_only(buffer_sv);
1247 PUSHs(sv_2mortal(newSViv(result)));
1253 i_io_read2(ig, size)
1262 croak("size zero in call to read2()");
1263 buffer_sv = newSV(size);
1264 buffer = SvGROW(buffer_sv, size+1);
1265 result = i_io_read(ig, buffer, size);
1267 SvCUR_set(buffer_sv, result);
1268 *SvEND(buffer_sv) = '\0';
1269 SvPOK_only(buffer_sv);
1271 PUSHs(sv_2mortal(buffer_sv));
1275 SvREFCNT_dec(buffer_sv);
1279 i_io_gets(ig, size = 8192, eol = NEWLINE)
1289 croak("size too small in call to gets()");
1290 buffer_sv = sv_2mortal(newSV(size+1));
1291 buffer = SvPVX(buffer_sv);
1292 result = i_io_gets(ig, buffer, size+1, eol);
1294 SvCUR_set(buffer_sv, result);
1295 *SvEND(buffer_sv) = '\0';
1296 SvPOK_only(buffer_sv);
1302 i_io_write(ig, data_sv)
1310 if (SvUTF8(data_sv)) {
1311 data_sv = sv_2mortal(newSVsv(data_sv));
1312 /* yes, we want this to croak() if the SV can't be downgraded */
1313 sv_utf8_downgrade(data_sv, FALSE);
1316 data = SvPV(data_sv, size);
1317 RETVAL = i_io_write(ig, data, size);
1322 i_io_dump(ig, flags = I_IO_DUMP_DEFAULT)
1327 i_io_set_buffered(ig, flag = 1)
1332 i_io_is_buffered(ig)
1343 MODULE = Imager PACKAGE = Imager
1354 while( (item=i_format_list[i++]) != NULL ) {
1356 PUSHs(sv_2mortal(newSVpv(item,0)));
1369 i_img_empty_ch(im,x,y,ch)
1376 i_sametype(im, x, y)
1382 i_sametype_chans(im, x, y, channels)
1389 i_init_log(name_sv,level)
1393 const char *name = SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
1395 RETVAL = i_init_log(name, level);
1400 i_log_entry(string,level)
1421 i_img_info(im,info);
1423 PUSHs(sv_2mortal(newSViv(info[0])));
1424 PUSHs(sv_2mortal(newSViv(info[1])));
1425 PUSHs(sv_2mortal(newSViv(info[2])));
1426 PUSHs(sv_2mortal(newSViv(info[3])));
1432 i_img_setmask(im,ch_mask)
1441 i_img_getchannels(im)
1450 sv_2mortal(newSVpv((char *)im->idata, im->bytes))
1458 i_img_get_height(im)
1463 i_img_is_monochrome(im)
1469 result = i_img_is_monochrome(im, &zero_is_white);
1471 if (GIMME_V == G_ARRAY) {
1474 PUSHs(sv_2mortal(newSViv(zero_is_white)));
1483 i_line(im,x1,y1,x2,y2,val,endp)
1493 i_line_aa(im,x1,y1,x2,y2,val,endp)
1503 i_box(im,x1,y1,x2,y2,val)
1512 i_box_filled(im,x1,y1,x2,y2,val)
1521 i_box_filledf(im,x1,y1,x2,y2,val)
1527 Imager::Color::Float val
1530 i_box_cfill(im,x1,y1,x2,y2,fill)
1536 Imager::FillHandle fill
1539 i_arc(im,x,y,rad,d1,d2,val)
1549 i_arc_aa(im,x,y,rad,d1,d2,val)
1559 i_arc_cfill(im,x,y,rad,d1,d2,fill)
1566 Imager::FillHandle fill
1569 i_arc_aa_cfill(im,x,y,rad,d1,d2,fill)
1576 Imager::FillHandle fill
1580 i_circle_aa(im,x,y,rad,val)
1588 i_circle_out(im,x,y,rad,val)
1596 i_circle_out_aa(im,x,y,rad,val)
1604 i_arc_out(im,x,y,rad,d1,d2,val)
1614 i_arc_out_aa(im,x,y,rad,d1,d2,val)
1625 i_bezier_multi(im,xc,yc,val)
1638 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1639 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1640 if (!SvROK(ST(2))) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1641 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1642 av1=(AV*)SvRV(ST(1));
1643 av2=(AV*)SvRV(ST(2));
1644 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_bezier_multi must be equal length\n");
1646 x=mymalloc( len*sizeof(double) );
1647 y=mymalloc( len*sizeof(double) );
1648 for(i=0;i<len;i++) {
1649 sv1=(*(av_fetch(av1,i,0)));
1650 sv2=(*(av_fetch(av2,i,0)));
1651 x[i]=(double)SvNV(sv1);
1652 y[i]=(double)SvNV(sv2);
1654 i_bezier_multi(im,len,x,y,val);
1660 i_poly_aa(im,xc,yc,val)
1673 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1674 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1675 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1676 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1677 av1=(AV*)SvRV(ST(1));
1678 av2=(AV*)SvRV(ST(2));
1679 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa must be equal length\n");
1681 x=mymalloc( len*sizeof(double) );
1682 y=mymalloc( len*sizeof(double) );
1683 for(i=0;i<len;i++) {
1684 sv1=(*(av_fetch(av1,i,0)));
1685 sv2=(*(av_fetch(av2,i,0)));
1686 x[i]=(double)SvNV(sv1);
1687 y[i]=(double)SvNV(sv2);
1689 RETVAL = i_poly_aa(im,len,x,y,val);
1696 i_poly_aa_cfill(im,xc,yc,fill)
1698 Imager::FillHandle fill
1708 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1709 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1710 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1711 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1712 av1=(AV*)SvRV(ST(1));
1713 av2=(AV*)SvRV(ST(2));
1714 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa_cfill must be equal length\n");
1716 x=mymalloc( len*sizeof(double) );
1717 y=mymalloc( len*sizeof(double) );
1718 for(i=0;i<len;i++) {
1719 sv1=(*(av_fetch(av1,i,0)));
1720 sv2=(*(av_fetch(av2,i,0)));
1721 x[i]=(double)SvNV(sv1);
1722 y[i]=(double)SvNV(sv2);
1724 RETVAL = i_poly_aa_cfill(im,len,x,y,fill);
1733 i_flood_fill(im,seedx,seedy,dcol)
1740 i_flood_cfill(im,seedx,seedy,fill)
1744 Imager::FillHandle fill
1747 i_flood_fill_border(im,seedx,seedy,dcol, border)
1752 Imager::Color border
1755 i_flood_cfill_border(im,seedx,seedy,fill, border)
1759 Imager::FillHandle fill
1760 Imager::Color border
1764 i_copyto(im,src,x1,y1,x2,y2,tx,ty)
1776 i_copyto_trans(im,src,x1,y1,x2,y2,tx,ty,trans)
1793 i_rubthru(im,src,tx,ty,src_minx,src_miny,src_maxx,src_maxy)
1804 i_compose(out, src, out_left, out_top, src_left, src_top, width, height, combine = ic_normal, opacity = 0.0)
1817 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)
1833 i_combine(src_av, channels_av = NULL)
1837 i_img **imgs = NULL;
1839 int *channels = NULL;
1844 in_count = av_len(src_av) + 1;
1846 imgs = mymalloc(sizeof(i_img*) * in_count);
1847 channels = mymalloc(sizeof(int) * in_count);
1848 for (i = 0; i < in_count; ++i) {
1849 psv = av_fetch(src_av, i, 0);
1850 if (!psv || !*psv || !sv_derived_from(*psv, "Imager::ImgRaw")) {
1853 croak("imgs must contain only images");
1855 tmp = SvIV((SV*)SvRV(*psv));
1856 imgs[i] = INT2PTR(i_img*, tmp);
1858 (psv = av_fetch(channels_av, i, 0)) != NULL &&
1860 channels[i] = SvIV(*psv);
1867 RETVAL = i_combine(imgs, channels, in_count);
1874 i_flipxy(im, direction)
1879 i_rotate90(im, degrees)
1884 i_rotate_exact(im, amount, ...)
1888 i_color *backp = NULL;
1889 i_fcolor *fbackp = NULL;
1893 /* extract the bg colors if any */
1894 /* yes, this is kind of strange */
1895 for (i = 2; i < items; ++i) {
1897 if (sv_derived_from(sv1, "Imager::Color")) {
1898 IV tmp = SvIV((SV*)SvRV(sv1));
1899 backp = INT2PTR(i_color *, tmp);
1901 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1902 IV tmp = SvIV((SV*)SvRV(sv1));
1903 fbackp = INT2PTR(i_fcolor *, tmp);
1906 RETVAL = i_rotate_exact_bg(im, amount, backp, fbackp);
1911 i_matrix_transform(im, xsize, ysize, matrix, ...)
1921 i_color *backp = NULL;
1922 i_fcolor *fbackp = NULL;
1924 if (!SvROK(ST(3)) || SvTYPE(SvRV(ST(3))) != SVt_PVAV)
1925 croak("i_matrix_transform: parameter 4 must be an array ref\n");
1926 av=(AV*)SvRV(ST(3));
1930 for (i = 0; i < len; ++i) {
1931 sv1=(*(av_fetch(av,i,0)));
1932 matrix[i] = SvNV(sv1);
1936 /* extract the bg colors if any */
1937 /* yes, this is kind of strange */
1938 for (i = 4; i < items; ++i) {
1940 if (sv_derived_from(sv1, "Imager::Color")) {
1941 IV tmp = SvIV((SV*)SvRV(sv1));
1942 backp = INT2PTR(i_color *, tmp);
1944 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1945 IV tmp = SvIV((SV*)SvRV(sv1));
1946 fbackp = INT2PTR(i_fcolor *, tmp);
1949 RETVAL = i_matrix_transform_bg(im, xsize, ysize, matrix, backp, fbackp);
1954 i_gaussian(im,stdev)
1959 i_unsharp_mask(im,stdev,scale)
1974 len = av_len(coef) + 1;
1975 c_coef=mymalloc( len * sizeof(double) );
1976 for(i = 0; i < len; i++) {
1977 sv1 = (*(av_fetch(coef, i, 0)));
1978 c_coef[i] = (double)SvNV(sv1);
1980 RETVAL = i_conv(im, c_coef, len);
1986 i_convert(src, avmain)
1998 outchan = av_len(avmain)+1;
1999 /* find the biggest */
2001 for (j=0; j < outchan; ++j) {
2002 temp = av_fetch(avmain, j, 0);
2003 if (temp && SvROK(*temp) && SvTYPE(SvRV(*temp)) == SVt_PVAV) {
2004 avsub = (AV*)SvRV(*temp);
2005 len = av_len(avsub)+1;
2010 coeff = mymalloc(sizeof(double) * outchan * inchan);
2011 for (j = 0; j < outchan; ++j) {
2012 avsub = (AV*)SvRV(*av_fetch(avmain, j, 0));
2013 len = av_len(avsub)+1;
2014 for (i = 0; i < len; ++i) {
2015 temp = av_fetch(avsub, i, 0);
2017 coeff[i+j*inchan] = SvNV(*temp);
2019 coeff[i+j*inchan] = 0;
2022 coeff[i++ + j*inchan] = 0;
2024 RETVAL = i_convert(src, coeff, outchan, inchan);
2034 unsigned int mask = 0;
2040 unsigned char (*maps)[256];
2042 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
2043 croak("i_map: parameter 2 must be an arrayref\n");
2044 avmain = (AV*)SvRV(ST(1));
2045 len = av_len(avmain)+1;
2046 if (im->channels < len) len = im->channels;
2048 maps = mymalloc( len * sizeof(unsigned char [256]) );
2050 for (j=0; j<len ; j++) {
2051 temp = av_fetch(avmain, j, 0);
2052 if (temp && SvROK(*temp) && (SvTYPE(SvRV(*temp)) == SVt_PVAV) ) {
2053 avsub = (AV*)SvRV(*temp);
2054 if(av_len(avsub) != 255) continue;
2056 for (i=0; i<256 ; i++) {
2058 temp = av_fetch(avsub, i, 0);
2059 val = temp ? SvIV(*temp) : 0;
2061 if (val>255) val = 255;
2066 i_map(im, maps, mask);
2077 i_img_diffd(im1,im2)
2082 i_img_samef(im1, im2, epsilon = i_img_epsilonf(), what=NULL)
2092 _is_color_object(sv)
2096 RETVAL = SvOK(sv) && SvROK(sv) &&
2097 (sv_derived_from(sv, "Imager::Color")
2098 || sv_derived_from(sv, "Imager::Color::Float"));
2110 MODULE = Imager PACKAGE = Imager::Font::TT PREFIX=TT_
2112 #define TT_DESTROY(handle) i_tt_destroy(handle)
2116 Imager::Font::TT handle
2121 (void)items; /* avoid unused warning */
2127 MODULE = Imager PACKAGE = Imager
2131 i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
2132 Imager::Font::TT handle
2150 str = SvPV(str_sv, len);
2151 RETVAL = i_tt_text(handle, im, xb, yb, cl, points, str,
2152 len, smooth, utf8, align);
2158 i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
2159 Imager::Font::TT handle
2177 str = SvPV(str_sv, len);
2178 RETVAL = i_tt_cp(handle, im, xb, yb, channel, points, str, len,
2179 smooth, utf8, align);
2185 i_tt_bbox(handle,point,str_sv,len_ignored, utf8)
2186 Imager::Font::TT handle
2191 i_img_dim cords[BOUNDING_BOX_COUNT];
2201 str = SvPV(str_sv, len);
2202 if ((rc=i_tt_bbox(handle,point,str,len,cords, utf8))) {
2204 for (i = 0; i < rc; ++i) {
2205 PUSHs(sv_2mortal(newSViv(cords[i])));
2210 i_tt_has_chars(handle, text_sv, utf8)
2211 Imager::Font::TT handle
2222 if (SvUTF8(text_sv))
2225 text = SvPV(text_sv, len);
2226 work = mymalloc(len);
2227 count = i_tt_has_chars(handle, text, len, utf8, work);
2228 if (GIMME_V == G_ARRAY) {
2230 for (i = 0; i < count; ++i) {
2231 PUSHs(boolSV(work[i]));
2236 PUSHs(sv_2mortal(newSVpv(work, count)));
2241 i_tt_dump_names(handle)
2242 Imager::Font::TT handle
2245 i_tt_face_name(handle)
2246 Imager::Font::TT handle
2251 len = i_tt_face_name(handle, name, sizeof(name));
2254 PUSHs(sv_2mortal(newSVpv(name, len-1)));
2258 i_tt_glyph_name(handle, text_sv, utf8 = 0)
2259 Imager::Font::TT handle
2270 if (SvUTF8(text_sv))
2273 text = SvPV(text_sv, work_len);
2278 ch = i_utf8_advance(&text, &len);
2280 i_push_error(0, "invalid UTF8 character");
2289 if ((outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) != 0) {
2290 PUSHs(sv_2mortal(newSVpv(name, 0)));
2293 PUSHs(&PL_sv_undef);
2300 i_test_format_probe(ig, length)
2305 i_readpnm_wiol(ig, allow_incomplete)
2307 int allow_incomplete
2311 i_readpnm_multi_wiol(ig, allow_incomplete)
2313 int allow_incomplete
2319 imgs = i_readpnm_multi_wiol(ig, &count, allow_incomplete);
2322 for (i = 0; i < count; ++i) {
2323 SV *sv = sv_newmortal();
2324 sv_setref_pv(sv, "Imager::ImgRaw", (void *)imgs[i]);
2331 i_writeppm_wiol(im, ig)
2340 i_readraw_wiol(ig,x,y,datachannels,storechannels,intrl)
2349 i_writeraw_wiol(im,ig)
2354 i_writebmp_wiol(im,ig)
2359 i_readbmp_wiol(ig, allow_incomplete=0)
2361 int allow_incomplete
2365 i_writetga_wiol(im,ig, wierdpack, compress, idstring)
2374 idlen = SvCUR(ST(4));
2375 RETVAL = i_writetga_wiol(im, ig, wierdpack, compress, idstring, idlen);
2381 i_readtga_wiol(ig, length)
2389 i_scaleaxis(im,Value,Axis)
2395 i_scale_nn(im,scx,scy)
2401 i_scale_mixing(im, width, height)
2411 i_count_colors(im,maxc)
2416 i_get_anonymous_color_histo(im, maxc = 0x40000000)
2421 unsigned int * col_usage = NULL;
2424 col_cnt = i_get_anonymous_color_histo(im, &col_usage, maxc);
2425 EXTEND(SP, col_cnt);
2426 for (i = 0; i < col_cnt; i++) {
2427 PUSHs(sv_2mortal(newSViv( col_usage[i])));
2434 i_transform(im,opx,opy,parm)
2448 if (!SvROK(ST(1))) croak("Imager: Parameter 1 must be a reference to an array\n");
2449 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to an array\n");
2450 if (!SvROK(ST(3))) croak("Imager: Parameter 3 must be a reference to an array\n");
2451 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 must be a reference to an array\n");
2452 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 must be a reference to an array\n");
2453 if (SvTYPE(SvRV(ST(3))) != SVt_PVAV) croak("Imager: Parameter 3 must be a reference to an array\n");
2454 av=(AV*)SvRV(ST(1));
2456 opx=mymalloc( opxl*sizeof(int) );
2457 for(i=0;i<opxl;i++) {
2458 sv1=(*(av_fetch(av,i,0)));
2459 opx[i]=(int)SvIV(sv1);
2461 av=(AV*)SvRV(ST(2));
2463 opy=mymalloc( opyl*sizeof(int) );
2464 for(i=0;i<opyl;i++) {
2465 sv1=(*(av_fetch(av,i,0)));
2466 opy[i]=(int)SvIV(sv1);
2468 av=(AV*)SvRV(ST(3));
2469 parmlen=av_len(av)+1;
2470 parm=mymalloc( parmlen*sizeof(double) );
2471 for(i=0;i<parmlen;i++) { /* FIXME: Bug? */
2472 sv1=(*(av_fetch(av,i,0)));
2473 parm[i]=(double)SvNV(sv1);
2475 result=i_transform(im,opx,opxl,opy,opyl,parm,parmlen);
2480 SV *result_sv = sv_newmortal();
2482 sv_setref_pv(result_sv, "Imager::ImgRaw", (void*)result);
2487 i_transform2(sv_width,sv_height,channels,sv_ops,av_n_regs,av_c_regs,av_in_imgs)
2513 in_imgs_count = av_len(av_in_imgs)+1;
2514 for (i = 0; i < in_imgs_count; ++i) {
2515 sv1 = *av_fetch(av_in_imgs, i, 0);
2516 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2517 croak("sv_in_img must contain only images");
2520 if (in_imgs_count > 0) {
2521 in_imgs = mymalloc(in_imgs_count*sizeof(i_img*));
2522 for (i = 0; i < in_imgs_count; ++i) {
2523 sv1 = *av_fetch(av_in_imgs,i,0);
2524 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2525 croak("Parameter 5 must contain only images");
2527 tmp = SvIV((SV*)SvRV(sv1));
2528 in_imgs[i] = INT2PTR(i_img*, tmp);
2532 /* no input images */
2535 /* default the output size from the first input if possible */
2537 width = SvIV(sv_width);
2538 else if (in_imgs_count)
2539 width = in_imgs[0]->xsize;
2541 croak("No output image width supplied");
2543 if (SvOK(sv_height))
2544 height = SvIV(sv_height);
2545 else if (in_imgs_count)
2546 height = in_imgs[0]->ysize;
2548 croak("No output image height supplied");
2550 ops = (struct rm_op *)SvPV(sv_ops, ops_len);
2551 if (ops_len % sizeof(struct rm_op))
2552 croak("Imager: Parameter 3 must be a bitmap of regops\n");
2553 ops_count = ops_len / sizeof(struct rm_op);
2555 n_regs_count = av_len(av_n_regs)+1;
2556 n_regs = mymalloc(n_regs_count * sizeof(double));
2557 for (i = 0; i < n_regs_count; ++i) {
2558 sv1 = *av_fetch(av_n_regs,i,0);
2560 n_regs[i] = SvNV(sv1);
2562 c_regs_count = av_len(av_c_regs)+1;
2563 c_regs = mymalloc(c_regs_count * sizeof(i_color));
2564 /* I don't bother initializing the colou?r registers */
2566 result=i_transform2(width, height, channels, ops, ops_count,
2567 n_regs, n_regs_count,
2568 c_regs, c_regs_count, in_imgs, in_imgs_count);
2574 SV *result_sv = sv_newmortal();
2576 sv_setref_pv(result_sv, "Imager::ImgRaw", (void*)result);
2582 i_contrast(im,intensity)
2595 i_noise(im,amount,type)
2601 i_bumpmap(im,bump,channel,light_x,light_y,strength)
2611 i_bumpmap_complex(im,bump,channel,tx,ty,Lx,Ly,Lz,cd,cs,n,Ia,Il,Is)
2630 i_postlevels(im,levels)
2640 i_watermark(im,wmark,tx,ty,pixdiff)
2642 Imager::ImgRaw wmark
2649 i_autolevels(im,lsat,usat,skew)
2656 i_radnoise(im,xo,yo,rscale,ascale)
2664 i_turbnoise(im, xo, yo, scale)
2687 croak("Usage: i_gradgen(im, xo, yo, ival, dmeasure)");
2688 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2689 croak("i_gradgen: Second argument must be an array ref");
2690 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2691 croak("i_gradgen: Third argument must be an array ref");
2692 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2693 croak("i_gradgen: Fourth argument must be an array ref");
2694 axx = (AV *)SvRV(ST(1));
2695 ayy = (AV *)SvRV(ST(2));
2696 ac = (AV *)SvRV(ST(3));
2697 dmeasure = (int)SvIV(ST(4));
2699 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2700 num = num <= av_len(ac) ? num : av_len(ac);
2702 if (num < 2) croak("Usage: i_gradgen array refs must have more than 1 entry each");
2703 xo = mymalloc( sizeof(i_img_dim) * num );
2704 yo = mymalloc( sizeof(i_img_dim) * num );
2705 ival = mymalloc( sizeof(i_color) * num );
2706 for(i = 0; i<num; i++) {
2707 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2708 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2709 sv = *av_fetch(ac, i, 0);
2710 if ( !sv_derived_from(sv, "Imager::Color") ) {
2711 free(axx); free(ayy); free(ac);
2712 croak("i_gradgen: Element of fourth argument is not derived from Imager::Color");
2714 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2716 i_gradgen(im, num, xo, yo, ival, dmeasure);
2722 i_diff_image(im, im2, mindist=0)
2728 i_fountain(im, xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2738 double ssample_param
2742 i_fountain_seg *segs;
2744 if (!SvROK(ST(10)) || ! SvTYPE(SvRV(ST(10))))
2745 croak("i_fountain: argument 11 must be an array ref");
2747 asegs = (AV *)SvRV(ST(10));
2748 segs = load_fount_segs(aTHX_ asegs, &count);
2749 RETVAL = i_fountain(im, xa, ya, xb, yb, type, repeat, combine,
2750 super_sample, ssample_param, count, segs);
2756 i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2765 double ssample_param
2769 i_fountain_seg *segs;
2771 if (!SvROK(ST(9)) || ! SvTYPE(SvRV(ST(9))))
2772 croak("i_fountain: argument 11 must be an array ref");
2774 asegs = (AV *)SvRV(ST(9));
2775 segs = load_fount_segs(aTHX_ asegs, &count);
2776 RETVAL = i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine,
2777 super_sample, ssample_param, count, segs);
2783 i_new_fill_opacity(other_fill, alpha_mult)
2784 Imager::FillHandle other_fill
2795 errors = i_errors();
2797 while (errors[i].msg) {
2799 sv = newSVpv(errors[i].msg, strlen(errors[i].msg));
2800 if (!av_store(av, 0, sv)) {
2803 sv = newSViv(errors[i].code);
2804 if (!av_store(av, 1, sv)) {
2807 PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
2815 i_push_error(code, msg)
2820 i_nearest_color(im, ...)
2835 croak("Usage: i_nearest_color(im, xo, yo, ival, dmeasure)");
2836 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2837 croak("i_nearest_color: Second argument must be an array ref");
2838 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2839 croak("i_nearest_color: Third argument must be an array ref");
2840 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2841 croak("i_nearest_color: Fourth argument must be an array ref");
2842 axx = (AV *)SvRV(ST(1));
2843 ayy = (AV *)SvRV(ST(2));
2844 ac = (AV *)SvRV(ST(3));
2845 dmeasure = (int)SvIV(ST(4));
2847 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2848 num = num <= av_len(ac) ? num : av_len(ac);
2850 if (num < 2) croak("Usage: i_nearest_color array refs must have more than 1 entry each");
2851 xo = mymalloc( sizeof(i_img_dim) * num );
2852 yo = mymalloc( sizeof(i_img_dim) * num );
2853 ival = mymalloc( sizeof(i_color) * num );
2854 for(i = 0; i<num; i++) {
2855 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2856 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2857 sv = *av_fetch(ac, i, 0);
2858 if ( !sv_derived_from(sv, "Imager::Color") ) {
2859 free(axx); free(ayy); free(ac);
2860 croak("i_nearest_color: Element of fourth argument is not derived from Imager::Color");
2862 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2864 RETVAL = i_nearest_color(im, num, xo, yo, ival, dmeasure);
2878 rc=DSO_open(filename,&evstr);
2882 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2883 PUSHs(sv_2mortal(newSVpvn(evstr, strlen(evstr))));
2886 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2892 DSO_close(dso_handle)
2896 DSO_funclist(dso_handle_v)
2900 DSO_handle *dso_handle;
2901 func_ptr *functions;
2903 dso_handle=(DSO_handle*)dso_handle_v;
2904 functions = DSO_funclist(dso_handle);
2906 while( functions[i].name != NULL) {
2908 PUSHs(sv_2mortal(newSVpv(functions[i].name,0)));
2910 PUSHs(sv_2mortal(newSVpv(functions[i++].pcode,0)));
2914 DSO_call(handle,func_index,hv)
2920 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to a hash\n");
2921 hv=(HV*)SvRV(ST(2));
2922 if (SvTYPE(hv)!=SVt_PVHV) croak("Imager: Parameter 2 must be a reference to a hash\n");
2923 DSO_call( (DSO_handle *)handle,func_index,hv);
2926 i_get_pixel(im, x, y)
2933 color = (i_color *)mymalloc(sizeof(i_color));
2934 if (i_gpix(im, x, y, color) == 0) {
2935 RETVAL = NEWSV(0, 0);
2936 sv_setref_pv(RETVAL, "Imager::Color", (void *)color);
2940 RETVAL = &PL_sv_undef;
2947 i_ppix(im, x, y, cl)
2954 i_img_pal_new(x, y, channels, maxpal)
2961 i_img_to_pal(src, quant)
2967 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2968 croak("i_img_to_pal: second argument must be a hash ref");
2969 hv = (HV *)SvRV(ST(1));
2970 memset(&quant, 0, sizeof(quant));
2972 quant.mc_size = 256;
2973 ip_handle_quant_opts(aTHX_ &quant, hv);
2974 RETVAL = i_img_to_pal(src, &quant);
2976 ip_copy_colors_back(aTHX_ hv, &quant);
2978 ip_cleanup_quant_opts(aTHX_ &quant);
2987 i_img_make_palette(HV *quant_hv, ...)
2989 size_t count = items - 1;
2991 i_img **imgs = NULL;
2995 croak("Please supply at least one image (%d)", (int)count);
2996 imgs = mymalloc(sizeof(i_img *) * count);
2997 for (i = 0; i < count; ++i) {
2998 SV *img_sv = ST(i + 1);
2999 if (SvROK(img_sv) && sv_derived_from(img_sv, "Imager::ImgRaw")) {
3000 imgs[i] = INT2PTR(i_img *, SvIV((SV*)SvRV(img_sv)));
3004 croak("Image %d is not an image object", (int)i+1);
3007 memset(&quant, 0, sizeof(quant));
3009 quant.mc_size = 256;
3010 ip_handle_quant_opts(aTHX_ &quant, quant_hv);
3011 i_quant_makemap(&quant, imgs, count);
3012 EXTEND(SP, quant.mc_count);
3013 for (i = 0; i < quant.mc_count; ++i) {
3014 SV *sv_c = make_i_color_sv(aTHX_ quant.mc_colors + i);
3017 ip_cleanup_quant_opts(aTHX_ &quant);
3031 work = mymalloc((r-l) * sizeof(i_palidx));
3032 count = i_gpal(im, l, r, y, work);
3033 if (GIMME_V == G_ARRAY) {
3035 for (i = 0; i < count; ++i) {
3036 PUSHs(sv_2mortal(newSViv(work[i])));
3041 PUSHs(sv_2mortal(newSVpv((char *)work, count * sizeof(i_palidx))));
3046 if (GIMME_V != G_ARRAY) {
3048 PUSHs(&PL_sv_undef);
3053 i_ppal(im, l, y, ...)
3062 work = malloc_temp(aTHX_ sizeof(i_palidx) * (items-3));
3063 for (i=0; i < items-3; ++i) {
3064 work[i] = SvIV(ST(i+3));
3066 validate_i_ppal(im, work, items - 3);
3067 RETVAL = i_ppal(im, l, l+items-3, y, work);
3076 i_ppal_p(im, l, y, data)
3082 i_palidx const *work;
3085 work = (i_palidx const *)SvPV(data, len);
3086 len /= sizeof(i_palidx);
3088 validate_i_ppal(im, work, len);
3089 RETVAL = i_ppal(im, l, l+len, y, work);
3098 i_addcolors(im, ...)
3106 croak("i_addcolors: no colors to add");
3107 colors = mymalloc((items-1) * sizeof(i_color));
3108 for (i=0; i < items-1; ++i) {
3109 if (sv_isobject(ST(i+1))
3110 && sv_derived_from(ST(i+1), "Imager::Color")) {
3111 IV tmp = SvIV((SV *)SvRV(ST(i+1)));
3112 colors[i] = *INT2PTR(i_color *, tmp);
3116 croak("i_addcolor: pixels must be Imager::Color objects");
3119 index = i_addcolors(im, colors, items-1);
3122 RETVAL = newSVpv("0 but true", 0);
3124 else if (index == -1) {
3125 RETVAL = &PL_sv_undef;
3128 RETVAL = newSViv(index);
3134 i_setcolors(im, index, ...)
3142 croak("i_setcolors: no colors to add");
3143 colors = mymalloc((items-2) * sizeof(i_color));
3144 for (i=0; i < items-2; ++i) {
3145 if (sv_isobject(ST(i+2))
3146 && sv_derived_from(ST(i+2), "Imager::Color")) {
3147 IV tmp = SvIV((SV *)SvRV(ST(i+2)));
3148 colors[i] = *INT2PTR(i_color *, tmp);
3152 croak("i_setcolors: pixels must be Imager::Color objects");
3155 RETVAL = i_setcolors(im, index, colors, items-2);
3161 i_getcolors(im, index, ...)
3170 croak("i_getcolors: too many arguments");
3172 count = SvIV(ST(2));
3174 croak("i_getcolors: count must be positive");
3175 colors = mymalloc(sizeof(i_color) * count);
3176 if (i_getcolors(im, index, colors, count)) {
3177 for (i = 0; i < count; ++i) {
3178 SV *sv = make_i_color_sv(aTHX_ colors+i);
3194 i_findcolor(im, color)
3200 if (i_findcolor(im, color, &index)) {
3201 RETVAL = newSViv(index);
3204 RETVAL = &PL_sv_undef;
3222 i_gsamp(im, l, r, y, channels)
3227 i_channel_list channels
3233 data = mymalloc(sizeof(i_sample_t) * (r-l) * channels.count); /* XXX: memleak? */
3234 count = i_gsamp(im, l, r, y, data, channels.channels, channels.count);
3235 if (GIMME_V == G_ARRAY) {
3237 for (i = 0; i < count; ++i)
3238 PUSHs(sv_2mortal(newSViv(data[i])));
3242 PUSHs(sv_2mortal(newSVpv((char *)data, count * sizeof(i_sample_t))));
3247 if (GIMME_V != G_ARRAY) {
3249 PUSHs(&PL_sv_undef);
3254 i_gsamp_bits(im, l, r, y, bits, target, offset, channels)
3262 i_channel_list channels
3269 croak("No channel numbers supplied to g_samp()");
3271 data = mymalloc(sizeof(unsigned) * (r-l) * channels.count);
3272 count = i_gsamp_bits(im, l, r, y, data, channels.channels, channels.count, bits);
3273 for (i = 0; i < count; ++i) {
3274 av_store(target, i+offset, newSVuv(data[i]));
3286 i_psamp_bits(im, l, y, bits, channels, data_av, data_offset = 0, pixel_count = -1)
3291 i_channel_list channels
3303 data_count = av_len(data_av) + 1;
3304 if (data_offset < 0) {
3305 croak("data_offset must by non-negative");
3307 if (data_offset > data_count) {
3308 croak("data_offset greater than number of samples supplied");
3310 if (pixel_count == -1 ||
3311 data_offset + pixel_count * channels.count > data_count) {
3312 pixel_count = (data_count - data_offset) / channels.count;
3315 data_used = pixel_count * channels.count;
3316 data = mymalloc(sizeof(unsigned) * data_count);
3317 for (i = 0; i < data_used; ++i)
3318 data[i] = SvUV(*av_fetch(data_av, data_offset + i, 0));
3320 RETVAL = i_psamp_bits(im, l, l + pixel_count, y, data, channels.channels,
3321 channels.count, bits);
3329 i_img_masked_new(targ, mask, x, y, w, h)
3339 if (!sv_isobject(ST(1))
3340 || !sv_derived_from(ST(1), "Imager::ImgRaw")) {
3341 croak("i_img_masked_new: parameter 2 must undef or an image");
3343 mask = INT2PTR(i_img *, SvIV((SV *)SvRV(ST(1))));
3347 RETVAL = i_img_masked_new(targ, mask, x, y, w, h);
3352 i_plin(im, l, y, ...)
3363 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3364 /* supplied as a byte string */
3365 work = (i_color *)SvPV(ST(3), len);
3366 count = len / sizeof(i_color);
3367 if (count * sizeof(i_color) != len) {
3368 croak("i_plin: length of scalar argument must be multiple of sizeof i_color");
3370 RETVAL = i_plin(im, l, l+count, y, work);
3373 work = mymalloc(sizeof(i_color) * (items-3));
3374 for (i=0; i < items-3; ++i) {
3375 if (sv_isobject(ST(i+3))
3376 && sv_derived_from(ST(i+3), "Imager::Color")) {
3377 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3378 work[i] = *INT2PTR(i_color *, tmp);
3382 croak("i_plin: pixels must be Imager::Color objects");
3385 RETVAL = i_plin(im, l, l+items-3, y, work);
3396 i_ppixf(im, x, y, cl)
3400 Imager::Color::Float cl
3403 i_gsampf(im, l, r, y, channels)
3408 i_channel_list channels
3414 data = mymalloc(sizeof(i_fsample_t) * (r-l) * channels.count);
3415 count = i_gsampf(im, l, r, y, data, channels.channels, channels.count);
3416 if (GIMME_V == G_ARRAY) {
3418 for (i = 0; i < count; ++i)
3419 PUSHs(sv_2mortal(newSVnv(data[i])));
3423 PUSHs(sv_2mortal(newSVpv((void *)data, count * sizeof(i_fsample_t))));
3428 if (GIMME_V != G_ARRAY) {
3430 PUSHs(&PL_sv_undef);
3435 i_plinf(im, l, y, ...)
3446 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3447 /* supplied as a byte string */
3448 work = (i_fcolor *)SvPV(ST(3), len);
3449 count = len / sizeof(i_fcolor);
3450 if (count * sizeof(i_fcolor) != len) {
3451 croak("i_plin: length of scalar argument must be multiple of sizeof i_fcolor");
3453 RETVAL = i_plinf(im, l, l+count, y, work);
3456 work = mymalloc(sizeof(i_fcolor) * (items-3));
3457 for (i=0; i < items-3; ++i) {
3458 if (sv_isobject(ST(i+3))
3459 && sv_derived_from(ST(i+3), "Imager::Color::Float")) {
3460 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3461 work[i] = *INT2PTR(i_fcolor *, tmp);
3465 croak("i_plinf: pixels must be Imager::Color::Float objects");
3469 RETVAL = i_plinf(im, l, l+items-3, y, work);
3487 color = (i_fcolor *)mymalloc(sizeof(i_fcolor));
3488 if (i_gpixf(im, x, y, color) == 0) {
3489 RETVAL = NEWSV(0,0);
3490 sv_setref_pv(RETVAL, "Imager::Color::Float", (void *)color);
3494 RETVAL = &PL_sv_undef;
3510 vals = mymalloc((r-l) * sizeof(i_color));
3511 memset(vals, 0, (r-l) * sizeof(i_color));
3512 count = i_glin(im, l, r, y, vals);
3513 if (GIMME_V == G_ARRAY) {
3515 for (i = 0; i < count; ++i) {
3516 SV *sv = make_i_color_sv(aTHX_ vals+i);
3522 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_color))));
3528 i_glinf(im, l, r, y)
3538 for (i = 0; i < MAXCHANNELS; ++i)
3539 zero.channel[i] = 0;
3541 vals = mymalloc((r-l) * sizeof(i_fcolor));
3542 for (i = 0; i < r-l; ++i)
3544 count = i_glinf(im, l, r, y, vals);
3545 if (GIMME_V == G_ARRAY) {
3547 for (i = 0; i < count; ++i) {
3549 i_fcolor *col = mymalloc(sizeof(i_fcolor));
3551 sv = sv_newmortal();
3552 sv_setref_pv(sv, "Imager::Color::Float", (void *)col);
3558 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_fcolor))));
3564 i_img_16_new(x, y, ch)
3574 i_img_double_new(x, y, ch)
3584 i_tags_addn(im, name, code, idata)
3593 name = SvPV(ST(1), len);
3596 RETVAL = i_tags_addn(&im->tags, name, code, idata);
3601 i_tags_add(im, name, code, data, idata)
3611 name = SvPV(ST(1), len);
3615 data = SvPV(ST(3), len);
3620 RETVAL = i_tags_add(&im->tags, name, code, data, len, idata);
3625 i_tags_find(im, name, start)
3632 if (i_tags_find(&im->tags, name, start, &entry)) {
3634 RETVAL = newSVpv("0 but true", 0);
3636 RETVAL = newSViv(entry);
3638 RETVAL = &PL_sv_undef;
3644 i_tags_findn(im, code, start)
3651 if (i_tags_findn(&im->tags, code, start, &entry)) {
3653 RETVAL = newSVpv("0 but true", 0);
3655 RETVAL = newSViv(entry);
3658 RETVAL = &PL_sv_undef;
3664 i_tags_delete(im, entry)
3668 RETVAL = i_tags_delete(&im->tags, entry);
3673 i_tags_delbyname(im, name)
3677 RETVAL = i_tags_delbyname(&im->tags, name);
3682 i_tags_delbycode(im, code)
3686 RETVAL = i_tags_delbycode(&im->tags, code);
3691 i_tags_get(im, index)
3695 if (index >= 0 && index < im->tags.count) {
3696 i_img_tag *entry = im->tags.tags + index;
3700 PUSHs(sv_2mortal(newSVpv(entry->name, 0)));
3703 PUSHs(sv_2mortal(newSViv(entry->code)));
3706 PUSHs(sv_2mortal(newSVpvn(entry->data, entry->size)));
3709 PUSHs(sv_2mortal(newSViv(entry->idata)));
3714 i_tags_get_string(im, what_sv)
3718 char const *name = NULL;
3722 if (SvIOK(what_sv)) {
3723 code = SvIV(what_sv);
3727 name = SvPV_nolen(what_sv);
3730 if (i_tags_get_string(&im->tags, name, code, buffer, sizeof(buffer))) {
3732 PUSHs(sv_2mortal(newSVpv(buffer, 0)));
3739 RETVAL = im->tags.count;
3745 MODULE = Imager PACKAGE = Imager::FillHandle PREFIX=IFILL_
3749 Imager::FillHandle fill
3752 IFILL_CLONE_SKIP(...)
3754 (void)items; /* avoid unused warning for XS variable */
3759 MODULE = Imager PACKAGE = Imager
3762 i_new_fill_solid(cl, combine)
3767 i_new_fill_solidf(cl, combine)
3768 Imager::Color::Float cl
3772 i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
3780 unsigned char *cust_hatch;
3784 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3788 RETVAL = i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy);
3793 i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
3794 Imager::Color::Float fg
3795 Imager::Color::Float bg
3801 unsigned char *cust_hatch;
3805 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3809 RETVAL = i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy);
3814 i_new_fill_image(src, matrix, xoff, yoff, combine)
3831 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
3832 croak("i_new_fill_image: parameter must be an arrayref");
3833 av=(AV*)SvRV(ST(1));
3837 for (i = 0; i < len; ++i) {
3838 sv1=(*(av_fetch(av,i,0)));
3839 matrix[i] = SvNV(sv1);
3845 RETVAL = i_new_fill_image(src, matrixp, xoff, yoff, combine);
3849 MODULE = Imager PACKAGE = Imager::Internal::Hlines PREFIX=i_int_hlines_
3851 # this class is only exposed for testing
3854 i_int_hlines_testing()
3856 #if i_int_hlines_testing()
3858 Imager::Internal::Hlines
3859 i_int_hlines_new(start_y, count_y, start_x, count_x)
3865 Imager::Internal::Hlines
3866 i_int_hlines_new_img(im)
3870 i_int_hlines_add(hlines, y, minx, width)
3871 Imager::Internal::Hlines hlines
3877 i_int_hlines_DESTROY(hlines)
3878 Imager::Internal::Hlines hlines
3881 i_int_hlines_dump(hlines)
3882 Imager::Internal::Hlines hlines
3885 i_int_hlines_CLONE_SKIP(cls)
3890 PERL_SET_GLOBAL_CALLBACKS;
3891 PERL_PL_SET_GLOBAL_CALLBACKS;