pajoye          Wed Dec 11 15:44:45 2002 EDT

  Modified files:              
    /php4/ext/gd        gd.c 
  Log:
  Add imageantialias(im, flag)
  Add AA support for bundled imageline
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.237 php4/ext/gd/gd.c:1.238
--- php4/ext/gd/gd.c:1.237      Tue Dec 10 14:45:58 2002
+++ php4/ext/gd/gd.c    Wed Dec 11 15:44:44 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.237 2002/12/10 19:45:58 iliaa Exp $ */
+/* $Id: gd.c,v 1.238 2002/12/11 20:44:44 pajoye Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
    Cold Spring Harbor Labs. */
@@ -182,7 +182,7 @@
        PHP_FE(imagecreate,                                                            
 NULL)
 #if HAVE_LIBGD20
        PHP_FE(imagecreatetruecolor,                                    NULL)
-       PHP_FE(imageistruecolor,                                        NULL)
+       PHP_FE(imageistruecolor,                                                NULL)
        PHP_FE(imagetruecolortopalette,                                 NULL)
        PHP_FE(imagesetthickness,                                               NULL)
        PHP_FE(imagefilledarc,                                                  NULL)
@@ -196,6 +196,7 @@
 
 #ifdef HAVE_GD_BUNDLED
        PHP_FE(imagerotate,                                                     NULL)
+       PHP_FE(imageantialias,                                                  NULL)
 #endif
 
 #if HAVE_GD_IMAGESETTILE
@@ -2129,6 +2130,7 @@
 {
        zval **IM, **x1, **y1, **x2, **y2, **col;
        gdImagePtr im;
+       int antialias=0;
 
        if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, 
&col) == FAILURE) {
                ZEND_WRONG_PARAM_COUNT();
@@ -2142,6 +2144,16 @@
        convert_to_long_ex(y2);
        convert_to_long_ex(col);
 
+#ifdef HAVE_GD_BUNDLED
+               antialias = im->antialias;
+#endif
+       if (antialias) {
+               gdImageAALine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), 
+Z_LVAL_PP(y2), Z_LVAL_PP(col));
+       } else {
+               gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), 
+Z_LVAL_PP(y2), Z_LVAL_PP(col));
+       }
+                                                                
+       
        gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), 
Z_LVAL_PP(col));
        RETURN_TRUE;
 }
@@ -4063,6 +4075,24 @@
 }
 /* }}} */
 #endif
+
+/* {{{ proto imagesetantialias(int im, bool on)
+        Should antialiased functions used or not*/
+PHP_FUNCTION(imageantialias)
+{
+       zval **IM, **alias;
+       gdImagePtr im;
+
+       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &alias) == FAILURE) 
+{
+               ZEND_WRONG_PARAM_COUNT();
+       }
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       convert_to_boolean_ex(alias);
+       gdImageAntialias(im, Z_LVAL_PP(alias));
+       RETURN_TRUE;
+}
+/* }}} */
+                                                                                      
+                    
 /* End section: Filters */
 
 /*



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to