/* $Id$ */
-/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
+/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
/* Note that there is no code from the gd package in this file */
PHP_FE(imagefilledarc, NULL)
PHP_FE(imagefilledellipse, NULL)
PHP_FE(imagealphablending, NULL)
+ PHP_FE(imagesavealpha, NULL)
PHP_FE(imagecolorallocatealpha, NULL)
PHP_FE(imagecolorresolvealpha, NULL)
PHP_FE(imagecolorclosestalpha, NULL)
PHP_FE(imagepsbbox, NULL)
#endif
PHP_FE(imagetypes, NULL)
-
+
#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP)
PHP_FE(jpeg2wbmp, NULL)
#endif
#endif
#ifdef HAVE_GD_WBMP
PHP_FE(image2wbmp, NULL)
-#endif
+#endif
#if HAVE_GD_BUNDLED
PHP_FE(imagelayereffect, NULL)
PHP_FE(imagecolormatch, NULL)
/* {{{ proto int imageloadfont(string filename)
Load a new font */
-PHP_FUNCTION(imageloadfont)
+PHP_FUNCTION(imageloadfont)
{
zval **file;
int hdr_size = sizeof(gdFont) - sizeof(char *);
* byte 8-11: (int) pixel width of each character
* byte 12-15: (int) pixel height of each character
* bytes 16-: (char) array with character data, one byte per pixel
- * in each character, for a total of
+ * in each character, for a total of
* (nchars*width*height) bytes.
*/
font = (gdFontPtr)emalloc(sizeof(gdFont));
stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles)));
zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos);
-
+
for (index=0;; zend_hash_move_forward_ex(HASH_OF(*styles), &pos)) {
zval ** item;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
RETURN_BOOL(im->trueColor);
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_boolean_ex(dither);
convert_to_long_ex(ncolors);
-
+
gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
RETURN_TRUE;
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(thick);
-
+
gdImageSetThickness(im, Z_LVAL_PP(thick));
RETURN_TRUE;
if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(cx);
gdImageFilledArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col), Z_LVAL_PP(style));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto void imagealphablending(resource im, bool on)
Turn alpha blending mode on or off for the given image */
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_boolean_ex(blend);
-
+
gdImageAlphaBlending(im, Z_LVAL_PP(blend));
RETURN_TRUE;
}
/* }}} */
+#if HAVE_LIBGD20
+/* {{{ proto void imagesavealpha(resource im, bool on)
+ Include alpha channel to a saved image */
+PHP_FUNCTION(imagesavealpha)
+{
+ zval **IM, **save;
+ gdImagePtr im;
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &save) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+ convert_to_boolean_ex(save);
+
+ gdImageSaveAlpha(im, Z_LVAL_PP(save));
+
+ RETURN_TRUE;
+}
+#endif
+
#if HAVE_GD_BUNDLED
/* {{{ proto void imagelayereffect(resource im, int effect)
Set the alpha blending flag to use the bundled libgd layering effects */
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
convert_to_long_ex(alpha);
-
+
RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
}
/* }}} */
Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM */
PHP_FUNCTION(imagetypes)
{
- int ret=0;
+ int ret=0;
#ifdef HAVE_GD_GIF_CREATE
ret = 1;
#endif
io_ctx->gd_free(io_ctx);
#else
io_ctx->free(io_ctx);
-#endif
+#endif
return PHP_GDIMG_TYPE_WBM;
} else {
#if HAVE_LIBGD204
io_ctx->gd_free(io_ctx);
#else
io_ctx->free(io_ctx);
-#endif
- }
+#endif
+ }
}
}
#endif
}
/* }}} */
-#ifdef HAVE_LIBGD15
+#ifdef HAVE_LIBGD15
/* {{{ _php_image_create_from_string
*/
gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioctx_func_p)() TSRMLS_DC)
io_ctx->gd_free(io_ctx);
#else
io_ctx->free(io_ctx);
-#endif
+#endif
return im;
}
/* }}} */
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
convert_to_string_ex(data);
memcpy(sig, Z_STRVAL_PP(data), 8);
RETURN_FALSE;
#endif
break;
-
+
case PHP_GDIMG_TYPE_GIF:
#ifdef HAVE_GD_GIF_READ
im = _php_image_create_from_string (data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC);
/* {{{ _php_image_create_from
*/
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)())
+static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)())
{
zval **file, **srcx, **srcy, **width, **height;
gdImagePtr im = NULL;
php_stream *stream;
FILE * fp = NULL;
int argc=ZEND_NUM_ARGS();
-
+
if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 5) ||
- (image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) ||
+ (image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) ||
zend_get_parameters_ex(argc, &file, &srcx, &srcy, &width, &height) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
convert_to_string_ex(file);
if (argc == 5 && image_type == PHP_GDIMG_TYPE_GD2PART) {
multi_convert_to_long_ex(4, srcx, srcy, width, height);
}
-
+
fn = Z_STRVAL_PP(file);
stream = php_stream_open_wrapper(fn, "rb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot read image data");
goto out_err;
}
-
+
io_ctx = gdNewDynamicCtx(buff_size, buff);
if(!io_ctx) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
io_ctx->gd_free(io_ctx);
#else
io_ctx->free(io_ctx);
-#endif
+#endif
-#endif
+#endif
}
else {
/* try and force the stream to be FILE* */
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void**)&fp, REPORT_ERRORS))
goto out_err;
}
-
+
if (!im && fp) {
switch (image_type) {
case PHP_GDIMG_TYPE_GD2PART:
/* {{{ _php_image_output
*/
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
+static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
{
zval **imgind, **file, **quality, **type;
gdImagePtr im;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn);
RETURN_FALSE;
}
-
+
switch(image_type) {
case PHP_GDIMG_CONVERT_WBM:
if(q<0||q>255) {
}
(*func_p)(im, fp);
break;
-#endif
+#endif
default:
if (q == -1) {
q = 128;
}
(*func_p)(im, tmp);
break;
-#endif
+#endif
default:
(*func_p)(im, tmp);
break;
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
-
+
RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
}
/* }}} */
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dstim, &srcim) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(dst, gdImagePtr, dstim, -1, "Image", le_gd);
ZEND_FETCH_RESOURCE(src, gdImagePtr, srcim, -1, "Image", le_gd);
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &x, &y) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(x);
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
-
+
RETURN_LONG(gdImageColorClosest(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
}
/* }}} */
{
zval **IM, **red, **green, **blue;
gdImagePtr im;
-
+
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
+
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
-
+
RETURN_LONG(gdImageColorResolve(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
}
/* }}} */
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
-
+
RETURN_LONG(gdImageColorExact(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
}
/* }}} */
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &color, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(color);
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
-
+
col = Z_LVAL_PP(color);
-
+
if (col >= 0 && col < gdImageColorsTotal(im)) {
im->red[col] = Z_LVAL_PP(red);
im->green[col] = Z_LVAL_PP(green);
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &index) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(index);
add_assoc_long(return_value,"green", gdImageGreen(im,col));
add_assoc_long(return_value,"blue", gdImageBlue(im,col));
add_assoc_long(return_value,"alpha", gdImageAlpha(im,col));
- }
+ }
#else
if (col >= 0 && col < gdImageColorsTotal(im)) {
array_init(return_value);
for (y = 0; y < gdImageSY(im); y++) {
for (x = 0; x < gdImageSX(im); x++) {
c = gdImageGetPixel(im, x, y);
- gdImageSetPixel(im, x, y,
+ gdImageSetPixel(im, x, y,
gdTrueColor(
(int)((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255)+.5),
(int)((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255)+.5),
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col)
Draw a line */
#ifdef HAVE_GD_BUNDLED
if (im->antialias)
gdImageAALine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
- else
-#endif
+ else
+#endif
gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col)
Draw a dashed line */
gdImageRectangle(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col)
Draw a filled rectangle */
gdImageFilledRectangle(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col)
Draw a partial ellipse */
gdImageArc(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), st, e, Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
Draw an ellipse */
if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
convert_to_long_ex(cx);
gdImageFillToBorder(im, Z_LVAL_PP(x), Z_LVAL_PP(y), Z_LVAL_PP(border), Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagefill(int im, int x, int y, int col)
Flood fill */
gdImageFill(im, Z_LVAL_PP(x), Z_LVAL_PP(y), Z_LVAL_PP(col));
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagecolorstotal(int im)
Find out the number of colors in an image's palette */
RETURN_LONG(gdImageColorsTotal(im));
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagecolortransparent(int im [, int col])
Define a color as transparent */
RETURN_LONG(gdImageGetTransparent(im));
}
-/* }}} */
+/* }}} */
/* {{{ proto int imageinterlace(int im [, int interlace])
Enable or disable interlace */
RETURN_LONG(gdImageGetInterlaced(im));
}
-/* }}} */
+/* }}} */
/* {{{ php_imagepolygon
arg = 0 normal polygon
arg = 1 filled polygon */
/* im, points, num_points, col */
-static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
+static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
{
zval **IM, **POINTS, **NPOINTS, **COL;
pval **var = NULL;
gdImagePtr im;
- gdPointPtr points;
+ gdPointPtr points;
int npoints, col, nelem, i;
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
gdFontPtr font;
int ind_type;
TSRMLS_FETCH();
-
+
switch (size) {
case 1:
font = gdFontTiny;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &SIZE) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
convert_to_long_ex(SIZE);
font = php_find_gd_font(Z_LVAL_PP(SIZE));
for (py = y; (py > (y - f->w)); py--) {
for (px = x; (px < (x + f->h)); px++) {
if (f->data[fline + cy * f->w + cx]) {
- gdImageSetPixel(im, px, py, color);
+ gdImageSetPixel(im, px, py, color);
}
cy++;
}
* arg = 2 ImageString
* arg = 3 ImageStringUp
*/
-static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
+static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
zval **IM, **SIZE, **X, **Y, **C, **COL;
gdImagePtr im;
/* }}} */
/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col)
- Draw a character */
-PHP_FUNCTION(imagechar)
+ Draw a character */
+PHP_FUNCTION(imagechar)
{
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col)
Draw a character rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagecharup)
+PHP_FUNCTION(imagecharup)
{
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col)
Draw a string horizontally */
-PHP_FUNCTION(imagestring)
+PHP_FUNCTION(imagestring)
{
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
}
/* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col)
Draw a string vertically - rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagestringup)
+PHP_FUNCTION(imagestringup)
{
php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
}
/* }}} */
/* {{{ proto int imagecopy(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)
- Copy part of an image */
+ Copy part of an image */
PHP_FUNCTION(imagecopy)
{
zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY;
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX;
- if (ZEND_NUM_ARGS() != 8 ||
+ if (ZEND_NUM_ARGS() != 8 ||
zend_get_parameters_ex(8, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
RETURN_TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ proto int imagesx(int im)
Get image width */
php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1);
}
/* }}} */
-#endif
+#endif
/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text)
#if !HAVE_GD_STRINGFTEX
assert(!extended);
#endif
-
+
argc = ZEND_NUM_ARGS();
if (mode == TTFTEXT_BBOX) {
#if HAVE_GD_STRINGFTEX
if (EXT) {
/* parse extended info */
-
+
HashPosition pos;
-
+
convert_to_array_ex(EXT);
memset(&strex, 0, sizeof(strex));
-
+
/* walk the assoc array */
zend_hash_internal_pointer_reset_ex(HASH_OF(*EXT), &pos);
do {
if (zend_hash_get_current_data_ex(HASH_OF(*EXT), (void**)&item, &pos) == FAILURE)
continue;
-
+
if (strcmp("linespacing", key) == 0) {
convert_to_double_ex(item);
strex.flags |= gdFTEX_LINESPACE;
strex.linespacing = Z_DVAL_PP(item);
}
-
+
} while(zend_hash_move_forward_ex(HASH_OF(*EXT), &pos) == SUCCESS);
}
#endif
-
+
}
ptsize = Z_DVAL_PP(PTSIZE);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error);
RETURN_FALSE;
}
-
+
array_init(return_value);
/* return array with the text's bounding box */
char *str;
int str_len;
int argc = ZEND_NUM_ARGS();
-
+
if (argc != 8 && argc != 12) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrlllll|lldl", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) {
return;
}
if (_fg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
#else
if (_fg < 0 || _fg > gdImageColorsTotal(bg_img)) {
-#endif
+#endif
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Foreground color index %d out of range", _fg);
RETURN_FALSE;
}
if (_bg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
#else
if (_bg < 0 || _bg > gdImageColorsTotal(bg_img)) {
-#endif
+#endif
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Background color index %d out of range", _bg);
RETURN_FALSE;
}
-
+
fg_rd = gdImageRed (bg_img, _fg);
fg_gr = gdImageGreen(bg_img, _fg);
fg_bl = gdImageBlue (bg_img, _fg);
if (!str_path) {
if (T1_errno) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno);
- }
+ }
RETURN_FALSE;
}
str_bbox = T1_GetStringBBox(*f_ind, Z_STRVAL_PP(str), Z_STRLEN_PP(str), space, T1_KERNING);
}
if (T1_errno) RETURN_FALSE;
-
+
array_init(return_value);
/*
printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*Z_LVAL_PP(sz)/1000));
}
/* }}} */
-#endif
+#endif
#ifdef HAVE_GD_WBMP
/* {{{ proto int image2wbmp(int im [, string filename [, int threshold]])
#ifdef HAVE_GD_WBMP
/* {{{ _php_image_bw_convert
* It converts a gd Image to bw using a threshold value */
-static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshold)
+static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshold)
{
gdImagePtr im_dest;
int white, black;
int dest_width = gdImageSX (im_org);
int x, y;
TSRMLS_FETCH();
-
+
im_dest = gdImageCreate (dest_width, dest_height);
if (im_dest == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate temporary buffer");
/* {{{ _php_image_convert
* _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
+static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
{
zval **f_org, **f_dest, **height, **width, **threshold;
gdImagePtr im_org, im_dest, im_tmp;
fclose(dest);
gdImageDestroy( im_dest );
-
+
RETURN_TRUE;
}
/* }}} */
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
if ( im_src==NULL ) {
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_array_ex(1, &SIM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=3 || zend_parse_parameters(3 TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
if (im_src==NULL) {
zval *SIM;
gdImagePtr im_src;
long contrast, tmp;
-
+
if (ZEND_NUM_ARGS()!=3 || zend_parse_parameters(3 TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=5 || zend_parse_parameters(5 TSRMLS_CC, "rllll", &SIM, &tmp, &r, &g, &b) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(1, &SIM) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
if (im_src==NULL) {
if (ZEND_NUM_ARGS()!=3 || zend_parse_parameters(3 TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);
if (im_src==NULL) {
typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS);
long filtertype;
- image_filter filters[] =
+ image_filter filters[] =
{
php_image_filter_negate ,
php_image_filter_grayscale,
if (ZEND_NUM_ARGS()<2 || ZEND_NUM_ARGS()>5 || zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
- }
+ }
if (filtertype>=0 && filtertype<=IMAGE_FILTER_MAX) {
filters[filtertype](INTERNAL_FUNCTION_PARAM_PASSTHRU);