]> granicus.if.org Git - php/commitdiff
MFH imageistruecolor, imagesavealpha
authorPierre Joye <pajoye@php.net>
Sat, 1 Mar 2003 01:15:47 +0000 (01:15 +0000)
committerPierre Joye <pajoye@php.net>
Sat, 1 Mar 2003 01:15:47 +0000 (01:15 +0000)
ext/gd/gd.c
ext/gd/php_gd.h

index efb30b53f67ad8dd34722d16afa354e1b46e0368..98fd9dc25ea1e055fd02e126ebd2f83072a5e0b1 100644 (file)
@@ -148,11 +148,13 @@ function_entry gd_functions[] = {
        PHP_FE(imagecreate,                                                             NULL)
 #if HAVE_LIBGD20
        PHP_FE(imagecreatetruecolor,                                    NULL)
+       PHP_FE(imageistruecolor,                        NULL)
        PHP_FE(imagetruecolortopalette,                                 NULL)
        PHP_FE(imagesetthickness,                                               NULL)
        PHP_FE(imagefilledarc,                                                  NULL)
        PHP_FE(imagefilledellipse,                                              NULL)
        PHP_FE(imagealphablending,                                              NULL)
+       PHP_FE(imagesavealpha,                          NULL)
        PHP_FE(imagecolorresolvealpha,                                  NULL)
        PHP_FE(imagecolorclosestalpha,                                  NULL)
        PHP_FE(imagecolorexactalpha,                                    NULL)
@@ -711,6 +713,23 @@ PHP_FUNCTION(imagecreatetruecolor)
 }
 /* }}} */
 
+/* {{{ proto int imageistruecolor(int im)
+ *    return true if the image uses truecolor */
+PHP_FUNCTION(imageistruecolor)
+{
+       zval **IM;
+       gdImagePtr im;
+
+       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);
+}
+/* }}} */
+
 /* {{{ proto void imagetruecolortopalette(resource im, bool ditherFlag, int colorsWanted)
    Convert a true colour image to a palette based image with a number of colours, optionally using dithering. */
 PHP_FUNCTION(imagetruecolortopalette)
@@ -869,6 +888,27 @@ PHP_FUNCTION(imagealphablending)
 }
 /* }}} */
 
+#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 */
index de607d00dc421ebf793dff6ec5b750f087b6d92d..189c7d98bbc40eb78fcd024c5f737e6279230c05 100644 (file)
@@ -84,12 +84,14 @@ PHP_FUNCTION(imageftbbox);
 PHP_FUNCTION(imagefttext);
 
 PHP_FUNCTION(imagecreatetruecolor);
+PHP_FUNCTION(imageistruecolor);
 PHP_FUNCTION(imagetruecolortopalette);
 PHP_FUNCTION(imagesetthickness);
 PHP_FUNCTION(imageellipse);
 PHP_FUNCTION(imagefilledellipse);
 PHP_FUNCTION(imagefilledarc);
 PHP_FUNCTION(imagealphablending);
+PHP_FUNCTION(imagesavealpha);
 PHP_FUNCTION(imagecolorresolvealpha);
 PHP_FUNCTION(imagecolorclosestalpha);
 PHP_FUNCTION(imagecolorexactalpha);