📄 ming-dev.c
字号:
} } 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), Z_DVAL_PP(x), 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), Z_DVAL_PP(x), 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), Z_DVAL_PP(x), 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), Z_DVAL_PP(x), 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), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(ax), 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), Z_DVAL_PP(bx), Z_DVAL_PP(by), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(dx), 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), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(ax), 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), Z_DVAL_PP(bx), Z_DVAL_PP(by), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(dx), 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 = 1024/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(int 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), Z_DVAL_PP(r));}/* }}} *//* {{{ proto void swfshape_drawarc(int 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), Z_DVAL_PP(r), Z_DVAL_PP(start)*M_PI/180, Z_DVAL_PP(end)*M_PI/180);}/* }}} *//* {{{ 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), Z_DVAL_PP(bx), Z_DVAL_PP(by), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(dx), 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), Z_DVAL_PP(bx), Z_DVAL_PP(by), Z_DVAL_PP(cx), Z_DVAL_PP(cy), Z_DVAL_PP(dx), 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(E_ERROR, "called object is not an SWFSprite!"); } return (SWFMovieClip)sprite;}/* }}} *//* {{{ proto object swfsprite_add(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(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_parameters_ex(1, &zchar) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_object_ex(zchar); item = getDisplayItem(*zchar TSRMLS_CC); SWFMovieClip_remove(movie, item);}/* }}} *//* {{{ proto void swfsprite_nextFrame(void) Moves the sprite to the next frame */PHP_FUNCTION(swfsprite_nextFrame){ SWFMovieClip_nextFrame(getSprite(getThis() TSRMLS_CC));}/* }}} *//* {{{ swfmovie_labelframe*/PHP_FUNCTION(swfsprite_labelFrame){ zval **label; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(label); SWFMovieClip_labelFrame(getSprite(getThis() TSRMLS_CC), Z_STRVAL_PP(label));}/* }}} *//* {{{ proto void swfsprite_setFrames(int frames) Sets the number of frames in this SWFSprite */PHP_FUNCTION(swfsprite_setFrames){ zval **frames; SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &frames) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long_ex(frames); SWFMovieClip_setNumberOfFrames(sprite, Z_LVAL_PP(frames));}/* }}} *//* }}} *//* {{{ SWFText*/static zend_function_entry swftext_functions[] = { PHP_FALIAS(swftext, swftext_init, NULL) PHP_FALIAS(setfont, swftext_setFont, NULL) PHP_FALIAS(setheight, swftext_setHeight, NULL) PHP_FALIAS(setspacing, swftext_setSpacing, NULL) PHP_FALIAS(setcolor, swftext_setColor, NULL) PHP_FALIAS(moveto, swftext_moveTo, NULL) PHP_FALIAS(addstring, swftext_addString, NULL) PHP_FALIAS(getwidth, swftext_getWidth, NULL) PHP_FALIAS(getascent, swftext_getAscent, NULL) PHP_FALIAS(getdescent, swftext_getDescent, NULL) PHP_FALIAS(getleading, swftext_getLeading, NULL) { NULL, NULL, NULL }};/* {{{ proto class swftext_init(void) Returns new SWFText object */PHP_FUNCTION(swftext_init){ SWFText text = newSWFText2(); int ret = zend_list_insert(text, le_swftextp); object_init_ex(getThis(), &text_class_entry); add_property_resource(getThis(), "text", ret); zend_list_addref(ret);}static void destroy_SWFText_resource(zend_rsrc_list_entry *resource TSRMLS_DC){ destroySWFText((SWFText)resource->ptr);}/* }}} *//* {{{ internal function SWFText getText(zval *id) Returns the SWFText contained in zval *id */static SWFText getText(zval *id TSRMLS_DC){ void *text = SWFgetProperty(id, "text", 4, le_swftextp TSRMLS_CC); if (!text) { php_error(E_ERROR, "called object is not an SWFText!"); } return (SWFText)text;}/* }}} *//* {{{ proto void swftext_setFont(class font) Sets this SWFText object's current font to given font */PHP_FUNCTION(swftext_setFont){ zval **zfont; SWFText text = getText(getThis() TSRMLS_CC); SWFFont font; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfont) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_object_ex(zfont); font = getFont(*zfont TSRMLS_CC); SWFText_setFont(text, font);}/* }}} *//* {{{ proto void swftext_setHeight(float height) Sets this SWFText object's current height to given height */PHP_FUNCTION(swftext_setHeight){ zval **height; SWFText text = getText(getThis() TSRMLS_CC); if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_double_ex(height); SWFText_setHeight(text, Z_DVAL_PP(height));}/* }}} *//* {{{ proto void swftext_setSpacing(float spacing) Sets this SWFText object's current letterspacing to given spacing */PHP_FUNCTION(swftext_setSpacing){ zval **spacing; SWFText text = getText(getThis() TSRMLS_CC); if (ZEND_NUM_ARGS(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -