📄 swf.c
字号:
}/* }}} *//* {{{ proto void swf_setfont(int fontid) Sets fontid to the current font */PHP_FUNCTION(swf_setfont){ zval **fontid; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fontid) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(fontid); swf_setfont(Z_LVAL_PP(fontid));}/* }}} *//* {{{ proto void swf_fontsize(float height) Sets the current font's height to the value specified by height */PHP_FUNCTION(swf_fontsize){ zval **height; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(height); swf_fontsize((float)Z_DVAL_PP(height));}/* }}} *//* {{{ proto void swf_fontslant(float slant) Set the current font slant to the angle indicated by slant */PHP_FUNCTION(swf_fontslant){ zval **slant; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &slant) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(slant); swf_fontslant((float)Z_DVAL_PP(slant));}/* }}} *//* {{{ proto void swf_fonttracking(track) Sets the current font tracking to the specified value, track */PHP_FUNCTION(swf_fonttracking){ zval **track; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &track) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(track); swf_fonttracking((float)Z_DVAL_PP(track));}/* }}} *//* {{{ proto array swf_getfontinfo(void) Get information about the current font */PHP_FUNCTION(swf_getfontinfo){ float A_height, x_height; swf_getfontinfo(&A_height, &x_height); if (array_init(return_value) == FAILURE) { php_error(E_WARNING, "Cannot initialize return value from swf_getfontinfo"); RETURN_FALSE; } add_assoc_double(return_value, "Aheight", A_height); add_assoc_double(return_value, "xheight", x_height);}/* }}} *//* {{{ proto void swf_definetext(int objid, string str, int docCenter) defines a text string using the current font, current fontsize and current font slant. If docCenter is 1, the word is centered in x */PHP_FUNCTION(swf_definetext){ zval **objid, **str, **docCenter; if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &objid, &str, &docCenter) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(objid); convert_to_string_ex(str); convert_to_long_ex(docCenter); swf_definetext(Z_LVAL_PP(objid), Z_STRVAL_PP(str), Z_LVAL_PP(docCenter));}/* }}} *//* {{{ proto void swf_textwidth(string str) Calculates the width of a string, str, using the current fontsize & current font */PHP_FUNCTION(swf_textwidth){ zval **str; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(str); RETURN_DOUBLE((double)swf_textwidth(Z_STRVAL_PP(str)));}/* }}} *//* {{{ proto void swf_definebitmap(int objid, string imgname) Defines a bitmap given the name of a .gif .rgb .jpeg or .fi image. The image will be converted into Flash jpeg or Flash color map format */PHP_FUNCTION(swf_definebitmap){ zval **objid, **imgname; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &objid, &imgname) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(objid); convert_to_string_ex(imgname); swf_definebitmap(Z_LVAL_PP(objid), Z_STRVAL_PP(imgname));}/* }}} *//* {{{ proto array swf_getbitmapinfo(int bitmapid) Returns an array of information about a bitmap specified by bitmapid */PHP_FUNCTION(swf_getbitmapinfo){ zval **bitmapid; int size, width, height; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &bitmapid) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(bitmapid); size = swf_getbitmapinfo(Z_LVAL_PP(bitmapid), &width, &height); if (array_init(return_value) == FAILURE) { php_error(E_WARNING, "Cannot initialize return value from swf_getbitmapinfo"); RETURN_FALSE; } add_assoc_long(return_value, "size", size); add_assoc_long(return_value, "width", width); add_assoc_long(return_value, "height", height);}/* }}} *//* {{{ proto void swf_startsymbol(int objid) Create a new symbol with object id, objid */PHP_FUNCTION(swf_startsymbol){ zval **objid; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &objid) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(objid); swf_startsymbol(Z_LVAL_PP(objid));}/* }}} *//* {{{ proto void swf_endsymbol(void) End the current symbol */PHP_FUNCTION(swf_endsymbol){ swf_endsymbol();}/* }}} *//* {{{ proto void swf_startbutton(int objid, int type) Start a button with an object id, objid and a type of either TYPE_MENUBUTTON or TYPE_PUSHBUTTON */PHP_FUNCTION(swf_startbutton){ zval **objid, **type; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &objid, &type) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(objid); convert_to_long_ex(type); swf_startbutton(Z_LVAL_PP(objid), Z_LVAL_PP(type)); /* TYPE_MENUBUTTON, TYPE_PUSHBUTTON */}/* }}} *//* {{{ proto void swf_addbuttonrecord(int state, int objid, int depth) Controls the location, appearance and active area of the current button */PHP_FUNCTION(swf_addbuttonrecord){ zval **state, **objid, **depth; if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &state, &objid, &depth) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(state); convert_to_long_ex(objid); convert_to_long_ex(depth); swf_addbuttonrecord(Z_LVAL_PP(state), Z_LVAL_PP(objid), Z_LVAL_PP(depth));}/* }}} *//* {{{ proto void swf_oncondition(int transitions) Describes a transition used to trigger an action list */PHP_FUNCTION(swf_oncondition){ zval **transitions; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &transitions) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(transitions); swf_oncondition(Z_LVAL_PP(transitions));}/* }}} *//* {{{ proto void swf_endbutton(void) Complete the definition of the current button */PHP_FUNCTION(swf_endbutton){ swf_endbutton();}/* }}} *//* {{{ php_swf_geo_same */void php_swf_geo_same(INTERNAL_FUNCTION_PARAMETERS, int opt){ zval **arg1, **arg2, **arg3, **arg4; if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(arg1); convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); if (opt == 0) { swf_viewport(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4)); } else if (opt == 1) { swf_ortho2(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4)); } else if (opt == 2) { swf_polarview(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4)); } else if (opt == 3) { swf_perspective(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3), Z_DVAL_PP(arg4)); }} /* }}} *//* {{{ proto void swf_viewport(float xmin, float xmax, float ymin, float ymax) Selects an area on the drawing surface for future drawing */PHP_FUNCTION(swf_viewport){ php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);}/* }}} *//* {{{ proto void swf_ortho2(float xmin, float xmax, float ymin, float ymax) Defines a 2-D orthographic mapping of user coordinates onto the current viewport */ PHP_FUNCTION(swf_ortho2){ php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);}/* }}} *//* {{{ proto void swf_ortho(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax) Defines an orthographic mapping of user coordinates onto the current viewport */PHP_FUNCTION(swf_ortho){ zval **xmin, **xmax, **ymin, **ymax, **zmin, **zmax; if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(xmin); convert_to_double_ex(xmax); convert_to_double_ex(ymin); convert_to_double_ex(ymax); convert_to_double_ex(zmin); convert_to_double_ex(zmax); swf_ortho(Z_DVAL_PP(xmin), Z_DVAL_PP(xmax), Z_DVAL_PP(ymin), Z_DVAL_PP(ymax), Z_DVAL_PP(zmin), Z_DVAL_PP(zmax));}/* }}} *//* {{{ proto void swf_polarview(float dist, float azimuth, float incidence, float twist) Defines he viewer's position in polar coordinates */PHP_FUNCTION(swf_polarview){ php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);}/* }}} *//* {{{ proto void swf_perspective(float fovy, float aspect, float near, float far) Define a perspective projection transformation. */PHP_FUNCTION(swf_perspective){ php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);}/* }}} *//* {{{ proto void swf_lookat(float vx, float vy, float vz, float px, float py, float pz, float twist) Defines a viewing transformation by giving the view position vx, vy, vz, and the coordinates of a reference point in the scene at px, py, pz. Twist controls a rotation along the viewer's z axis */PHP_FUNCTION(swf_lookat){ zval **vx, **vy, **vz, **px, **py, **pz, **twist; if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &vx, &vy, &vz, &px, &py, &pz, &twist) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(vx); convert_to_double_ex(vy); convert_to_double_ex(vz); convert_to_double_ex(px); convert_to_double_ex(py); convert_to_double_ex(pz); convert_to_double_ex(twist); swf_lookat(Z_DVAL_PP(vx), Z_DVAL_PP(vy), Z_DVAL_PP(vz), Z_DVAL_PP(px), Z_DVAL_PP(py), Z_DVAL_PP(pz), Z_DVAL_PP(twist));}/* }}} *//* {{{ proto void swf_pushmatrix(void) Push the current transformation matrix onto the stack */PHP_FUNCTION(swf_pushmatrix){ swf_pushmatrix();}/* }}} *//* {{{ proto void swf_popmatrix(void) Restore a previous transformation matrix */PHP_FUNCTION(swf_popmatrix){ swf_popmatrix();}/* }}} *//* {{{ proto void swf_scale(float x, float y, float z) Scale the current transformation */PHP_FUNCTION(swf_scale){ zval **x, **y, **z; if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); convert_to_double_ex(z); swf_scale(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));}/* }}} *//* {{{ proto void swf_translate(float x, float y, float z) Translate the current transformation */PHP_FUNCTION(swf_translate){ zval **x, **y, **z; if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); convert_to_double_ex(z); swf_translate(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));}/* }}} *//* {{{ proto void swf_rotate(float angle, string axis) Rotate the current transformation by the given angle about x, y, or z axis. The axis may be 'x', 'y', or 'z' */PHP_FUNCTION(swf_rotate){ zval **angle, **axis; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &angle, &axis) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(angle); convert_to_string_ex(axis); swf_rotate(Z_DVAL_PP(angle), (char)(Z_STRVAL_PP(axis))[0]);}/* }}} *//* {{{ proto void swf_posround(int doit) This enables or disables rounding of the translation when objects are places or moved */PHP_FUNCTION(swf_posround){ zval **doit; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &doit) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(doit); swf_posround(Z_LVAL_PP(doit));}/* }}} */#endif/* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -