GD
view release on metacpan or search on metacpan
START_MY_CXT
#endif
MODULE = GD PACKAGE = GD
INCLUDE: const-xs.inc
void
VERSION_STRING()
PPCODE:
mXPUSHp(GD_VERSION_STRING,sizeof(GD_VERSION_STRING)-1);
void
LIBGD_VERSION()
PPCODE:
mXPUSHn(GD_VERSION/10000.0);
#if GD_VERSION >= 20101
bool
supportsFileType(char *filename, int writing=0)
PROTOTYPE: $;$
CODE:
RETVAL = gdSupportsFileType(filename, writing);
OUTPUT:
gdImageColorTransparent(image,color);
}
RETVAL = gdImageGetTransparent(image);
OUTPUT:
RETVAL
void
gdgetBounds(image)
GD::Image image
PROTOTYPE: $
PPCODE:
mXPUSHi(gdImageSX(image));
mXPUSHi(gdImageSY(image));
int
gdisTrueColor(image)
GD::Image image
PROTOTYPE: $
CODE:
RETVAL = gdImageTrueColor(image);
OUTPUT:
OUTPUT:
RETVAL
#endif
void
gdrgb(image,color)
GD::Image image
int color
PROTOTYPE: $$
PPCODE:
mXPUSHi(gdImageRed(image,color));
mXPUSHi(gdImageGreen(image,color));
mXPUSHi(gdImageBlue(image,color));
void
gdalpha(image,color)
GD::Image image
int color
PROTOTYPE: $$
PPCODE:
mXPUSHi(gdImageAlpha(image,color));
int
gdboundsSafe(image,x,y)
GD::Image image
int x
int y
PROTOTYPE: $$$
CODE:
RETVAL = gdImageBoundsSafe(image,x,y);
int brect[8];
char *err;
char *a;
SV* errormsg;
HV* hash;
SV** value;
int i;
int hdpi;
int vdpi;
gdFTStringExtra strex;
PPCODE:
{
#ifndef HAVE_FT
errormsg = perl_get_sv("@",0);
sv_setpv(errormsg,"libgd was not built with FreeType font support\n");
XSRETURN_EMPTY;
#endif
if (sv_isobject(image) && sv_derived_from(image, "GD::Image")) {
IV tmp = SvIV((SV*)SvRV(image));
img = (gdImagePtr) tmp;
} else {
CODE:
gdImageSaveAlpha(image,saveAlphaArg);
void
gdclip(image,...)
GD::Image image
PROTOTYPE: $;$$$$
PREINIT:
int coords[4];
int i;
PPCODE:
if (items == 5) {
for (i=0; i<4; i++)
coords[i] = (int)SvIV(ST(i+1));
gdImageSetClip(image,coords[0],coords[1],coords[2],coords[3]);
}
else if (items > 1) /* something weird */
croak("Usage: $gd->clip() or $gd->clip(x1,x2,y1,y2)");
gdImageGetClip(image,&coords[0],&coords[1],&coords[2],&coords[3]);
EXTEND(sp,4);
const-xs.inc view on Meta::CPAN
dTARGET;
#endif
STRLEN len;
int type;
IV iv = 0;
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
switch (type) {
case PERL_constant_NOTFOUND:
sv =
sv_2mortal(newSVpvf("%s is not a valid GD macro", s));
PUSHs(sv);
( run in 1.263 second using v1.01-cache-2.11-cpan-5511b514fd6 )