diff options
| author | Sterling Hughes <sterling@php.net> | 2000-05-14 18:39:11 +0000 | 
|---|---|---|
| committer | Sterling Hughes <sterling@php.net> | 2000-05-14 18:39:11 +0000 | 
| commit | ed2933342cbe6c79af024a3f0ef7bae6986fe215 (patch) | |
| tree | 5a015b55965e06ce3abbac5634189c8918025b5f | |
| parent | 7fc980e1faacc60f46ae2a05bfd100752451418a (diff) | |
| download | php-git-ed2933342cbe6c79af024a3f0ef7bae6986fe215.tar.gz | |
@-Add swf_definepoly for drawing polygons to the SWF functions. (Sterling)
| -rw-r--r-- | ext/swf/php_swf.h | 1 | ||||
| -rw-r--r-- | ext/swf/swf.c | 44 | 
2 files changed, 43 insertions, 2 deletions
diff --git a/ext/swf/php_swf.h b/ext/swf/php_swf.h index 96b9e2f8a2..ffbdc4bbc8 100644 --- a/ext/swf/php_swf.h +++ b/ext/swf/php_swf.h @@ -62,6 +62,7 @@ PHP_FUNCTION(swf_actionsettarget);  PHP_FUNCTION(swf_actiongotolabel);  PHP_FUNCTION(swf_defineline);  PHP_FUNCTION(swf_definerect); +PHP_FUNCTION(swf_definepoly);  PHP_FUNCTION(swf_startshape);  PHP_FUNCTION(swf_shapelinesolid);  PHP_FUNCTION(swf_shapefilloff); diff --git a/ext/swf/swf.c b/ext/swf/swf.c index e680feebac..4a204fddd3 100644 --- a/ext/swf/swf.c +++ b/ext/swf/swf.c @@ -53,6 +53,7 @@ function_entry swf_functions[] = {  	PHP_FE(swf_actiongotolabel,		NULL)  	PHP_FE(swf_defineline,		NULL)  	PHP_FE(swf_definerect,		NULL) +	PHP_FE(swf_definepoly,		NULL)  	PHP_FE(swf_startshape,		NULL)  	PHP_FE(swf_shapelinesolid,		NULL)  	PHP_FE(swf_shapefilloff,		NULL) @@ -161,8 +162,9 @@ PHP_FUNCTION(swf_openfile)  	convert_to_double_ex(g);  	convert_to_double_ex(b); -	swf_openfile((*name)->value.str.val, (float)(*sizeX)->value.dval, (float)(*sizeY)->value.dval, -	       		 (float)(*frameRate)->value.dval, (float)(*r)->value.dval, (float)(*g)->value.dval, (float)(*b)->value.dval); +	swf_openfile((*name)->value.str.val, +			 (float)(*sizeX)->value.dval, (float)(*sizeY)->value.dval, +      		 	 (float)(*frameRate)->value.dval, (float)(*r)->value.dval, (float)(*g)->value.dval, (float)(*b)->value.dval);  }  /* }}} */ @@ -478,6 +480,44 @@ PHP_FUNCTION(swf_definerect)  }  /* }}} */ +/* {{{ proto void swf_definepoly(int obj_id, array coords, int npoints, double width) +   Define a Polygon from an array of x,y coordinates, coords. */ +PHP_FUNCTION(swf_definepoly) +{ +	zval **obj_id, **coordinates, **NumPoints, **width, **var; +	int npoints, i; +	float coords[256][2]; +	 +	if (ARG_COUNT(ht) != 4 || +	    zend_get_parameters_ex(4, &obj_id, &coordinates, &NumPoints, &width) == FAILURE) { +		WRONG_PARAM_COUNT; +	} +	convert_to_long_ex(obj_id); +	convert_to_long_ex(NumPoints); +	convert_to_double_ex(width); +	 +	if ((*coordinates)->type != IS_ARRAY) { +		return; +		php_error(E_WARNING, "Wrong datatype of second argument to swf_definepoly"); +	} +	 +	npoints = (*NumPoints)->value.lval; +	for (i = 0; i < npoints; i++) { +		if (zend_hash_index_find((*coordinates)->value.ht, (i * 2), (void **)&var) == SUCCESS) { +			SEPARATE_ZVAL(var); +			convert_to_double_ex(var); +			coords[i][0] = (float)(*var)->value.dval; +		} +		if (zend_hash_index_find((*coordinates)->value.ht, (i * 2) + 1, (void **)&var) == SUCCESS) { +			SEPARATE_ZVAL(var); +			convert_to_double_ex(var); +			coords[i][1] = (float)(*var)->value.dval; +		} +	} +	swf_definepoly((*obj_id)->value.lval, coords, npoints, (float)(*width)->value.dval); +} +/* }}} */ +  /* {{{ proto void swf_startshape(int objid)     Initialize a new shape with object id, objid */  PHP_FUNCTION(swf_startshape)  | 
