static i_color
S_sv_to_i_color(pTHX_ SV *sv, const char *pname) {
if (!sv_derived_from(sv, "Imager::Color")) {
- croak("%s: not a color object");
+ croak("%s: not a color object", pname);
}
return *INT2PTR(i_color *, SvIV((SV *)SvRV(sv)));
}
if (SvOK(cbd->closecb)) {
dSP;
I32 count;
- SV *sv;
ENTER;
SAVETMPS;
SPAGAIN;
- sv = POPs;
- success = SvTRUE(sv);
+ if (count) {
+ SV *sv = POPs;
+ success = SvTRUE(sv);
+ }
+ else
+ success = 0;
PUTBACK;
FREETMPS;
SV *readcb;
SV *seekcb;
SV *closecb;
- int maxwrite;
CODE:
RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
OUTPUT:
void
-i_bezier_multi(im,xc,yc,val)
+i_bezier_multi(im,x,y,val)
Imager::ImgRaw im
- Imager::Color val
- PREINIT:
- double *x,*y;
- int len;
- AV *av1;
- AV *av2;
- SV *sv1;
- SV *sv2;
- int i;
- PPCODE:
- ICL_info(val);
- if (!SvROK(ST(1))) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
- if (SvTYPE(SvRV(ST(1))) != SVt_PVAV) croak("Imager: Parameter 1 to i_bezier_multi must be a reference to an array\n");
- if (!SvROK(ST(2))) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
- if (SvTYPE(SvRV(ST(2))) != SVt_PVAV) croak("Imager: Parameter 2 to i_bezier_multi must be a reference to an array\n");
- av1=(AV*)SvRV(ST(1));
- av2=(AV*)SvRV(ST(2));
- if (av_len(av1) != av_len(av2)) croak("Imager: x and y arrays to i_bezier_multi must be equal length\n");
- len=av_len(av1)+1;
- x=mymalloc( len*sizeof(double) );
- y=mymalloc( len*sizeof(double) );
- for(i=0;i<len;i++) {
- sv1=(*(av_fetch(av1,i,0)));
- sv2=(*(av_fetch(av2,i,0)));
- x[i]=(double)SvNV(sv1);
- y[i]=(double)SvNV(sv2);
- }
- i_bezier_multi(im,len,x,y,val);
- myfree(x);
- myfree(y);
-
+ double *x
+ double *y
+ Imager::Color val
+ PREINIT:
+ STRLEN size_x;
+ STRLEN size_y;
+ PPCODE:
+ if (size_x != size_y)
+ croak("Imager: x and y arrays to i_bezier_multi must be equal length\n");
+ i_bezier_multi(im,size_x,x,y,val);
int
i_poly_aa(im,x,y,val)
AV *pmaps_av
PREINIT:
unsigned int mask = 0;
- AV *avmain;
AV *avsub;
SV **temp;
int len;
int combine
Imager::FillHandle
-i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
+i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch_sv, dx, dy)
Imager::Color fg
Imager::Color bg
int combine
int hatch
+ SV *cust_hatch_sv
i_img_dim dx
i_img_dim dy
PREINIT:
unsigned char *cust_hatch;
STRLEN len;
CODE:
- if (SvOK(ST(4))) {
- cust_hatch = (unsigned char *)SvPV(ST(4), len);
+ SvGETMAGIC(cust_hatch_sv);
+ if (SvOK(cust_hatch_sv)) {
+ cust_hatch = (unsigned char *)SvPV_nomg(cust_hatch_sv, len);
}
else
cust_hatch = NULL;
RETVAL
Imager::FillHandle
-i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
+i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch_sv, dx, dy)
Imager::Color::Float fg
Imager::Color::Float bg
int combine
int hatch
+ SV *cust_hatch_sv
i_img_dim dx
i_img_dim dy
PREINIT:
unsigned char *cust_hatch;
STRLEN len;
CODE:
- if (SvOK(ST(4))) {
- cust_hatch = (unsigned char *)SvPV(ST(4), len);
+ SvGETMAGIC(cust_hatch_sv);
+ if (SvOK(cust_hatch_sv)) {
+ cust_hatch = (unsigned char *)SvPV(cust_hatch_sv, len);
}
else
cust_hatch = NULL;
RETVAL
Imager::FillHandle
-i_new_fill_image(src, matrix, xoff, yoff, combine)
+i_new_fill_image(src, matrix_sv, xoff, yoff, combine)
Imager::ImgRaw src
+ SV *matrix_sv
i_img_dim xoff
i_img_dim yoff
int combine
SV *sv1;
int i;
CODE:
- if (!SvOK(ST(1))) {
+ SvGETMAGIC(matrix_sv);
+ if (!SvOK(matrix_sv)) {
matrixp = NULL;
}
else {
- if (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVAV)
- croak("i_new_fill_image: parameter must be an arrayref");
- av=(AV*)SvRV(ST(1));
+ if (!SvROK(matrix_sv) || SvTYPE(SvRV(matrix_sv)) != SVt_PVAV)
+ croak("i_new_fill_image: matrix parameter must be an arrayref or undef");
+ av=(AV*)SvRV(matrix_sv);
len=av_len(av)+1;
if (len > 9)
len = 9;