📄 ming.c
字号:
} else { WRONG_PARAM_COUNT; } convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a ); } else { WRONG_PARAM_COUNT; } if (!fill) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error adding fill to shape"); } /* return an SWFFill object */ ret = zend_list_insert(fill, le_swffillp); object_init_ex(return_value, &fill_class_entry); add_property_resource(return_value, "fill", ret);}/* }}} *//* {{{ proto void swfshape_setleftfill(int arg1 [, int g ,int b [,int a]]) Sets the left side fill style to fill in case only one parameter is passed. When 3 or 4 parameters are passed they are treated as : int r, int g, int b, int a . Solid fill is performed in this case before setting left side fill type. */PHP_FUNCTION(swfshape_setleftfill){ zval **zfill, **r, **g, **b, **a; SWFFill fill; if (ZEND_NUM_ARGS() == 3) { if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff ); } else if (ZEND_NUM_ARGS() == 4) { if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); convert_to_long_ex(a); fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a) ); } else if (ZEND_NUM_ARGS() == 1) { if (zend_get_parameters_ex(1, &zfill) == FAILURE) { WRONG_PARAM_COUNT; } if (Z_LVAL_PP(zfill) != 0) { convert_to_object_ex(zfill); fill = getFill(*zfill TSRMLS_CC); } else { fill = NULL; } } else { WRONG_PARAM_COUNT; } SWFShape_setLeftFill(getShape(getThis() TSRMLS_CC), fill);}/* }}} *//* {{{ proto void swfshape_setleftfill(int arg1 [, int g ,int b [,int a]]) Sets the right side fill style to fill in case only one parameter is passed. When 3 or 4 parameters are passed they are treated as : int r, int g, int b, int a . Solid fill is performed in this case before setting right side fill type. */PHP_FUNCTION(swfshape_setrightfill){ zval **zfill, **r, **g, **b, **a; SWFFill fill; if (ZEND_NUM_ARGS() == 3) { if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff ); } else if (ZEND_NUM_ARGS() == 4) { if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(r); convert_to_long_ex(g); convert_to_long_ex(b); convert_to_long_ex(a); fill = SWFShape_addSolidFill(getShape(getThis() TSRMLS_CC), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a) ); } else if (ZEND_NUM_ARGS() == 1) { if (zend_get_parameters_ex(1, &zfill) == FAILURE) { WRONG_PARAM_COUNT; } if (Z_LVAL_PP(zfill) != 0) { convert_to_object_ex(zfill); fill = getFill(*zfill TSRMLS_CC); } else { fill = NULL; } } else { WRONG_PARAM_COUNT; } SWFShape_setRightFill(getShape(getThis() TSRMLS_CC), fill);}/* }}} *//* {{{ proto void swfshape_movepento(float x, float y) Moves the pen to shape coordinates (x, y) */PHP_FUNCTION(swfshape_movepento){ zval **x, **y; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_movepen(float x, float y) Moves the pen from its current location by vector (x, y) */PHP_FUNCTION(swfshape_movepen){ zval **x, **y; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); SWFShape_movePen(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawlineto(float x, float y) Draws a line from the current pen position to shape coordinates (x, y) in the current line style */PHP_FUNCTION(swfshape_drawlineto){ zval **x, **y; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawline(float dx, float dy) Draws a line from the current pen position (x, y) to the point (x+dx, y+dy) in the current line style */PHP_FUNCTION(swfshape_drawline){ zval **x, **y; if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(x); convert_to_double_ex(y); SWFShape_drawLine(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));}/* }}} *//* {{{ proto void swfshape_drawcurveto(float ax, float ay, float bx, float by [, float dx, float dy]) Draws a curve from the current pen position (x,y) to the point (bx, by) in the current line style, using point (ax, ay) as a control point. Or draws a cubic bezier to point (dx, dy) with control points (ax, ay) and (bx, by) */PHP_FUNCTION(swfshape_drawcurveto){ if (ZEND_NUM_ARGS() == 4) { zval **cx, **cy, **ax, **ay; if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(ax); convert_to_double_ex(ay); SWFShape_drawCurveTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay) ); } else if (ZEND_NUM_ARGS() == 6) { zval **bx, **by, **cx, **cy, **dx, **dy; if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(bx); convert_to_double_ex(by); convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(dx); convert_to_double_ex(dy); RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy)) ); } else { WRONG_PARAM_COUNT; }}/* }}} *//* {{{ proto void swfshape_drawcurve(float adx, float ady, float bdx, float bdy [, float cdx, float cdy]) Draws a curve from the current pen position (x, y) to the point (x+bdx, y+bdy) in the current line style, using point (x+adx, y+ady) as a control point or draws a cubic bezier to point (x+cdx, x+cdy) with control points (x+adx, y+ady) and (x+bdx, y+bdy) */PHP_FUNCTION(swfshape_drawcurve){ if (ZEND_NUM_ARGS() == 4) { zval **cx, **cy, **ax, **ay; if (zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(ax); convert_to_double_ex(ay); SWFShape_drawCurve(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(ax), FLOAT_Z_DVAL_PP(ay) ); } else if (ZEND_NUM_ARGS() == 6) { zval **bx, **by, **cx, **cy, **dx, **dy; if (zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(bx); convert_to_double_ex(by); convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(dx); convert_to_double_ex(dy); RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy)) ); } else { WRONG_PARAM_COUNT; }}/* }}} *//* {{{ proto void swfshape_drawglyph(SWFFont font, string character [, int size]) Draws the first character in the given string into the shape using the glyph definition from the given font */PHP_FUNCTION(swfshape_drawglyph){ zval **font, **c, **zsize; int size=0; if (ZEND_NUM_ARGS() == 2) { if (zend_get_parameters_ex(2, &font, &c) == FAILURE) { WRONG_PARAM_COUNT; } size = (int)(1024.0f/Ming_getScale()); } else if (ZEND_NUM_ARGS() == 3) { if (zend_get_parameters_ex(3, &font, &c, &zsize) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(zsize); size = Z_LVAL_PP(zsize); } convert_to_string_ex(c); SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(*font TSRMLS_CC), Z_STRVAL_PP(c)[0], size);}/* }}} *//* {{{ proto void swfshape_drawcircle(float r) Draws a circle of radius r centered at the current location, in a counter-clockwise fashion */PHP_FUNCTION(swfshape_drawcircle){ zval **r; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &r) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(r); SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r));}/* }}} *//* {{{ proto void swfshape_drawarc(float r, float startAngle, float endAngle) Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured counterclockwise from 12 o'clock */PHP_FUNCTION(swfshape_drawarc){ zval **r, **start, **end; if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &r, &start, &end) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(r); convert_to_double_ex(start); convert_to_double_ex(end); /* convert angles to radians, since that's what php uses elsewhere */ SWFShape_drawArc(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r), (float)(Z_DVAL_PP(start)*M_PI/180.0), (float)(Z_DVAL_PP(end)*M_PI/180.0));}/* }}} *//* {{{ proto void swfshape_drawcubic(float bx, float by, float cx, float cy, float dx, float dy) Draws a cubic bezier curve using the current position and the three given points as control points */PHP_FUNCTION(swfshape_drawcubic){ zval **bx, **by, **cx, **cy, **dx, **dy; if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(bx); convert_to_double_ex(by); convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(dx); convert_to_double_ex(dy); RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy)) );}/* }}} *//* {{{ proto void swfshape_drawcubic(float bx, float by, float cx, float cy, float dx, float dy) Draws a cubic bezier curve using the current position and the three given points as control points */PHP_FUNCTION(swfshape_drawcubicto){ zval **bx, **by, **cx, **cy, **dx, **dy; if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(bx); convert_to_double_ex(by); convert_to_double_ex(cx); convert_to_double_ex(cy); convert_to_double_ex(dx); convert_to_double_ex(dy); RETURN_LONG( SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy)) );}/* }}} *//* }}} *//* {{{ SWFSprite*/static zend_function_entry swfsprite_functions[] = { PHP_FALIAS(swfsprite, swfsprite_init, NULL) PHP_FALIAS(add, swfsprite_add, NULL) PHP_FALIAS(remove, swfsprite_remove, NULL) PHP_FALIAS(nextframe, swfsprite_nextFrame, NULL) PHP_FALIAS(labelframe, swfsprite_labelFrame, NULL) PHP_FALIAS(setframes, swfsprite_setFrames, NULL) { NULL, NULL, NULL }};/* {{{ proto class swfsprite_init(void) Returns a new SWFSprite object */PHP_FUNCTION(swfsprite_init){ SWFMovieClip sprite = newSWFMovieClip(); int ret = zend_list_insert(sprite, le_swfspritep); object_init_ex(getThis(), &sprite_class_entry); add_property_resource(getThis(), "sprite", ret); zend_list_addref(ret);}static void destroy_SWFSprite_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFMovieClip((SWFMovieClip)resource->ptr);}/* }}} *//* {{{ internal function SWFSprite getSprite(zval *id) Returns the SWFSprite object in zval *id */static SWFMovieClip getSprite(zval *id TSRMLS_DC){ void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep TSRMLS_CC); if (!sprite) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFSprite"); } return (SWFMovieClip)sprite;}/* }}} *//* {{{ proto object swfsprite_add(object SWFCharacter) Adds the character to the sprite, returns a displayitem object */PHP_FUNCTION(swfsprite_add){ zval **zchar; int ret; SWFBlock block; SWFDisplayItem item; SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_object_ex(zchar); if (Z_OBJCE_PP(zchar) == &action_class_entry) { block = (SWFBlock)getAction(*zchar TSRMLS_CC); } else { block = (SWFBlock)getCharacter(*zchar TSRMLS_CC); } item = SWFMovieClip_add(sprite, block); if (item != NULL) { /* try and create a displayitem object */ ret = zend_list_insert(item, le_swfdisplayitemp); object_init_ex(return_value, &displayitem_class_entry); add_property_resource(return_value, "displayitem", ret); }}/* }}} *//* {{{ proto void swfsprite_remove(object SWFDisplayItem) Remove the named character from the sprite's display list */PHP_FUNCTION(swfsprite_remove){ zval **zchar; SWFDisplayItem item; SWFMovieClip movie = getSprite(getThis() TSRMLS_CC); if (ZEND_NUM_ARGS() != 1 || zend_get_paramete
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -