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);
2464 i_transform2(sv_width,sv_height,channels,sv_ops,av_n_regs,av_c_regs,av_in_imgs)
2489 in_imgs_count = av_len(av_in_imgs)+1;
2490 for (i = 0; i < in_imgs_count; ++i) {
2491 sv1 = *av_fetch(av_in_imgs, i, 0);
2492 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2493 croak("sv_in_img must contain only images");
2496 if (in_imgs_count > 0) {
2497 in_imgs = mymalloc(in_imgs_count*sizeof(i_img*));
2498 for (i = 0; i < in_imgs_count; ++i) {
2499 sv1 = *av_fetch(av_in_imgs,i,0);
2500 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2501 croak("Parameter 5 must contain only images");
2503 tmp = SvIV((SV*)SvRV(sv1));
2504 in_imgs[i] = INT2PTR(i_img*, tmp);
2508 /* no input images */
2511 /* default the output size from the first input if possible */
2513 width = SvIV(sv_width);
2514 else if (in_imgs_count)
2515 width = in_imgs[0]->xsize;
2517 croak("No output image width supplied");
2519 if (SvOK(sv_height))
2520 height = SvIV(sv_height);
2521 else if (in_imgs_count)
2522 height = in_imgs[0]->ysize;
2524 croak("No output image height supplied");
2526 ops = (struct rm_op *)SvPV(sv_ops, ops_len);
2527 if (ops_len % sizeof(struct rm_op))
2528 croak("Imager: Parameter 3 must be a bitmap of regops\n");
2529 ops_count = ops_len / sizeof(struct rm_op);
2531 n_regs_count = av_len(av_n_regs)+1;
2532 n_regs = mymalloc(n_regs_count * sizeof(double));
2533 for (i = 0; i < n_regs_count; ++i) {
2534 sv1 = *av_fetch(av_n_regs,i,0);
2536 n_regs[i] = SvNV(sv1);
2538 c_regs_count = av_len(av_c_regs)+1;
2539 c_regs = mymalloc(c_regs_count * sizeof(i_color));
2540 /* I don't bother initializing the colou?r registers */
2542 RETVAL=i_transform2(width, height, channels, ops, ops_count,
2543 n_regs, n_regs_count,
2544 c_regs, c_regs_count, in_imgs, in_imgs_count);
2549 ST(0) = sv_newmortal();
2550 if (RETVAL == 0) ST(0)=&PL_sv_undef;
2551 else sv_setref_pv(ST(0), "Imager::ImgRaw", (void*)RETVAL);
2555 i_contrast(im,intensity)
2568 i_noise(im,amount,type)
2574 i_bumpmap(im,bump,channel,light_x,light_y,strength)
2584 i_bumpmap_complex(im,bump,channel,tx,ty,Lx,Ly,Lz,cd,cs,n,Ia,Il,Is)
2603 i_postlevels(im,levels)
2613 i_watermark(im,wmark,tx,ty,pixdiff)
2615 Imager::ImgRaw wmark
2622 i_autolevels(im,lsat,usat,skew)
2629 i_radnoise(im,xo,yo,rscale,ascale)
2637 i_turbnoise(im, xo, yo, scale)
2660 croak("Usage: i_gradgen(im, xo, yo, ival, dmeasure)");
2661 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2662 croak("i_gradgen: Second argument must be an array ref");
2663 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2664 croak("i_gradgen: Third argument must be an array ref");
2665 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2666 croak("i_gradgen: Fourth argument must be an array ref");
2667 axx = (AV *)SvRV(ST(1));
2668 ayy = (AV *)SvRV(ST(2));
2669 ac = (AV *)SvRV(ST(3));
2670 dmeasure = (int)SvIV(ST(4));
2672 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2673 num = num <= av_len(ac) ? num : av_len(ac);
2675 if (num < 2) croak("Usage: i_gradgen array refs must have more than 1 entry each");
2676 xo = mymalloc( sizeof(i_img_dim) * num );
2677 yo = mymalloc( sizeof(i_img_dim) * num );
2678 ival = mymalloc( sizeof(i_color) * num );
2679 for(i = 0; i<num; i++) {
2680 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2681 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2682 sv = *av_fetch(ac, i, 0);
2683 if ( !sv_derived_from(sv, "Imager::Color") ) {
2684 free(axx); free(ayy); free(ac);
2685 croak("i_gradgen: Element of fourth argument is not derived from Imager::Color");
2687 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2689 i_gradgen(im, num, xo, yo, ival, dmeasure);
2695 i_diff_image(im, im2, mindist=0)
2701 i_fountain(im, xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2711 double ssample_param
2715 i_fountain_seg *segs;
2717 if (!SvROK(ST(10)) || ! SvTYPE(SvRV(ST(10))))
2718 croak("i_fountain: argument 11 must be an array ref");
2720 asegs = (AV *)SvRV(ST(10));
2721 segs = load_fount_segs(aTHX_ asegs, &count);
2722 RETVAL = i_fountain(im, xa, ya, xb, yb, type, repeat, combine,
2723 super_sample, ssample_param, count, segs);
2729 i_new_fill_fount(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(9)) || ! SvTYPE(SvRV(ST(9))))
2745 croak("i_fountain: argument 11 must be an array ref");
2747 asegs = (AV *)SvRV(ST(9));
2748 segs = load_fount_segs(aTHX_ asegs, &count);
2749 RETVAL = i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine,
2750 super_sample, ssample_param, count, segs);
2756 i_new_fill_opacity(other_fill, alpha_mult)
2757 Imager::FillHandle other_fill
2768 errors = i_errors();
2770 while (errors[i].msg) {
2772 sv = newSVpv(errors[i].msg, strlen(errors[i].msg));
2773 if (!av_store(av, 0, sv)) {
2776 sv = newSViv(errors[i].code);
2777 if (!av_store(av, 1, sv)) {
2780 PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
2788 i_push_error(code, msg)
2793 i_nearest_color(im, ...)
2808 croak("Usage: i_nearest_color(im, xo, yo, ival, dmeasure)");
2809 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2810 croak("i_nearest_color: Second argument must be an array ref");
2811 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2812 croak("i_nearest_color: Third argument must be an array ref");
2813 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2814 croak("i_nearest_color: Fourth argument must be an array ref");
2815 axx = (AV *)SvRV(ST(1));
2816 ayy = (AV *)SvRV(ST(2));
2817 ac = (AV *)SvRV(ST(3));
2818 dmeasure = (int)SvIV(ST(4));
2820 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2821 num = num <= av_len(ac) ? num : av_len(ac);
2823 if (num < 2) croak("Usage: i_nearest_color array refs must have more than 1 entry each");
2824 xo = mymalloc( sizeof(i_img_dim) * num );
2825 yo = mymalloc( sizeof(i_img_dim) * num );
2826 ival = mymalloc( sizeof(i_color) * num );
2827 for(i = 0; i<num; i++) {
2828 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2829 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2830 sv = *av_fetch(ac, i, 0);
2831 if ( !sv_derived_from(sv, "Imager::Color") ) {
2832 free(axx); free(ayy); free(ac);
2833 croak("i_nearest_color: Element of fourth argument is not derived from Imager::Color");
2835 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2837 RETVAL = i_nearest_color(im, num, xo, yo, ival, dmeasure);
2851 rc=DSO_open(filename,&evstr);
2855 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2856 PUSHs(sv_2mortal(newSVpvn(evstr, strlen(evstr))));
2859 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2865 DSO_close(dso_handle)
2869 DSO_funclist(dso_handle_v)
2873 DSO_handle *dso_handle;
2874 func_ptr *functions;
2876 dso_handle=(DSO_handle*)dso_handle_v;
2877 functions = DSO_funclist(dso_handle);
2879 while( functions[i].name != NULL) {
2881 PUSHs(sv_2mortal(newSVpv(functions[i].name,0)));
2883 PUSHs(sv_2mortal(newSVpv(functions[i++].pcode,0)));
2887 DSO_call(handle,func_index,hv)
2893 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to a hash\n");
2894 hv=(HV*)SvRV(ST(2));
2895 if (SvTYPE(hv)!=SVt_PVHV) croak("Imager: Parameter 2 must be a reference to a hash\n");
2896 DSO_call( (DSO_handle *)handle,func_index,hv);
2899 i_get_pixel(im, x, y)
2906 color = (i_color *)mymalloc(sizeof(i_color));
2907 if (i_gpix(im, x, y, color) == 0) {
2908 RETVAL = NEWSV(0, 0);
2909 sv_setref_pv(RETVAL, "Imager::Color", (void *)color);
2913 RETVAL = &PL_sv_undef;
2920 i_ppix(im, x, y, cl)
2927 i_img_pal_new(x, y, channels, maxpal)
2934 i_img_to_pal(src, quant)
2940 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2941 croak("i_img_to_pal: second argument must be a hash ref");
2942 hv = (HV *)SvRV(ST(1));
2943 memset(&quant, 0, sizeof(quant));
2945 quant.mc_size = 256;
2946 ip_handle_quant_opts(aTHX_ &quant, hv);
2947 RETVAL = i_img_to_pal(src, &quant);
2949 ip_copy_colors_back(aTHX_ hv, &quant);
2951 ip_cleanup_quant_opts(aTHX_ &quant);
2970 work = mymalloc((r-l) * sizeof(i_palidx));
2971 count = i_gpal(im, l, r, y, work);
2972 if (GIMME_V == G_ARRAY) {
2974 for (i = 0; i < count; ++i) {
2975 PUSHs(sv_2mortal(newSViv(work[i])));
2980 PUSHs(sv_2mortal(newSVpv((char *)work, count * sizeof(i_palidx))));
2985 if (GIMME_V != G_ARRAY) {
2987 PUSHs(&PL_sv_undef);
2992 i_ppal(im, l, y, ...)
3001 work = malloc_temp(aTHX_ sizeof(i_palidx) * (items-3));
3002 for (i=0; i < items-3; ++i) {
3003 work[i] = SvIV(ST(i+3));
3005 validate_i_ppal(im, work, items - 3);
3006 RETVAL = i_ppal(im, l, l+items-3, y, work);
3015 i_ppal_p(im, l, y, data)
3021 i_palidx const *work;
3024 work = (i_palidx const *)SvPV(data, len);
3025 len /= sizeof(i_palidx);
3027 validate_i_ppal(im, work, len);
3028 RETVAL = i_ppal(im, l, l+len, y, work);
3037 i_addcolors(im, ...)
3045 croak("i_addcolors: no colors to add");
3046 colors = mymalloc((items-1) * sizeof(i_color));
3047 for (i=0; i < items-1; ++i) {
3048 if (sv_isobject(ST(i+1))
3049 && sv_derived_from(ST(i+1), "Imager::Color")) {
3050 IV tmp = SvIV((SV *)SvRV(ST(i+1)));
3051 colors[i] = *INT2PTR(i_color *, tmp);
3055 croak("i_addcolor: pixels must be Imager::Color objects");
3058 index = i_addcolors(im, colors, items-1);
3061 RETVAL = newSVpv("0 but true", 0);
3063 else if (index == -1) {
3064 RETVAL = &PL_sv_undef;
3067 RETVAL = newSViv(index);
3073 i_setcolors(im, index, ...)
3081 croak("i_setcolors: no colors to add");
3082 colors = mymalloc((items-2) * sizeof(i_color));
3083 for (i=0; i < items-2; ++i) {
3084 if (sv_isobject(ST(i+2))
3085 && sv_derived_from(ST(i+2), "Imager::Color")) {
3086 IV tmp = SvIV((SV *)SvRV(ST(i+2)));
3087 colors[i] = *INT2PTR(i_color *, tmp);
3091 croak("i_setcolors: pixels must be Imager::Color objects");
3094 RETVAL = i_setcolors(im, index, colors, items-2);
3100 i_getcolors(im, index, ...)
3109 croak("i_getcolors: too many arguments");
3111 count = SvIV(ST(2));
3113 croak("i_getcolors: count must be positive");
3114 colors = mymalloc(sizeof(i_color) * count);
3115 if (i_getcolors(im, index, colors, count)) {
3116 for (i = 0; i < count; ++i) {
3118 SV *sv = sv_newmortal();
3119 pv = mymalloc(sizeof(i_color));
3121 sv_setref_pv(sv, "Imager::Color", (void *)pv);
3137 i_findcolor(im, color)
3143 if (i_findcolor(im, color, &index)) {
3144 RETVAL = newSViv(index);
3147 RETVAL = &PL_sv_undef;
3165 i_gsamp(im, l, r, y, ...)
3177 croak("No channel numbers supplied to g_samp()");
3179 chan_count = items - 4;
3180 chans = mymalloc(sizeof(int) * chan_count);
3181 for (i = 0; i < chan_count; ++i)
3182 chans[i] = SvIV(ST(i+4));
3183 data = mymalloc(sizeof(i_sample_t) * (r-l) * chan_count); /* XXX: memleak? */
3184 count = i_gsamp(im, l, r, y, data, chans, chan_count);
3186 if (GIMME_V == G_ARRAY) {
3188 for (i = 0; i < count; ++i)
3189 PUSHs(sv_2mortal(newSViv(data[i])));
3193 PUSHs(sv_2mortal(newSVpv((char *)data, count * sizeof(i_sample_t))));
3198 if (GIMME_V != G_ARRAY) {
3200 PUSHs(&PL_sv_undef);
3205 i_gsamp_bits(im, l, r, y, bits, target, offset, ...)
3221 croak("No channel numbers supplied to g_samp()");
3223 chan_count = items - 7;
3224 chans = mymalloc(sizeof(int) * chan_count);
3225 for (i = 0; i < chan_count; ++i)
3226 chans[i] = SvIV(ST(i+7));
3227 data = mymalloc(sizeof(unsigned) * (r-l) * chan_count);
3228 count = i_gsamp_bits(im, l, r, y, data, chans, chan_count, bits);
3230 for (i = 0; i < count; ++i) {
3231 av_store(target, i+offset, newSVuv(data[i]));
3243 i_psamp_bits(im, l, y, bits, channels_sv, data_av, data_offset = 0, pixel_count = -1)
3261 if (SvOK(channels_sv)) {
3263 if (!SvROK(channels_sv) || SvTYPE(SvRV(channels_sv)) != SVt_PVAV) {
3264 croak("channels is not an array ref");
3266 channels_av = (AV *)SvRV(channels_sv);
3267 chan_count = av_len(channels_av) + 1;
3268 if (chan_count < 1) {
3269 croak("i_psamp_bits: no channels provided");
3271 channels = mymalloc(sizeof(int) * chan_count);
3272 for (i = 0; i < chan_count; ++i)
3273 channels[i] = SvIV(*av_fetch(channels_av, i, 0));
3276 chan_count = im->channels;
3280 data_count = av_len(data_av) + 1;
3281 if (data_offset < 0) {
3282 croak("data_offset must by non-negative");
3284 if (data_offset > data_count) {
3285 croak("data_offset greater than number of samples supplied");
3287 if (pixel_count == -1 ||
3288 data_offset + pixel_count * chan_count > data_count) {
3289 pixel_count = (data_count - data_offset) / chan_count;
3292 data_used = pixel_count * chan_count;
3293 data = mymalloc(sizeof(unsigned) * data_count);
3294 for (i = 0; i < data_used; ++i)
3295 data[i] = SvUV(*av_fetch(data_av, data_offset + i, 0));
3297 RETVAL = i_psamp_bits(im, l, l + pixel_count, y, data, channels,
3308 i_img_masked_new(targ, mask, x, y, w, h)
3318 if (!sv_isobject(ST(1))
3319 || !sv_derived_from(ST(1), "Imager::ImgRaw")) {
3320 croak("i_img_masked_new: parameter 2 must undef or an image");
3322 mask = INT2PTR(i_img *, SvIV((SV *)SvRV(ST(1))));
3326 RETVAL = i_img_masked_new(targ, mask, x, y, w, h);
3331 i_plin(im, l, y, ...)
3342 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3343 /* supplied as a byte string */
3344 work = (i_color *)SvPV(ST(3), len);
3345 count = len / sizeof(i_color);
3346 if (count * sizeof(i_color) != len) {
3347 croak("i_plin: length of scalar argument must be multiple of sizeof i_color");
3349 RETVAL = i_plin(im, l, l+count, y, work);
3352 work = mymalloc(sizeof(i_color) * (items-3));
3353 for (i=0; i < items-3; ++i) {
3354 if (sv_isobject(ST(i+3))
3355 && sv_derived_from(ST(i+3), "Imager::Color")) {
3356 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3357 work[i] = *INT2PTR(i_color *, tmp);
3361 croak("i_plin: pixels must be Imager::Color objects");
3364 RETVAL = i_plin(im, l, l+items-3, y, work);
3375 i_ppixf(im, x, y, cl)
3379 Imager::Color::Float cl
3382 i_gsampf(im, l, r, y, ...)
3394 croak("No channel numbers supplied to g_sampf()");
3396 chan_count = items - 4;
3397 chans = mymalloc(sizeof(int) * chan_count);
3398 for (i = 0; i < chan_count; ++i)
3399 chans[i] = SvIV(ST(i+4));
3400 data = mymalloc(sizeof(i_fsample_t) * (r-l) * chan_count);
3401 count = i_gsampf(im, l, r, y, data, chans, chan_count);
3403 if (GIMME_V == G_ARRAY) {
3405 for (i = 0; i < count; ++i)
3406 PUSHs(sv_2mortal(newSVnv(data[i])));
3410 PUSHs(sv_2mortal(newSVpv((void *)data, count * sizeof(i_fsample_t))));
3415 if (GIMME_V != G_ARRAY) {
3417 PUSHs(&PL_sv_undef);
3422 i_plinf(im, l, y, ...)
3433 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3434 /* supplied as a byte string */
3435 work = (i_fcolor *)SvPV(ST(3), len);
3436 count = len / sizeof(i_fcolor);
3437 if (count * sizeof(i_fcolor) != len) {
3438 croak("i_plin: length of scalar argument must be multiple of sizeof i_fcolor");
3440 RETVAL = i_plinf(im, l, l+count, y, work);
3443 work = mymalloc(sizeof(i_fcolor) * (items-3));
3444 for (i=0; i < items-3; ++i) {
3445 if (sv_isobject(ST(i+3))
3446 && sv_derived_from(ST(i+3), "Imager::Color::Float")) {
3447 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3448 work[i] = *INT2PTR(i_fcolor *, tmp);
3452 croak("i_plinf: pixels must be Imager::Color::Float objects");
3456 RETVAL = i_plinf(im, l, l+items-3, y, work);
3474 color = (i_fcolor *)mymalloc(sizeof(i_fcolor));
3475 if (i_gpixf(im, x, y, color) == 0) {
3476 RETVAL = NEWSV(0,0);
3477 sv_setref_pv(RETVAL, "Imager::Color::Float", (void *)color);
3481 RETVAL = &PL_sv_undef;
3497 vals = mymalloc((r-l) * sizeof(i_color));
3498 memset(vals, 0, (r-l) * sizeof(i_color));
3499 count = i_glin(im, l, r, y, vals);
3500 if (GIMME_V == G_ARRAY) {
3502 for (i = 0; i < count; ++i) {
3504 i_color *col = mymalloc(sizeof(i_color));
3506 sv = sv_newmortal();
3507 sv_setref_pv(sv, "Imager::Color", (void *)col);
3513 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_color))));
3519 i_glinf(im, l, r, y)
3529 for (i = 0; i < MAXCHANNELS; ++i)
3530 zero.channel[i] = 0;
3532 vals = mymalloc((r-l) * sizeof(i_fcolor));
3533 for (i = 0; i < r-l; ++i)
3535 count = i_glinf(im, l, r, y, vals);
3536 if (GIMME_V == G_ARRAY) {
3538 for (i = 0; i < count; ++i) {
3540 i_fcolor *col = mymalloc(sizeof(i_fcolor));
3542 sv = sv_newmortal();
3543 sv_setref_pv(sv, "Imager::Color::Float", (void *)col);
3549 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_fcolor))));
3555 i_img_16_new(x, y, ch)
3565 i_img_double_new(x, y, ch)
3575 i_tags_addn(im, name, code, idata)
3584 name = SvPV(ST(1), len);
3587 RETVAL = i_tags_addn(&im->tags, name, code, idata);
3592 i_tags_add(im, name, code, data, idata)
3602 name = SvPV(ST(1), len);
3606 data = SvPV(ST(3), len);
3611 RETVAL = i_tags_add(&im->tags, name, code, data, len, idata);
3616 i_tags_find(im, name, start)
3623 if (i_tags_find(&im->tags, name, start, &entry)) {
3625 RETVAL = newSVpv("0 but true", 0);
3627 RETVAL = newSViv(entry);
3629 RETVAL = &PL_sv_undef;
3635 i_tags_findn(im, code, start)
3642 if (i_tags_findn(&im->tags, code, start, &entry)) {
3644 RETVAL = newSVpv("0 but true", 0);
3646 RETVAL = newSViv(entry);
3649 RETVAL = &PL_sv_undef;
3655 i_tags_delete(im, entry)
3659 RETVAL = i_tags_delete(&im->tags, entry);
3664 i_tags_delbyname(im, name)
3668 RETVAL = i_tags_delbyname(&im->tags, name);
3673 i_tags_delbycode(im, code)
3677 RETVAL = i_tags_delbycode(&im->tags, code);
3682 i_tags_get(im, index)
3686 if (index >= 0 && index < im->tags.count) {
3687 i_img_tag *entry = im->tags.tags + index;
3691 PUSHs(sv_2mortal(newSVpv(entry->name, 0)));
3694 PUSHs(sv_2mortal(newSViv(entry->code)));
3697 PUSHs(sv_2mortal(newSVpvn(entry->data, entry->size)));
3700 PUSHs(sv_2mortal(newSViv(entry->idata)));
3705 i_tags_get_string(im, what_sv)
3709 char const *name = NULL;
3713 if (SvIOK(what_sv)) {
3714 code = SvIV(what_sv);
3718 name = SvPV_nolen(what_sv);
3721 if (i_tags_get_string(&im->tags, name, code, buffer, sizeof(buffer))) {
3723 PUSHs(sv_2mortal(newSVpv(buffer, 0)));
3730 RETVAL = im->tags.count;
3736 MODULE = Imager PACKAGE = Imager::FillHandle PREFIX=IFILL_
3740 Imager::FillHandle fill
3743 IFILL_CLONE_SKIP(...)
3745 (void)items; /* avoid unused warning for XS variable */
3750 MODULE = Imager PACKAGE = Imager
3753 i_new_fill_solid(cl, combine)
3758 i_new_fill_solidf(cl, combine)
3759 Imager::Color::Float cl
3763 i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
3771 unsigned char *cust_hatch;
3775 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3779 RETVAL = i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy);
3784 i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
3785 Imager::Color::Float fg
3786 Imager::Color::Float bg
3792 unsigned char *cust_hatch;
3796 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3800 RETVAL = i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy);
3805 i_new_fill_image(src, matrix, xoff, yoff, combine)
3822 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
3823 croak("i_new_fill_image: parameter must be an arrayref");
3824 av=(AV*)SvRV(ST(1));
3828 for (i = 0; i < len; ++i) {
3829 sv1=(*(av_fetch(av,i,0)));
3830 matrix[i] = SvNV(sv1);
3836 RETVAL = i_new_fill_image(src, matrixp, xoff, yoff, combine);
3840 MODULE = Imager PACKAGE = Imager::Internal::Hlines PREFIX=i_int_hlines_
3842 # this class is only exposed for testing
3845 i_int_hlines_testing()
3847 #if i_int_hlines_testing()
3849 Imager::Internal::Hlines
3850 i_int_hlines_new(start_y, count_y, start_x, count_x)
3856 Imager::Internal::Hlines
3857 i_int_hlines_new_img(im)
3861 i_int_hlines_add(hlines, y, minx, width)
3862 Imager::Internal::Hlines hlines
3868 i_int_hlines_DESTROY(hlines)
3869 Imager::Internal::Hlines hlines
3872 i_int_hlines_dump(hlines)
3873 Imager::Internal::Hlines hlines
3876 i_int_hlines_CLONE_SKIP(cls)
3881 PERL_SET_GLOBAL_CALLBACKS;
3882 PERL_PL_SET_GLOBAL_CALLBACKS;