1 #define PERL_NO_GET_CONTEXT
8 #define NEED_newRV_noinc
9 #define NEED_sv_2pv_nolen
15 #define i_int_hlines_testing() 1
22 #include "imextpltypes.h"
25 #if i_int_hlines_testing()
33 Allocate memory that will be discarded when mortals are discarded.
38 malloc_temp(pTHX_ size_t size) {
39 SV *sv = sv_2mortal(newSV(size));
44 /* These functions are all shared - then comes platform dependant code */
45 static int getstr(void *hv_t,char *key,char **store) {
50 mm_log((1,"getstr(hv_t %p, key %s, store %p)\n",hv_t,key,store));
52 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
54 svpp=hv_fetch(hv, key, strlen(key), 0);
55 *store=SvPV(*svpp, PL_na );
60 static int getint(void *hv_t,char *key,int *store) {
65 mm_log((1,"getint(hv_t %p, key %s, store %p)\n",hv_t,key,store));
67 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
69 svpp=hv_fetch(hv, key, strlen(key), 0);
70 *store=(int)SvIV(*svpp);
74 static int getdouble(void *hv_t,char* key,double *store) {
79 mm_log((1,"getdouble(hv_t %p, key %s, store %p)\n",hv_t,key,store));
81 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
82 svpp=hv_fetch(hv, key, strlen(key), 0);
83 *store=(double)SvNV(*svpp);
87 static int getvoid(void *hv_t,char* key,void **store) {
92 mm_log((1,"getvoid(hv_t %p, key %s, store %p)\n",hv_t,key,store));
94 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
96 svpp=hv_fetch(hv, key, strlen(key), 0);
97 *store = INT2PTR(void*, SvIV(*svpp));
102 static int getobj(void *hv_t,char *key,char *type,void **store) {
107 mm_log((1,"getobj(hv_t %p, key %s,type %s, store %p)\n",hv_t,key,type,store));
109 if ( !hv_exists(hv,key,strlen(key)) ) return 0;
111 svpp=hv_fetch(hv, key, strlen(key), 0);
113 if (sv_derived_from(*svpp,type)) {
114 IV tmp = SvIV((SV*)SvRV(*svpp));
115 *store = INT2PTR(void*, tmp);
117 mm_log((1,"getobj: key exists in hash but is not of correct type"));
124 UTIL_table_t i_UTIL_table={getstr,getint,getdouble,getvoid,getobj};
126 void my_SvREFCNT_dec(void *p) {
128 SvREFCNT_dec((SV*)p);
133 i_log_entry(char *string, int level) {
134 mm_log((level, string));
138 #define CBDATA_BUFSIZE 8192
141 /* the SVs we use to call back to Perl */
149 call_reader(struct cbdata *cbd, void *buf, size_t size,
157 if (!SvOK(cbd->readcb))
164 PUSHs(sv_2mortal(newSViv(size)));
165 PUSHs(sv_2mortal(newSViv(maxread)));
168 count = perl_call_sv(cbd->readcb, G_SCALAR);
173 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
179 char *ptr = SvPVbyte(data, len);
181 croak("Too much data returned in reader callback (wanted %d, got %d, expected %d)",
182 (int)size, (int)len, (int)maxread);
184 memcpy(buf, ptr, len);
199 io_seeker(void *p, off_t offset, int whence) {
201 struct cbdata *cbd = p;
206 if (!SvOK(cbd->seekcb))
213 PUSHs(sv_2mortal(newSViv(offset)));
214 PUSHs(sv_2mortal(newSViv(whence)));
217 count = perl_call_sv(cbd->seekcb, G_SCALAR);
222 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
234 io_writer(void *p, void const *data, size_t size) {
236 struct cbdata *cbd = p;
242 if (!SvOK(cbd->writecb))
249 PUSHs(sv_2mortal(newSVpv((char *)data, size)));
252 count = perl_call_sv(cbd->writecb, G_SCALAR);
256 croak("Result of perl_call_sv(..., G_SCALAR) != 1");
259 success = SvTRUE(sv);
266 return success ? size : -1;
270 io_reader(void *p, void *data, size_t size) {
271 struct cbdata *cbd = p;
273 return call_reader(cbd, data, size, size);
276 static int io_closer(void *p) {
278 struct cbdata *cbd = p;
281 if (SvOK(cbd->closecb)) {
291 count = perl_call_sv(cbd->closecb, G_SCALAR);
296 success = SvTRUE(sv);
303 return success ? 0 : -1;
306 static void io_destroyer(void *p) {
308 struct cbdata *cbd = p;
310 SvREFCNT_dec(cbd->writecb);
311 SvREFCNT_dec(cbd->readcb);
312 SvREFCNT_dec(cbd->seekcb);
313 SvREFCNT_dec(cbd->closecb);
318 do_io_new_buffer(pTHX_ SV *data_sv) {
322 data = SvPVbyte(data_sv, length);
323 SvREFCNT_inc(data_sv);
324 return io_new_buffer(data, length, my_SvREFCNT_dec, data_sv);
328 do_io_new_cb(pTHX_ SV *writecb, SV *readcb, SV *seekcb, SV *closecb) {
331 cbd = mymalloc(sizeof(struct cbdata));
332 cbd->writecb = newSVsv(writecb);
333 cbd->readcb = newSVsv(readcb);
334 cbd->seekcb = newSVsv(seekcb);
335 cbd->closecb = newSVsv(closecb);
337 return io_new_cb(cbd, io_reader, io_writer, io_seeker, io_closer,
345 static int lookup_name(struct value_name *names, int count, char *name, int def_value)
348 for (i = 0; i < count; ++i)
349 if (strEQ(names[i].name, name))
350 return names[i].value;
354 static struct value_name transp_names[] =
357 { "threshold", tr_threshold },
358 { "errdiff", tr_errdiff },
359 { "ordered", tr_ordered, },
362 static struct value_name make_color_names[] =
364 { "none", mc_none, },
365 { "webmap", mc_web_map, },
366 { "addi", mc_addi, },
367 { "mediancut", mc_median_cut, },
368 { "mono", mc_mono, },
369 { "monochrome", mc_mono, },
372 static struct value_name translate_names[] =
374 { "giflib", pt_giflib, },
375 { "closest", pt_closest, },
376 { "perturb", pt_perturb, },
377 { "errdiff", pt_errdiff, },
380 static struct value_name errdiff_names[] =
382 { "floyd", ed_floyd, },
383 { "jarvis", ed_jarvis, },
384 { "stucki", ed_stucki, },
385 { "custom", ed_custom, },
388 static struct value_name orddith_names[] =
390 { "random", od_random, },
391 { "dot8", od_dot8, },
392 { "dot4", od_dot4, },
393 { "hline", od_hline, },
394 { "vline", od_vline, },
395 { "/line", od_slashline, },
396 { "slashline", od_slashline, },
397 { "\\line", od_backline, },
398 { "backline", od_backline, },
399 { "tiny", od_tiny, },
400 { "custom", od_custom, },
403 /* look through the hash for quantization options */
405 ip_handle_quant_opts(pTHX_ i_quantize *quant, HV *hv)
407 /*** POSSIBLY BROKEN: do I need to unref the SV from hv_fetch ***/
413 quant->mc_colors = mymalloc(quant->mc_size * sizeof(i_color));
415 sv = hv_fetch(hv, "transp", 6, 0);
416 if (sv && *sv && (str = SvPV(*sv, len))) {
418 lookup_name(transp_names, sizeof(transp_names)/sizeof(*transp_names),
420 if (quant->transp != tr_none) {
421 quant->tr_threshold = 127;
422 sv = hv_fetch(hv, "tr_threshold", 12, 0);
424 quant->tr_threshold = SvIV(*sv);
426 if (quant->transp == tr_errdiff) {
427 sv = hv_fetch(hv, "tr_errdiff", 10, 0);
428 if (sv && *sv && (str = SvPV(*sv, len)))
429 quant->tr_errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
431 if (quant->transp == tr_ordered) {
432 quant->tr_orddith = od_tiny;
433 sv = hv_fetch(hv, "tr_orddith", 10, 0);
434 if (sv && *sv && (str = SvPV(*sv, len)))
435 quant->tr_orddith = lookup_name(orddith_names, sizeof(orddith_names)/sizeof(*orddith_names), str, od_random);
437 if (quant->tr_orddith == od_custom) {
438 sv = hv_fetch(hv, "tr_map", 6, 0);
439 if (sv && *sv && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
440 AV *av = (AV*)SvRV(*sv);
441 len = av_len(av) + 1;
442 if (len > sizeof(quant->tr_custom))
443 len = sizeof(quant->tr_custom);
444 for (i = 0; i < len; ++i) {
445 SV **sv2 = av_fetch(av, i, 0);
447 quant->tr_custom[i] = SvIV(*sv2);
450 while (i < sizeof(quant->tr_custom))
451 quant->tr_custom[i++] = 0;
456 quant->make_colors = mc_median_cut;
457 sv = hv_fetch(hv, "make_colors", 11, 0);
458 if (sv && *sv && (str = SvPV(*sv, len))) {
460 lookup_name(make_color_names, sizeof(make_color_names)/sizeof(*make_color_names), str, mc_median_cut);
462 sv = hv_fetch(hv, "colors", 6, 0);
463 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
464 /* needs to be an array of Imager::Color
465 note that the caller allocates the mc_color array and sets mc_size
467 AV *av = (AV *)SvRV(*sv);
468 quant->mc_count = av_len(av)+1;
469 if (quant->mc_count > quant->mc_size)
470 quant->mc_count = quant->mc_size;
471 for (i = 0; i < quant->mc_count; ++i) {
472 SV **sv1 = av_fetch(av, i, 0);
473 if (sv1 && *sv1 && SvROK(*sv1) && sv_derived_from(*sv1, "Imager::Color")) {
474 i_color *col = INT2PTR(i_color *, SvIV((SV*)SvRV(*sv1)));
475 quant->mc_colors[i] = *col;
479 sv = hv_fetch(hv, "max_colors", 10, 0);
482 if (i <= quant->mc_size && i >= quant->mc_count)
486 quant->translate = pt_closest;
487 sv = hv_fetch(hv, "translate", 9, 0);
488 if (sv && *sv && (str = SvPV(*sv, len))) {
489 quant->translate = lookup_name(translate_names, sizeof(translate_names)/sizeof(*translate_names), str, pt_closest);
491 sv = hv_fetch(hv, "errdiff", 7, 0);
492 if (sv && *sv && (str = SvPV(*sv, len))) {
493 quant->errdiff = lookup_name(errdiff_names, sizeof(errdiff_names)/sizeof(*errdiff_names), str, ed_floyd);
495 if (quant->translate == pt_errdiff && quant->errdiff == ed_custom) {
496 /* get the error diffusion map */
497 sv = hv_fetch(hv, "errdiff_width", 13, 0);
499 quant->ed_width = SvIV(*sv);
500 sv = hv_fetch(hv, "errdiff_height", 14, 0);
502 quant->ed_height = SvIV(*sv);
503 sv = hv_fetch(hv, "errdiff_orig", 12, 0);
505 quant->ed_orig = SvIV(*sv);
506 if (quant->ed_width > 0 && quant->ed_height > 0) {
508 quant->ed_map = mymalloc(sizeof(int)*quant->ed_width*quant->ed_height);
509 sv = hv_fetch(hv, "errdiff_map", 11, 0);
510 if (sv && *sv && SvROK(*sv) && SvTYPE(SvRV(*sv)) == SVt_PVAV) {
511 AV *av = (AV*)SvRV(*sv);
512 len = av_len(av) + 1;
513 if (len > quant->ed_width * quant->ed_height)
514 len = quant->ed_width * quant->ed_height;
515 for (i = 0; i < len; ++i) {
516 SV **sv2 = av_fetch(av, i, 0);
518 quant->ed_map[i] = SvIV(*sv2);
519 sum += quant->ed_map[i];
525 myfree(quant->ed_map);
527 quant->errdiff = ed_floyd;
531 sv = hv_fetch(hv, "perturb", 7, 0);
533 quant->perturb = SvIV(*sv);
537 ip_cleanup_quant_opts(pTHX_ i_quantize *quant) {
538 myfree(quant->mc_colors);
540 myfree(quant->ed_map);
543 /* copies the color map from the hv into the colors member of the HV */
545 ip_copy_colors_back(pTHX_ HV *hv, i_quantize *quant) {
551 sv = hv_fetch(hv, "colors", 6, 0);
552 if (!sv || !*sv || !SvROK(*sv) || SvTYPE(SvRV(*sv)) != SVt_PVAV) {
557 av = (AV *)SvRV(*sv);
559 av_extend(av, quant->mc_count+1);
560 for (i = 0; i < quant->mc_count; ++i) {
561 i_color *in = quant->mc_colors+i;
562 Imager__Color c = ICL_new_internal(in->rgb.r, in->rgb.g, in->rgb.b, 255);
563 work = sv_newmortal();
564 sv_setref_pv(work, "Imager::Color", (void *)c);
570 /* loads the segments of a fountain fill into an array */
571 static i_fountain_seg *
572 load_fount_segs(pTHX_ AV *asegs, int *count) {
573 /* Each element of segs must contain:
574 [ start, middle, end, c0, c1, segtype, colortrans ]
575 start, middle, end are doubles from 0 to 1
576 c0, c1 are Imager::Color::Float or Imager::Color objects
577 segtype, colortrans are ints
581 i_fountain_seg *segs;
585 *count = av_len(asegs)+1;
587 croak("i_fountain must have at least one segment");
588 segs = mymalloc(sizeof(i_fountain_seg) * *count);
589 for(i = 0; i < *count; i++) {
590 SV **sv1 = av_fetch(asegs, i, 0);
591 if (!sv1 || !*sv1 || !SvROK(*sv1)
592 || SvTYPE(SvRV(*sv1)) != SVt_PVAV) {
594 croak("i_fountain: segs must be an arrayref of arrayrefs");
596 aseg = (AV *)SvRV(*sv1);
597 if (av_len(aseg) != 7-1) {
599 croak("i_fountain: a segment must have 7 members");
601 for (j = 0; j < 3; ++j) {
602 SV **sv2 = av_fetch(aseg, j, 0);
605 croak("i_fountain: XS error");
607 work[j] = SvNV(*sv2);
609 segs[i].start = work[0];
610 segs[i].middle = work[1];
611 segs[i].end = work[2];
612 for (j = 0; j < 2; ++j) {
613 SV **sv3 = av_fetch(aseg, 3+j, 0);
614 if (!sv3 || !*sv3 || !SvROK(*sv3) ||
615 (!sv_derived_from(*sv3, "Imager::Color")
616 && !sv_derived_from(*sv3, "Imager::Color::Float"))) {
618 croak("i_fountain: segs must contain colors in elements 3 and 4");
620 if (sv_derived_from(*sv3, "Imager::Color::Float")) {
621 segs[i].c[j] = *INT2PTR(i_fcolor *, SvIV((SV *)SvRV(*sv3)));
624 i_color c = *INT2PTR(i_color *, SvIV((SV *)SvRV(*sv3)));
626 for (ch = 0; ch < MAXCHANNELS; ++ch) {
627 segs[i].c[j].channel[ch] = c.channel[ch] / 255.0;
631 for (j = 0; j < 2; ++j) {
632 SV **sv2 = av_fetch(aseg, j+5, 0);
635 croak("i_fountain: XS error");
637 worki[j] = SvIV(*sv2);
639 segs[i].type = worki[0];
640 segs[i].color = worki[1];
646 /* validates the indexes supplied to i_ppal
648 i_ppal() doesn't do that for speed, but I'm not comfortable doing that
653 validate_i_ppal(i_img *im, i_palidx const *indexes, int count) {
654 int color_count = i_colorcount(im);
657 if (color_count == -1)
658 croak("i_plin() called on direct color image");
660 for (i = 0; i < count; ++i) {
661 if (indexes[i] >= color_count) {
662 croak("i_plin() called with out of range color index %d (max %d)",
663 indexes[i], color_count-1);
669 /* I don't think ICLF_* names belong at the C interface
670 this makes the XS code think we have them, to let us avoid
671 putting function bodies in the XS code
673 #define ICLF_new_internal(r, g, b, a) i_fcolor_new((r), (g), (b), (a))
674 #define ICLF_DESTROY(cl) i_fcolor_destroy(cl)
677 #define i_log_enabled() 1
679 #define i_log_enabled() 0
682 #if i_int_hlines_testing()
684 typedef i_int_hlines *Imager__Internal__Hlines;
686 static i_int_hlines *
687 i_int_hlines_new(i_img_dim start_y, i_img_dim count_y, i_img_dim start_x, i_img_dim count_x) {
688 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
689 i_int_init_hlines(result, start_y, count_y, start_x, count_x);
694 static i_int_hlines *
695 i_int_hlines_new_img(i_img *im) {
696 i_int_hlines *result = mymalloc(sizeof(i_int_hlines));
697 i_int_init_hlines_img(result, im);
703 i_int_hlines_DESTROY(i_int_hlines *hlines) {
704 i_int_hlines_destroy(hlines);
708 #define i_int_hlines_CLONE_SKIP(cls) 1
710 static int seg_compare(const void *vleft, const void *vright) {
711 const i_int_hline_seg *left = vleft;
712 const i_int_hline_seg *right = vright;
714 return left->minx - right->minx;
718 i_int_hlines_dump(i_int_hlines *hlines) {
720 SV *dump = newSVpvf("start_y: %" i_DF " limit_y: %" i_DF " start_x: %" i_DF " limit_x: %" i_DF"\n",
721 i_DFc(hlines->start_y), i_DFc(hlines->limit_y), i_DFc(hlines->start_x), i_DFc(hlines->limit_x));
724 for (y = hlines->start_y; y < hlines->limit_y; ++y) {
725 i_int_hline_entry *entry = hlines->entries[y-hlines->start_y];
728 /* sort the segments, if any */
730 qsort(entry->segs, entry->count, sizeof(i_int_hline_seg), seg_compare);
732 sv_catpvf(dump, " %" i_DF " (%" i_DF "):", i_DFc(y), i_DFc(entry->count));
733 for (i = 0; i < entry->count; ++i) {
734 sv_catpvf(dump, " [%" i_DF ", %" i_DF ")", i_DFc(entry->segs[i].minx),
735 i_DFc(entry->segs[i].x_limit));
737 sv_catpv(dump, "\n");
747 i_sv_off_t(pTHX_ SV *sv) {
748 #if LSEEKSIZE > IVSIZE
749 return (off_t)SvNV(sv);
751 return (off_t)SvIV(sv);
756 i_new_sv_off_t(pTHX_ off_t off) {
757 #if LSEEKSIZE > IVSIZE
764 static im_pl_ext_funcs im_perl_funcs =
766 IMAGER_PL_API_VERSION,
768 ip_handle_quant_opts,
769 ip_cleanup_quant_opts,
773 #define PERL_PL_SET_GLOBAL_CALLBACKS \
774 sv_setiv(get_sv(PERL_PL_FUNCTION_TABLE_NAME, 1), PTR2IV(&im_perl_funcs));
777 #define i_exif_enabled() 1
779 #define i_exif_enabled() 0
782 /* trying to use more C style names, map them here */
783 #define i_io_DESTROY(ig) io_glue_destroy(ig)
785 #define i_img_get_width(im) ((im)->xsize)
786 #define i_img_get_height(im) ((im)->ysize)
788 #define i_img_epsilonf() (DBL_EPSILON * 4)
790 /* avoid some xsubpp strangeness */
793 MODULE = Imager PACKAGE = Imager::Color PREFIX = ICL_
796 ICL_new_internal(r,g,b,a)
808 ICL_set_internal(cl,r,g,b,a)
815 ICL_set_internal(cl, r, g, b, a);
829 PUSHs(sv_2mortal(newSVnv(cl->rgba.r)));
830 PUSHs(sv_2mortal(newSVnv(cl->rgba.g)));
831 PUSHs(sv_2mortal(newSVnv(cl->rgba.b)));
832 PUSHs(sv_2mortal(newSVnv(cl->rgba.a)));
838 RETVAL = mymalloc(sizeof(i_color));
840 i_hsv_to_rgb(RETVAL);
848 RETVAL = mymalloc(sizeof(i_color));
850 i_rgb_to_hsv(RETVAL);
856 MODULE = Imager PACKAGE = Imager::Color::Float PREFIX=ICLF_
859 ICLF_new_internal(r, g, b, a)
867 Imager::Color::Float cl
871 Imager::Color::Float cl
875 EXTEND(SP, MAXCHANNELS);
876 for (ch = 0; ch < MAXCHANNELS; ++ch) {
877 /* printf("%d: %g\n", ch, cl->channel[ch]); */
878 PUSHs(sv_2mortal(newSVnv(cl->channel[ch])));
882 ICLF_set_internal(cl,r,g,b,a)
883 Imager::Color::Float cl
898 Imager::Color::Float c
900 RETVAL = mymalloc(sizeof(i_fcolor));
902 i_hsv_to_rgbf(RETVAL);
908 Imager::Color::Float c
910 RETVAL = mymalloc(sizeof(i_fcolor));
912 i_rgb_to_hsvf(RETVAL);
916 MODULE = Imager PACKAGE = Imager::ImgRaw PREFIX = IIM_
930 MODULE = Imager PACKAGE = Imager
944 io_new_buffer(data_sv)
947 RETVAL = do_io_new_buffer(aTHX_ data_sv);
952 io_new_cb(writecb, readcb, seekcb, closecb, maxwrite = CBDATA_BUFSIZE)
959 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
971 tlength = io_slurp(ig, &data);
972 RETVAL = newSVpv((char *)data,tlength);
979 i_set_image_file_limits(width, height, bytes)
985 i_get_image_file_limits()
987 i_img_dim width, height;
990 if (i_get_image_file_limits(&width, &height, &bytes)) {
992 PUSHs(sv_2mortal(newSViv(width)));
993 PUSHs(sv_2mortal(newSViv(height)));
994 PUSHs(sv_2mortal(newSVuv(bytes)));
997 MODULE = Imager PACKAGE = Imager::IO PREFIX = io_
1000 io_new_fd(class, fd)
1003 RETVAL = io_new_fd(fd);
1008 io_new_buffer(class, data_sv)
1011 RETVAL = do_io_new_buffer(aTHX_ data_sv);
1016 io_new_cb(class, writecb, readcb, seekcb, closecb)
1022 RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
1027 io_new_bufchain(class)
1029 RETVAL = io_new_bufchain();
1037 unsigned char* data;
1041 tlength = io_slurp(ig, &data);
1042 RETVAL = newSVpv((char *)data,tlength);
1047 MODULE = Imager PACKAGE = Imager::IO PREFIX = i_io_
1050 i_io_raw_write(ig, data_sv)
1058 if (SvUTF8(data_sv)) {
1059 data_sv = sv_2mortal(newSVsv(data_sv));
1060 /* yes, we want this to croak() if the SV can't be downgraded */
1061 sv_utf8_downgrade(data_sv, FALSE);
1064 data = SvPV(data_sv, size);
1065 RETVAL = i_io_raw_write(ig, data, size);
1070 i_io_raw_read(ig, buffer_sv, size)
1079 croak("size negative in call to i_io_raw_read()");
1080 /* prevent an undefined value warning if they supplied an
1082 Orginally conditional on !SvOK(), but this will prevent the
1083 downgrade from croaking */
1084 sv_setpvn(buffer_sv, "", 0);
1086 if (SvUTF8(buffer_sv))
1087 sv_utf8_downgrade(buffer_sv, FALSE);
1089 buffer = SvGROW(buffer_sv, size+1);
1090 result = i_io_raw_read(ig, buffer, size);
1092 SvCUR_set(buffer_sv, result);
1093 *SvEND(buffer_sv) = '\0';
1094 SvPOK_only(buffer_sv);
1096 PUSHs(sv_2mortal(newSViv(result)));
1102 i_io_raw_read2(ig, size)
1111 croak("size negative in call to i_io_read2()");
1112 buffer_sv = newSV(size);
1113 buffer = SvGROW(buffer_sv, size+1);
1114 result = i_io_raw_read(ig, buffer, size);
1116 SvCUR_set(buffer_sv, result);
1117 *SvEND(buffer_sv) = '\0';
1118 SvPOK_only(buffer_sv);
1120 PUSHs(sv_2mortal(buffer_sv));
1124 SvREFCNT_dec(buffer_sv);
1128 i_io_raw_seek(ig, position, whence)
1142 i_io_CLONE_SKIP(...)
1144 (void)items; /* avoid unused warning for XS variable */
1171 i_io_seek(ig, off, whence)
1177 i_io_peekn(ig, size)
1185 buffer_sv = newSV(size+1);
1186 buffer = SvGROW(buffer_sv, size+1);
1187 result = i_io_peekn(ig, buffer, size);
1189 SvCUR_set(buffer_sv, result);
1190 *SvEND(buffer_sv) = '\0';
1191 SvPOK_only(buffer_sv);
1193 PUSHs(sv_2mortal(buffer_sv));
1197 SvREFCNT_dec(buffer_sv);
1201 i_io_read(ig, buffer_sv, size)
1210 croak("size negative in call to i_io_read()");
1211 /* prevent an undefined value warning if they supplied an
1213 Orginally conditional on !SvOK(), but this will prevent the
1214 downgrade from croaking */
1215 sv_setpvn(buffer_sv, "", 0);
1217 if (SvUTF8(buffer_sv))
1218 sv_utf8_downgrade(buffer_sv, FALSE);
1220 buffer = SvGROW(buffer_sv, size+1);
1221 result = i_io_read(ig, buffer, size);
1223 SvCUR_set(buffer_sv, result);
1224 *SvEND(buffer_sv) = '\0';
1225 SvPOK_only(buffer_sv);
1227 PUSHs(sv_2mortal(newSViv(result)));
1233 i_io_read2(ig, size)
1242 croak("size zero in call to read2()");
1243 buffer_sv = newSV(size);
1244 buffer = SvGROW(buffer_sv, size+1);
1245 result = i_io_read(ig, buffer, size);
1247 SvCUR_set(buffer_sv, result);
1248 *SvEND(buffer_sv) = '\0';
1249 SvPOK_only(buffer_sv);
1251 PUSHs(sv_2mortal(buffer_sv));
1255 SvREFCNT_dec(buffer_sv);
1259 i_io_gets(ig, size = 8192, eol = NEWLINE)
1269 croak("size too small in call to gets()");
1270 buffer_sv = sv_2mortal(newSV(size+1));
1271 buffer = SvPVX(buffer_sv);
1272 result = i_io_gets(ig, buffer, size+1, eol);
1274 SvCUR_set(buffer_sv, result);
1275 *SvEND(buffer_sv) = '\0';
1276 SvPOK_only(buffer_sv);
1282 i_io_write(ig, data_sv)
1290 if (SvUTF8(data_sv)) {
1291 data_sv = sv_2mortal(newSVsv(data_sv));
1292 /* yes, we want this to croak() if the SV can't be downgraded */
1293 sv_utf8_downgrade(data_sv, FALSE);
1296 data = SvPV(data_sv, size);
1297 RETVAL = i_io_write(ig, data, size);
1302 i_io_dump(ig, flags = I_IO_DUMP_DEFAULT)
1307 i_io_set_buffered(ig, flag = 1)
1312 i_io_is_buffered(ig)
1323 MODULE = Imager PACKAGE = Imager
1334 while( (item=i_format_list[i++]) != NULL ) {
1336 PUSHs(sv_2mortal(newSVpv(item,0)));
1349 i_img_empty_ch(im,x,y,ch)
1356 i_sametype(im, x, y)
1362 i_sametype_chans(im, x, y, channels)
1369 i_init_log(name_sv,level)
1373 const char *name = SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
1375 RETVAL = i_init_log(name, level);
1380 i_log_entry(string,level)
1401 i_img_info(im,info);
1403 PUSHs(sv_2mortal(newSViv(info[0])));
1404 PUSHs(sv_2mortal(newSViv(info[1])));
1405 PUSHs(sv_2mortal(newSViv(info[2])));
1406 PUSHs(sv_2mortal(newSViv(info[3])));
1412 i_img_setmask(im,ch_mask)
1421 i_img_getchannels(im)
1430 sv_2mortal(newSVpv((char *)im->idata, im->bytes))
1438 i_img_get_height(im)
1443 i_img_is_monochrome(im)
1449 result = i_img_is_monochrome(im, &zero_is_white);
1451 if (GIMME_V == G_ARRAY) {
1454 PUSHs(sv_2mortal(newSViv(zero_is_white)));
1463 i_line(im,x1,y1,x2,y2,val,endp)
1473 i_line_aa(im,x1,y1,x2,y2,val,endp)
1483 i_box(im,x1,y1,x2,y2,val)
1492 i_box_filled(im,x1,y1,x2,y2,val)
1501 i_box_filledf(im,x1,y1,x2,y2,val)
1507 Imager::Color::Float val
1510 i_box_cfill(im,x1,y1,x2,y2,fill)
1516 Imager::FillHandle fill
1519 i_arc(im,x,y,rad,d1,d2,val)
1529 i_arc_aa(im,x,y,rad,d1,d2,val)
1539 i_arc_cfill(im,x,y,rad,d1,d2,fill)
1546 Imager::FillHandle fill
1549 i_arc_aa_cfill(im,x,y,rad,d1,d2,fill)
1556 Imager::FillHandle fill
1560 i_circle_aa(im,x,y,rad,val)
1568 i_circle_out(im,x,y,rad,val)
1576 i_circle_out_aa(im,x,y,rad,val)
1584 i_arc_out(im,x,y,rad,d1,d2,val)
1594 i_arc_out_aa(im,x,y,rad,d1,d2,val)
1605 i_bezier_multi(im,xc,yc,val)
1618 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1619 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
1620 if (!SvROK(ST(2))) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1621 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
1622 av1=(AV*)SvRV(ST(1));
1623 av2=(AV*)SvRV(ST(2));
1624 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_bezier_multi must be equal length\n");
1626 x=mymalloc( len*sizeof(double) );
1627 y=mymalloc( len*sizeof(double) );
1628 for(i=0;i<len;i++) {
1629 sv1=(*(av_fetch(av1,i,0)));
1630 sv2=(*(av_fetch(av2,i,0)));
1631 x[i]=(double)SvNV(sv1);
1632 y[i]=(double)SvNV(sv2);
1634 i_bezier_multi(im,len,x,y,val);
1640 i_poly_aa(im,xc,yc,val)
1653 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1654 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1655 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1656 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa must be a reference to an array\n");
1657 av1=(AV*)SvRV(ST(1));
1658 av2=(AV*)SvRV(ST(2));
1659 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa must be equal length\n");
1661 x=mymalloc( len*sizeof(double) );
1662 y=mymalloc( len*sizeof(double) );
1663 for(i=0;i<len;i++) {
1664 sv1=(*(av_fetch(av1,i,0)));
1665 sv2=(*(av_fetch(av2,i,0)));
1666 x[i]=(double)SvNV(sv1);
1667 y[i]=(double)SvNV(sv2);
1669 RETVAL = i_poly_aa(im,len,x,y,val);
1676 i_poly_aa_cfill(im,xc,yc,fill)
1678 Imager::FillHandle fill
1688 if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1689 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1690 if (!SvROK(ST(2))) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1691 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 1 to i_poly_aa_cfill must be a reference to an array\n");
1692 av1=(AV*)SvRV(ST(1));
1693 av2=(AV*)SvRV(ST(2));
1694 if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_poly_aa_cfill must be equal length\n");
1696 x=mymalloc( len*sizeof(double) );
1697 y=mymalloc( len*sizeof(double) );
1698 for(i=0;i<len;i++) {
1699 sv1=(*(av_fetch(av1,i,0)));
1700 sv2=(*(av_fetch(av2,i,0)));
1701 x[i]=(double)SvNV(sv1);
1702 y[i]=(double)SvNV(sv2);
1704 RETVAL = i_poly_aa_cfill(im,len,x,y,fill);
1713 i_flood_fill(im,seedx,seedy,dcol)
1720 i_flood_cfill(im,seedx,seedy,fill)
1724 Imager::FillHandle fill
1727 i_flood_fill_border(im,seedx,seedy,dcol, border)
1732 Imager::Color border
1735 i_flood_cfill_border(im,seedx,seedy,fill, border)
1739 Imager::FillHandle fill
1740 Imager::Color border
1744 i_copyto(im,src,x1,y1,x2,y2,tx,ty)
1756 i_copyto_trans(im,src,x1,y1,x2,y2,tx,ty,trans)
1773 i_rubthru(im,src,tx,ty,src_minx,src_miny,src_maxx,src_maxy)
1784 i_compose(out, src, out_left, out_top, src_left, src_top, width, height, combine = ic_normal, opacity = 0.0)
1797 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)
1813 i_combine(src_av, channels_av = NULL)
1817 i_img **imgs = NULL;
1819 int *channels = NULL;
1824 in_count = av_len(src_av) + 1;
1826 imgs = mymalloc(sizeof(i_img*) * in_count);
1827 channels = mymalloc(sizeof(int) * in_count);
1828 for (i = 0; i < in_count; ++i) {
1829 psv = av_fetch(src_av, i, 0);
1830 if (!psv || !*psv || !sv_derived_from(*psv, "Imager::ImgRaw")) {
1833 croak("imgs must contain only images");
1835 tmp = SvIV((SV*)SvRV(*psv));
1836 imgs[i] = INT2PTR(i_img*, tmp);
1838 (psv = av_fetch(channels_av, i, 0)) != NULL &&
1840 channels[i] = SvIV(*psv);
1847 RETVAL = i_combine(imgs, channels, in_count);
1854 i_flipxy(im, direction)
1859 i_rotate90(im, degrees)
1864 i_rotate_exact(im, amount, ...)
1868 i_color *backp = NULL;
1869 i_fcolor *fbackp = NULL;
1873 /* extract the bg colors if any */
1874 /* yes, this is kind of strange */
1875 for (i = 2; i < items; ++i) {
1877 if (sv_derived_from(sv1, "Imager::Color")) {
1878 IV tmp = SvIV((SV*)SvRV(sv1));
1879 backp = INT2PTR(i_color *, tmp);
1881 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1882 IV tmp = SvIV((SV*)SvRV(sv1));
1883 fbackp = INT2PTR(i_fcolor *, tmp);
1886 RETVAL = i_rotate_exact_bg(im, amount, backp, fbackp);
1891 i_matrix_transform(im, xsize, ysize, matrix, ...)
1901 i_color *backp = NULL;
1902 i_fcolor *fbackp = NULL;
1904 if (!SvROK(ST(3)) || SvTYPE(SvRV(ST(3))) != SVt_PVAV)
1905 croak("i_matrix_transform: parameter 4 must be an array ref\n");
1906 av=(AV*)SvRV(ST(3));
1910 for (i = 0; i < len; ++i) {
1911 sv1=(*(av_fetch(av,i,0)));
1912 matrix[i] = SvNV(sv1);
1916 /* extract the bg colors if any */
1917 /* yes, this is kind of strange */
1918 for (i = 4; i < items; ++i) {
1920 if (sv_derived_from(sv1, "Imager::Color")) {
1921 IV tmp = SvIV((SV*)SvRV(sv1));
1922 backp = INT2PTR(i_color *, tmp);
1924 else if (sv_derived_from(sv1, "Imager::Color::Float")) {
1925 IV tmp = SvIV((SV*)SvRV(sv1));
1926 fbackp = INT2PTR(i_fcolor *, tmp);
1929 RETVAL = i_matrix_transform_bg(im, xsize, ysize, matrix, backp, fbackp);
1934 i_gaussian(im,stdev)
1939 i_unsharp_mask(im,stdev,scale)
1954 len = av_len(coef) + 1;
1955 c_coef=mymalloc( len * sizeof(double) );
1956 for(i = 0; i < len; i++) {
1957 sv1 = (*(av_fetch(coef, i, 0)));
1958 c_coef[i] = (double)SvNV(sv1);
1960 RETVAL = i_conv(im, c_coef, len);
1966 i_convert(src, avmain)
1978 outchan = av_len(avmain)+1;
1979 /* find the biggest */
1981 for (j=0; j < outchan; ++j) {
1982 temp = av_fetch(avmain, j, 0);
1983 if (temp && SvROK(*temp) && SvTYPE(SvRV(*temp)) == SVt_PVAV) {
1984 avsub = (AV*)SvRV(*temp);
1985 len = av_len(avsub)+1;
1990 coeff = mymalloc(sizeof(double) * outchan * inchan);
1991 for (j = 0; j < outchan; ++j) {
1992 avsub = (AV*)SvRV(*av_fetch(avmain, j, 0));
1993 len = av_len(avsub)+1;
1994 for (i = 0; i < len; ++i) {
1995 temp = av_fetch(avsub, i, 0);
1997 coeff[i+j*inchan] = SvNV(*temp);
1999 coeff[i+j*inchan] = 0;
2002 coeff[i++ + j*inchan] = 0;
2004 RETVAL = i_convert(src, coeff, outchan, inchan);
2014 unsigned int mask = 0;
2020 unsigned char (*maps)[256];
2022 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
2023 croak("i_map: parameter 2 must be an arrayref\n");
2024 avmain = (AV*)SvRV(ST(1));
2025 len = av_len(avmain)+1;
2026 if (im->channels < len) len = im->channels;
2028 maps = mymalloc( len * sizeof(unsigned char [256]) );
2030 for (j=0; j<len ; j++) {
2031 temp = av_fetch(avmain, j, 0);
2032 if (temp && SvROK(*temp) && (SvTYPE(SvRV(*temp)) == SVt_PVAV) ) {
2033 avsub = (AV*)SvRV(*temp);
2034 if(av_len(avsub) != 255) continue;
2036 for (i=0; i<256 ; i++) {
2038 temp = av_fetch(avsub, i, 0);
2039 val = temp ? SvIV(*temp) : 0;
2041 if (val>255) val = 255;
2046 i_map(im, maps, mask);
2057 i_img_diffd(im1,im2)
2062 i_img_samef(im1, im2, epsilon = i_img_epsilonf(), what=NULL)
2072 _is_color_object(sv)
2076 RETVAL = SvOK(sv) && SvROK(sv) &&
2077 (sv_derived_from(sv, "Imager::Color")
2078 || sv_derived_from(sv, "Imager::Color::Float"));
2090 MODULE = Imager PACKAGE = Imager::Font::TT PREFIX=TT_
2092 #define TT_DESTROY(handle) i_tt_destroy(handle)
2096 Imager::Font::TT handle
2101 (void)items; /* avoid unused warning */
2107 MODULE = Imager PACKAGE = Imager
2111 i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
2112 Imager::Font::TT handle
2130 str = SvPV(str_sv, len);
2131 RETVAL = i_tt_text(handle, im, xb, yb, cl, points, str,
2132 len, smooth, utf8, align);
2138 i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
2139 Imager::Font::TT handle
2157 str = SvPV(str_sv, len);
2158 RETVAL = i_tt_cp(handle, im, xb, yb, channel, points, str, len,
2159 smooth, utf8, align);
2165 i_tt_bbox(handle,point,str_sv,len_ignored, utf8)
2166 Imager::Font::TT handle
2171 i_img_dim cords[BOUNDING_BOX_COUNT];
2181 str = SvPV(str_sv, len);
2182 if ((rc=i_tt_bbox(handle,point,str,len,cords, utf8))) {
2184 for (i = 0; i < rc; ++i) {
2185 PUSHs(sv_2mortal(newSViv(cords[i])));
2190 i_tt_has_chars(handle, text_sv, utf8)
2191 Imager::Font::TT handle
2202 if (SvUTF8(text_sv))
2205 text = SvPV(text_sv, len);
2206 work = mymalloc(len);
2207 count = i_tt_has_chars(handle, text, len, utf8, work);
2208 if (GIMME_V == G_ARRAY) {
2210 for (i = 0; i < count; ++i) {
2211 PUSHs(sv_2mortal(newSViv(work[i])));
2216 PUSHs(sv_2mortal(newSVpv(work, count)));
2221 i_tt_dump_names(handle)
2222 Imager::Font::TT handle
2225 i_tt_face_name(handle)
2226 Imager::Font::TT handle
2231 len = i_tt_face_name(handle, name, sizeof(name));
2234 PUSHs(sv_2mortal(newSVpv(name, len-1)));
2238 i_tt_glyph_name(handle, text_sv, utf8 = 0)
2239 Imager::Font::TT handle
2250 if (SvUTF8(text_sv))
2253 text = SvPV(text_sv, work_len);
2258 ch = i_utf8_advance(&text, &len);
2260 i_push_error(0, "invalid UTF8 character");
2269 if ((outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) != 0) {
2270 PUSHs(sv_2mortal(newSVpv(name, 0)));
2273 PUSHs(&PL_sv_undef);
2280 i_test_format_probe(ig, length)
2285 i_readpnm_wiol(ig, allow_incomplete)
2287 int allow_incomplete
2291 i_readpnm_multi_wiol(ig, allow_incomplete)
2293 int allow_incomplete
2299 imgs = i_readpnm_multi_wiol(ig, &count, allow_incomplete);
2302 for (i = 0; i < count; ++i) {
2303 SV *sv = sv_newmortal();
2304 sv_setref_pv(sv, "Imager::ImgRaw", (void *)imgs[i]);
2311 i_writeppm_wiol(im, ig)
2320 i_readraw_wiol(ig,x,y,datachannels,storechannels,intrl)
2329 i_writeraw_wiol(im,ig)
2334 i_writebmp_wiol(im,ig)
2339 i_readbmp_wiol(ig, allow_incomplete=0)
2341 int allow_incomplete
2345 i_writetga_wiol(im,ig, wierdpack, compress, idstring)
2354 idlen = SvCUR(ST(4));
2355 RETVAL = i_writetga_wiol(im, ig, wierdpack, compress, idstring, idlen);
2361 i_readtga_wiol(ig, length)
2369 i_scaleaxis(im,Value,Axis)
2375 i_scale_nn(im,scx,scy)
2381 i_scale_mixing(im, width, height)
2391 i_count_colors(im,maxc)
2396 i_get_anonymous_color_histo(im, maxc = 0x40000000)
2401 unsigned int * col_usage = NULL;
2404 col_cnt = i_get_anonymous_color_histo(im, &col_usage, maxc);
2405 EXTEND(SP, col_cnt);
2406 for (i = 0; i < col_cnt; i++) {
2407 PUSHs(sv_2mortal(newSViv( col_usage[i])));
2414 i_transform(im,opx,opy,parm)
2427 if (!SvROK(ST(1))) croak("Imager: Parameter 1 must be a reference to an array\n");
2428 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to an array\n");
2429 if (!SvROK(ST(3))) croak("Imager: Parameter 3 must be a reference to an array\n");
2430 if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 must be a reference to an array\n");
2431 if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 must be a reference to an array\n");
2432 if (SvTYPE(SvRV(ST(3))) != SVt_PVAV) croak("Imager: Parameter 3 must be a reference to an array\n");
2433 av=(AV*)SvRV(ST(1));
2435 opx=mymalloc( opxl*sizeof(int) );
2436 for(i=0;i<opxl;i++) {
2437 sv1=(*(av_fetch(av,i,0)));
2438 opx[i]=(int)SvIV(sv1);
2440 av=(AV*)SvRV(ST(2));
2442 opy=mymalloc( opyl*sizeof(int) );
2443 for(i=0;i<opyl;i++) {
2444 sv1=(*(av_fetch(av,i,0)));
2445 opy[i]=(int)SvIV(sv1);
2447 av=(AV*)SvRV(ST(3));
2448 parmlen=av_len(av)+1;
2449 parm=mymalloc( parmlen*sizeof(double) );
2450 for(i=0;i<parmlen;i++) { /* FIXME: Bug? */
2451 sv1=(*(av_fetch(av,i,0)));
2452 parm[i]=(double)SvNV(sv1);
2454 RETVAL=i_transform(im,opx,opxl,opy,opyl,parm,parmlen);
2458 ST(0) = sv_newmortal();
2459 if (RETVAL == 0) ST(0)=&PL_sv_undef;
2460 else sv_setref_pv(ST(0), "Imager::ImgRaw", (void*)RETVAL);
2463 i_transform2(sv_width,sv_height,channels,sv_ops,av_n_regs,av_c_regs,av_in_imgs)
2488 in_imgs_count = av_len(av_in_imgs)+1;
2489 for (i = 0; i < in_imgs_count; ++i) {
2490 sv1 = *av_fetch(av_in_imgs, i, 0);
2491 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2492 croak("sv_in_img must contain only images");
2495 if (in_imgs_count > 0) {
2496 in_imgs = mymalloc(in_imgs_count*sizeof(i_img*));
2497 for (i = 0; i < in_imgs_count; ++i) {
2498 sv1 = *av_fetch(av_in_imgs,i,0);
2499 if (!sv_derived_from(sv1, "Imager::ImgRaw")) {
2500 croak("Parameter 5 must contain only images");
2502 tmp = SvIV((SV*)SvRV(sv1));
2503 in_imgs[i] = INT2PTR(i_img*, tmp);
2507 /* no input images */
2510 /* default the output size from the first input if possible */
2512 width = SvIV(sv_width);
2513 else if (in_imgs_count)
2514 width = in_imgs[0]->xsize;
2516 croak("No output image width supplied");
2518 if (SvOK(sv_height))
2519 height = SvIV(sv_height);
2520 else if (in_imgs_count)
2521 height = in_imgs[0]->ysize;
2523 croak("No output image height supplied");
2525 ops = (struct rm_op *)SvPV(sv_ops, ops_len);
2526 if (ops_len % sizeof(struct rm_op))
2527 croak("Imager: Parameter 3 must be a bitmap of regops\n");
2528 ops_count = ops_len / sizeof(struct rm_op);
2530 n_regs_count = av_len(av_n_regs)+1;
2531 n_regs = mymalloc(n_regs_count * sizeof(double));
2532 for (i = 0; i < n_regs_count; ++i) {
2533 sv1 = *av_fetch(av_n_regs,i,0);
2535 n_regs[i] = SvNV(sv1);
2537 c_regs_count = av_len(av_c_regs)+1;
2538 c_regs = mymalloc(c_regs_count * sizeof(i_color));
2539 /* I don't bother initializing the colou?r registers */
2541 RETVAL=i_transform2(width, height, channels, ops, ops_count,
2542 n_regs, n_regs_count,
2543 c_regs, c_regs_count, in_imgs, in_imgs_count);
2548 ST(0) = sv_newmortal();
2549 if (RETVAL == 0) ST(0)=&PL_sv_undef;
2550 else sv_setref_pv(ST(0), "Imager::ImgRaw", (void*)RETVAL);
2554 i_contrast(im,intensity)
2567 i_noise(im,amount,type)
2573 i_bumpmap(im,bump,channel,light_x,light_y,strength)
2583 i_bumpmap_complex(im,bump,channel,tx,ty,Lx,Ly,Lz,cd,cs,n,Ia,Il,Is)
2602 i_postlevels(im,levels)
2612 i_watermark(im,wmark,tx,ty,pixdiff)
2614 Imager::ImgRaw wmark
2621 i_autolevels(im,lsat,usat,skew)
2628 i_radnoise(im,xo,yo,rscale,ascale)
2636 i_turbnoise(im, xo, yo, scale)
2659 croak("Usage: i_gradgen(im, xo, yo, ival, dmeasure)");
2660 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2661 croak("i_gradgen: Second argument must be an array ref");
2662 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2663 croak("i_gradgen: Third argument must be an array ref");
2664 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2665 croak("i_gradgen: Fourth argument must be an array ref");
2666 axx = (AV *)SvRV(ST(1));
2667 ayy = (AV *)SvRV(ST(2));
2668 ac = (AV *)SvRV(ST(3));
2669 dmeasure = (int)SvIV(ST(4));
2671 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2672 num = num <= av_len(ac) ? num : av_len(ac);
2674 if (num < 2) croak("Usage: i_gradgen array refs must have more than 1 entry each");
2675 xo = mymalloc( sizeof(i_img_dim) * num );
2676 yo = mymalloc( sizeof(i_img_dim) * num );
2677 ival = mymalloc( sizeof(i_color) * num );
2678 for(i = 0; i<num; i++) {
2679 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2680 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2681 sv = *av_fetch(ac, i, 0);
2682 if ( !sv_derived_from(sv, "Imager::Color") ) {
2683 free(axx); free(ayy); free(ac);
2684 croak("i_gradgen: Element of fourth argument is not derived from Imager::Color");
2686 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2688 i_gradgen(im, num, xo, yo, ival, dmeasure);
2694 i_diff_image(im, im2, mindist=0)
2700 i_fountain(im, xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2710 double ssample_param
2714 i_fountain_seg *segs;
2716 if (!SvROK(ST(10)) || ! SvTYPE(SvRV(ST(10))))
2717 croak("i_fountain: argument 11 must be an array ref");
2719 asegs = (AV *)SvRV(ST(10));
2720 segs = load_fount_segs(aTHX_ asegs, &count);
2721 RETVAL = i_fountain(im, xa, ya, xb, yb, type, repeat, combine,
2722 super_sample, ssample_param, count, segs);
2728 i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine, super_sample, ssample_param, segs)
2737 double ssample_param
2741 i_fountain_seg *segs;
2743 if (!SvROK(ST(9)) || ! SvTYPE(SvRV(ST(9))))
2744 croak("i_fountain: argument 11 must be an array ref");
2746 asegs = (AV *)SvRV(ST(9));
2747 segs = load_fount_segs(aTHX_ asegs, &count);
2748 RETVAL = i_new_fill_fount(xa, ya, xb, yb, type, repeat, combine,
2749 super_sample, ssample_param, count, segs);
2755 i_new_fill_opacity(other_fill, alpha_mult)
2756 Imager::FillHandle other_fill
2767 errors = i_errors();
2769 while (errors[i].msg) {
2771 sv = newSVpv(errors[i].msg, strlen(errors[i].msg));
2772 if (!av_store(av, 0, sv)) {
2775 sv = newSViv(errors[i].code);
2776 if (!av_store(av, 1, sv)) {
2779 PUSHs(sv_2mortal(newRV_noinc((SV*)av)));
2787 i_push_error(code, msg)
2792 i_nearest_color(im, ...)
2807 croak("Usage: i_nearest_color(im, xo, yo, ival, dmeasure)");
2808 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2809 croak("i_nearest_color: Second argument must be an array ref");
2810 if (!SvROK(ST(2)) || ! SvTYPE(SvRV(ST(2))))
2811 croak("i_nearest_color: Third argument must be an array ref");
2812 if (!SvROK(ST(3)) || ! SvTYPE(SvRV(ST(3))))
2813 croak("i_nearest_color: Fourth argument must be an array ref");
2814 axx = (AV *)SvRV(ST(1));
2815 ayy = (AV *)SvRV(ST(2));
2816 ac = (AV *)SvRV(ST(3));
2817 dmeasure = (int)SvIV(ST(4));
2819 num = av_len(axx) < av_len(ayy) ? av_len(axx) : av_len(ayy);
2820 num = num <= av_len(ac) ? num : av_len(ac);
2822 if (num < 2) croak("Usage: i_nearest_color array refs must have more than 1 entry each");
2823 xo = mymalloc( sizeof(i_img_dim) * num );
2824 yo = mymalloc( sizeof(i_img_dim) * num );
2825 ival = mymalloc( sizeof(i_color) * num );
2826 for(i = 0; i<num; i++) {
2827 xo[i] = (i_img_dim)SvIV(* av_fetch(axx, i, 0));
2828 yo[i] = (i_img_dim)SvIV(* av_fetch(ayy, i, 0));
2829 sv = *av_fetch(ac, i, 0);
2830 if ( !sv_derived_from(sv, "Imager::Color") ) {
2831 free(axx); free(ayy); free(ac);
2832 croak("i_nearest_color: Element of fourth argument is not derived from Imager::Color");
2834 ival[i] = *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
2836 RETVAL = i_nearest_color(im, num, xo, yo, ival, dmeasure);
2850 rc=DSO_open(filename,&evstr);
2854 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2855 PUSHs(sv_2mortal(newSVpvn(evstr, strlen(evstr))));
2858 PUSHs(sv_2mortal(newSViv(PTR2IV(rc))));
2864 DSO_close(dso_handle)
2868 DSO_funclist(dso_handle_v)
2872 DSO_handle *dso_handle;
2873 func_ptr *functions;
2875 dso_handle=(DSO_handle*)dso_handle_v;
2876 functions = DSO_funclist(dso_handle);
2878 while( functions[i].name != NULL) {
2880 PUSHs(sv_2mortal(newSVpv(functions[i].name,0)));
2882 PUSHs(sv_2mortal(newSVpv(functions[i++].pcode,0)));
2886 DSO_call(handle,func_index,hv)
2892 if (!SvROK(ST(2))) croak("Imager: Parameter 2 must be a reference to a hash\n");
2893 hv=(HV*)SvRV(ST(2));
2894 if (SvTYPE(hv)!=SVt_PVHV) croak("Imager: Parameter 2 must be a reference to a hash\n");
2895 DSO_call( (DSO_handle *)handle,func_index,hv);
2898 i_get_pixel(im, x, y)
2905 color = (i_color *)mymalloc(sizeof(i_color));
2906 if (i_gpix(im, x, y, color) == 0) {
2907 RETVAL = NEWSV(0, 0);
2908 sv_setref_pv(RETVAL, "Imager::Color", (void *)color);
2912 RETVAL = &PL_sv_undef;
2919 i_ppix(im, x, y, cl)
2926 i_img_pal_new(x, y, channels, maxpal)
2933 i_img_to_pal(src, quant)
2939 if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1))))
2940 croak("i_img_to_pal: second argument must be a hash ref");
2941 hv = (HV *)SvRV(ST(1));
2942 memset(&quant, 0, sizeof(quant));
2944 quant.mc_size = 256;
2945 ip_handle_quant_opts(aTHX_ &quant, hv);
2946 RETVAL = i_img_to_pal(src, &quant);
2948 ip_copy_colors_back(aTHX_ hv, &quant);
2950 ip_cleanup_quant_opts(aTHX_ &quant);
2969 work = mymalloc((r-l) * sizeof(i_palidx));
2970 count = i_gpal(im, l, r, y, work);
2971 if (GIMME_V == G_ARRAY) {
2973 for (i = 0; i < count; ++i) {
2974 PUSHs(sv_2mortal(newSViv(work[i])));
2979 PUSHs(sv_2mortal(newSVpv((char *)work, count * sizeof(i_palidx))));
2984 if (GIMME_V != G_ARRAY) {
2986 PUSHs(&PL_sv_undef);
2991 i_ppal(im, l, y, ...)
3000 work = malloc_temp(aTHX_ sizeof(i_palidx) * (items-3));
3001 for (i=0; i < items-3; ++i) {
3002 work[i] = SvIV(ST(i+3));
3004 validate_i_ppal(im, work, items - 3);
3005 RETVAL = i_ppal(im, l, l+items-3, y, work);
3014 i_ppal_p(im, l, y, data)
3020 i_palidx const *work;
3023 work = (i_palidx const *)SvPV(data, len);
3024 len /= sizeof(i_palidx);
3026 validate_i_ppal(im, work, len);
3027 RETVAL = i_ppal(im, l, l+len, y, work);
3036 i_addcolors(im, ...)
3044 croak("i_addcolors: no colors to add");
3045 colors = mymalloc((items-1) * sizeof(i_color));
3046 for (i=0; i < items-1; ++i) {
3047 if (sv_isobject(ST(i+1))
3048 && sv_derived_from(ST(i+1), "Imager::Color")) {
3049 IV tmp = SvIV((SV *)SvRV(ST(i+1)));
3050 colors[i] = *INT2PTR(i_color *, tmp);
3054 croak("i_addcolor: pixels must be Imager::Color objects");
3057 index = i_addcolors(im, colors, items-1);
3060 RETVAL = newSVpv("0 but true", 0);
3062 else if (index == -1) {
3063 RETVAL = &PL_sv_undef;
3066 RETVAL = newSViv(index);
3072 i_setcolors(im, index, ...)
3080 croak("i_setcolors: no colors to add");
3081 colors = mymalloc((items-2) * sizeof(i_color));
3082 for (i=0; i < items-2; ++i) {
3083 if (sv_isobject(ST(i+2))
3084 && sv_derived_from(ST(i+2), "Imager::Color")) {
3085 IV tmp = SvIV((SV *)SvRV(ST(i+2)));
3086 colors[i] = *INT2PTR(i_color *, tmp);
3090 croak("i_setcolors: pixels must be Imager::Color objects");
3093 RETVAL = i_setcolors(im, index, colors, items-2);
3099 i_getcolors(im, index, ...)
3108 croak("i_getcolors: too many arguments");
3110 count = SvIV(ST(2));
3112 croak("i_getcolors: count must be positive");
3113 colors = mymalloc(sizeof(i_color) * count);
3114 if (i_getcolors(im, index, colors, count)) {
3115 for (i = 0; i < count; ++i) {
3117 SV *sv = sv_newmortal();
3118 pv = mymalloc(sizeof(i_color));
3120 sv_setref_pv(sv, "Imager::Color", (void *)pv);
3136 i_findcolor(im, color)
3142 if (i_findcolor(im, color, &index)) {
3143 RETVAL = newSViv(index);
3146 RETVAL = &PL_sv_undef;
3164 i_gsamp(im, l, r, y, ...)
3176 croak("No channel numbers supplied to g_samp()");
3178 chan_count = items - 4;
3179 chans = mymalloc(sizeof(int) * chan_count);
3180 for (i = 0; i < chan_count; ++i)
3181 chans[i] = SvIV(ST(i+4));
3182 data = mymalloc(sizeof(i_sample_t) * (r-l) * chan_count); /* XXX: memleak? */
3183 count = i_gsamp(im, l, r, y, data, chans, chan_count);
3185 if (GIMME_V == G_ARRAY) {
3187 for (i = 0; i < count; ++i)
3188 PUSHs(sv_2mortal(newSViv(data[i])));
3192 PUSHs(sv_2mortal(newSVpv((char *)data, count * sizeof(i_sample_t))));
3197 if (GIMME_V != G_ARRAY) {
3199 PUSHs(&PL_sv_undef);
3204 i_gsamp_bits(im, l, r, y, bits, target, offset, ...)
3220 croak("No channel numbers supplied to g_samp()");
3222 chan_count = items - 7;
3223 chans = mymalloc(sizeof(int) * chan_count);
3224 for (i = 0; i < chan_count; ++i)
3225 chans[i] = SvIV(ST(i+7));
3226 data = mymalloc(sizeof(unsigned) * (r-l) * chan_count);
3227 count = i_gsamp_bits(im, l, r, y, data, chans, chan_count, bits);
3229 for (i = 0; i < count; ++i) {
3230 av_store(target, i+offset, newSVuv(data[i]));
3242 i_psamp_bits(im, l, y, bits, channels_sv, data_av, data_offset = 0, pixel_count = -1)
3260 if (SvOK(channels_sv)) {
3262 if (!SvROK(channels_sv) || SvTYPE(SvRV(channels_sv)) != SVt_PVAV) {
3263 croak("channels is not an array ref");
3265 channels_av = (AV *)SvRV(channels_sv);
3266 chan_count = av_len(channels_av) + 1;
3267 if (chan_count < 1) {
3268 croak("i_psamp_bits: no channels provided");
3270 channels = mymalloc(sizeof(int) * chan_count);
3271 for (i = 0; i < chan_count; ++i)
3272 channels[i] = SvIV(*av_fetch(channels_av, i, 0));
3275 chan_count = im->channels;
3279 data_count = av_len(data_av) + 1;
3280 if (data_offset < 0) {
3281 croak("data_offset must by non-negative");
3283 if (data_offset > data_count) {
3284 croak("data_offset greater than number of samples supplied");
3286 if (pixel_count == -1 ||
3287 data_offset + pixel_count * chan_count > data_count) {
3288 pixel_count = (data_count - data_offset) / chan_count;
3291 data_used = pixel_count * chan_count;
3292 data = mymalloc(sizeof(unsigned) * data_count);
3293 for (i = 0; i < data_used; ++i)
3294 data[i] = SvUV(*av_fetch(data_av, data_offset + i, 0));
3296 RETVAL = i_psamp_bits(im, l, l + pixel_count, y, data, channels,
3307 i_img_masked_new(targ, mask, x, y, w, h)
3317 if (!sv_isobject(ST(1))
3318 || !sv_derived_from(ST(1), "Imager::ImgRaw")) {
3319 croak("i_img_masked_new: parameter 2 must undef or an image");
3321 mask = INT2PTR(i_img *, SvIV((SV *)SvRV(ST(1))));
3325 RETVAL = i_img_masked_new(targ, mask, x, y, w, h);
3330 i_plin(im, l, y, ...)
3341 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3342 /* supplied as a byte string */
3343 work = (i_color *)SvPV(ST(3), len);
3344 count = len / sizeof(i_color);
3345 if (count * sizeof(i_color) != len) {
3346 croak("i_plin: length of scalar argument must be multiple of sizeof i_color");
3348 RETVAL = i_plin(im, l, l+count, y, work);
3351 work = mymalloc(sizeof(i_color) * (items-3));
3352 for (i=0; i < items-3; ++i) {
3353 if (sv_isobject(ST(i+3))
3354 && sv_derived_from(ST(i+3), "Imager::Color")) {
3355 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3356 work[i] = *INT2PTR(i_color *, tmp);
3360 croak("i_plin: pixels must be Imager::Color objects");
3363 RETVAL = i_plin(im, l, l+items-3, y, work);
3374 i_ppixf(im, x, y, cl)
3378 Imager::Color::Float cl
3381 i_gsampf(im, l, r, y, ...)
3393 croak("No channel numbers supplied to g_sampf()");
3395 chan_count = items - 4;
3396 chans = mymalloc(sizeof(int) * chan_count);
3397 for (i = 0; i < chan_count; ++i)
3398 chans[i] = SvIV(ST(i+4));
3399 data = mymalloc(sizeof(i_fsample_t) * (r-l) * chan_count);
3400 count = i_gsampf(im, l, r, y, data, chans, chan_count);
3402 if (GIMME_V == G_ARRAY) {
3404 for (i = 0; i < count; ++i)
3405 PUSHs(sv_2mortal(newSVnv(data[i])));
3409 PUSHs(sv_2mortal(newSVpv((void *)data, count * sizeof(i_fsample_t))));
3414 if (GIMME_V != G_ARRAY) {
3416 PUSHs(&PL_sv_undef);
3421 i_plinf(im, l, y, ...)
3432 if (items == 4 && SvOK(ST(3)) && !SvROK(ST(3))) {
3433 /* supplied as a byte string */
3434 work = (i_fcolor *)SvPV(ST(3), len);
3435 count = len / sizeof(i_fcolor);
3436 if (count * sizeof(i_fcolor) != len) {
3437 croak("i_plin: length of scalar argument must be multiple of sizeof i_fcolor");
3439 RETVAL = i_plinf(im, l, l+count, y, work);
3442 work = mymalloc(sizeof(i_fcolor) * (items-3));
3443 for (i=0; i < items-3; ++i) {
3444 if (sv_isobject(ST(i+3))
3445 && sv_derived_from(ST(i+3), "Imager::Color::Float")) {
3446 IV tmp = SvIV((SV *)SvRV(ST(i+3)));
3447 work[i] = *INT2PTR(i_fcolor *, tmp);
3451 croak("i_plinf: pixels must be Imager::Color::Float objects");
3455 RETVAL = i_plinf(im, l, l+items-3, y, work);
3473 color = (i_fcolor *)mymalloc(sizeof(i_fcolor));
3474 if (i_gpixf(im, x, y, color) == 0) {
3475 RETVAL = NEWSV(0,0);
3476 sv_setref_pv(RETVAL, "Imager::Color::Float", (void *)color);
3480 RETVAL = &PL_sv_undef;
3496 vals = mymalloc((r-l) * sizeof(i_color));
3497 memset(vals, 0, (r-l) * sizeof(i_color));
3498 count = i_glin(im, l, r, y, vals);
3499 if (GIMME_V == G_ARRAY) {
3501 for (i = 0; i < count; ++i) {
3503 i_color *col = mymalloc(sizeof(i_color));
3505 sv = sv_newmortal();
3506 sv_setref_pv(sv, "Imager::Color", (void *)col);
3512 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_color))));
3518 i_glinf(im, l, r, y)
3528 for (i = 0; i < MAXCHANNELS; ++i)
3529 zero.channel[i] = 0;
3531 vals = mymalloc((r-l) * sizeof(i_fcolor));
3532 for (i = 0; i < r-l; ++i)
3534 count = i_glinf(im, l, r, y, vals);
3535 if (GIMME_V == G_ARRAY) {
3537 for (i = 0; i < count; ++i) {
3539 i_fcolor *col = mymalloc(sizeof(i_fcolor));
3541 sv = sv_newmortal();
3542 sv_setref_pv(sv, "Imager::Color::Float", (void *)col);
3548 PUSHs(sv_2mortal(newSVpv((void *)vals, count * sizeof(i_fcolor))));
3554 i_img_16_new(x, y, ch)
3564 i_img_double_new(x, y, ch)
3574 i_tags_addn(im, name, code, idata)
3583 name = SvPV(ST(1), len);
3586 RETVAL = i_tags_addn(&im->tags, name, code, idata);
3591 i_tags_add(im, name, code, data, idata)
3601 name = SvPV(ST(1), len);
3605 data = SvPV(ST(3), len);
3610 RETVAL = i_tags_add(&im->tags, name, code, data, len, idata);
3615 i_tags_find(im, name, start)
3622 if (i_tags_find(&im->tags, name, start, &entry)) {
3624 RETVAL = newSVpv("0 but true", 0);
3626 RETVAL = newSViv(entry);
3628 RETVAL = &PL_sv_undef;
3634 i_tags_findn(im, code, start)
3641 if (i_tags_findn(&im->tags, code, start, &entry)) {
3643 RETVAL = newSVpv("0 but true", 0);
3645 RETVAL = newSViv(entry);
3648 RETVAL = &PL_sv_undef;
3654 i_tags_delete(im, entry)
3658 RETVAL = i_tags_delete(&im->tags, entry);
3663 i_tags_delbyname(im, name)
3667 RETVAL = i_tags_delbyname(&im->tags, name);
3672 i_tags_delbycode(im, code)
3676 RETVAL = i_tags_delbycode(&im->tags, code);
3681 i_tags_get(im, index)
3685 if (index >= 0 && index < im->tags.count) {
3686 i_img_tag *entry = im->tags.tags + index;
3690 PUSHs(sv_2mortal(newSVpv(entry->name, 0)));
3693 PUSHs(sv_2mortal(newSViv(entry->code)));
3696 PUSHs(sv_2mortal(newSVpvn(entry->data, entry->size)));
3699 PUSHs(sv_2mortal(newSViv(entry->idata)));
3704 i_tags_get_string(im, what_sv)
3708 char const *name = NULL;
3712 if (SvIOK(what_sv)) {
3713 code = SvIV(what_sv);
3717 name = SvPV_nolen(what_sv);
3720 if (i_tags_get_string(&im->tags, name, code, buffer, sizeof(buffer))) {
3722 PUSHs(sv_2mortal(newSVpv(buffer, 0)));
3729 RETVAL = im->tags.count;
3735 MODULE = Imager PACKAGE = Imager::FillHandle PREFIX=IFILL_
3739 Imager::FillHandle fill
3742 IFILL_CLONE_SKIP(...)
3744 (void)items; /* avoid unused warning for XS variable */
3749 MODULE = Imager PACKAGE = Imager
3752 i_new_fill_solid(cl, combine)
3757 i_new_fill_solidf(cl, combine)
3758 Imager::Color::Float cl
3762 i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
3770 unsigned char *cust_hatch;
3774 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3778 RETVAL = i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy);
3783 i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
3784 Imager::Color::Float fg
3785 Imager::Color::Float bg
3791 unsigned char *cust_hatch;
3795 cust_hatch = (unsigned char *)SvPV(ST(4), len);
3799 RETVAL = i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy);
3804 i_new_fill_image(src, matrix, xoff, yoff, combine)
3821 if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
3822 croak("i_new_fill_image: parameter must be an arrayref");
3823 av=(AV*)SvRV(ST(1));
3827 for (i = 0; i < len; ++i) {
3828 sv1=(*(av_fetch(av,i,0)));
3829 matrix[i] = SvNV(sv1);
3835 RETVAL = i_new_fill_image(src, matrixp, xoff, yoff, combine);
3839 MODULE = Imager PACKAGE = Imager::Internal::Hlines PREFIX=i_int_hlines_
3841 # this class is only exposed for testing
3844 i_int_hlines_testing()
3846 #if i_int_hlines_testing()
3848 Imager::Internal::Hlines
3849 i_int_hlines_new(start_y, count_y, start_x, count_x)
3855 Imager::Internal::Hlines
3856 i_int_hlines_new_img(im)
3860 i_int_hlines_add(hlines, y, minx, width)
3861 Imager::Internal::Hlines hlines
3867 i_int_hlines_DESTROY(hlines)
3868 Imager::Internal::Hlines hlines
3871 i_int_hlines_dump(hlines)
3872 Imager::Internal::Hlines hlines
3875 i_int_hlines_CLONE_SKIP(cls)
3880 PERL_SET_GLOBAL_CALLBACKS;
3881 PERL_PL_SET_GLOBAL_CALLBACKS;