Hello, I m done with new filters function for the bundled gd, all seems to compile&work well.
I m stuck with 'little' things : 1. php syntax After a short discussion on #php, I choose to implement a generic function: bool imagefilter(resssource img, int filtertype [,arg1,argn,...]); where int filtertype are predefined constant (IMAGE_FILTER_BRIGHTNESS, IMAGE_FILTER_EDGEDETECT,...) and argN depends on the used filter. Is this syntax sounds good to you ? 2. The implementation It was clear that a generic imagefilter function is easier to use than N different functions (inside php). So here I went. But I did not find a cool way to do it. One goal of that is to make as easy as possible to add filters (in ext/gd/gd.c). Currently I do: 3701 if (ZEND_NUM_ARGS()<2 || ZEND_NUM_ARGS()>5 || 3702 zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) 3703 ZEND_WRONG_PARAM_COUNT(); 3704 3705 FILTERTYPE = args[1]; 3706 3707 convert_to_long_ex(FILTERTYPE); 3708 filtertype = Z_LVAL_PP(FILTERTYPE); .... 3716 switch (filtertype) { 3717 case IMAGE_FILTER_NEGATE: 3718 if (ZEND_NUM_ARGS()>2) { 3719 ZEND_WRONG_PARAM_COUNT(); 3720 } 3721 if (gdImageNegate(im_src)==1) { 3722 RETURN_TRUE; 3723 } 3724 break; .... I do not like the switch, I prefer to see something like an array of the available filters, an array of function pointers to which we pass the php arguments(INTERNAL_FUNCTION_PARAM_PASSTHRU). It will be easier to add new filters. I try to do it but I ve failed. the problem is I need to call a function passing to it all php args and allowing it to return errors/warnings/notices to the user. This function does not have to be available from php. I hope I was clear enough :-) any comments, ideas ? pa -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php