local s = selection.circle(x,y, radius); */ local s = selection.circle(x, y, radius, filled); */ local s = selection.circle(sel, x, y, radius); */ local s = selection.circle(sel, x, y, radius, filled); */
| 759 | /* local s = selection.circle(sel, x, y, radius); */ |
| 760 | /* local s = selection.circle(sel, x, y, radius, filled); */ |
| 761 | staticfn int |
| 762 | l_selection_circle(lua_State *L) |
| 763 | { |
| 764 | int argc = lua_gettop(L); |
| 765 | struct selectionvar *sel = (struct selectionvar *) 0; |
| 766 | coordxy x = 0, y = 0; |
| 767 | int r = 0, filled = 0; |
| 768 | |
| 769 | if (argc == 3) { |
| 770 | x = (coordxy) luaL_checkinteger(L, 1); |
| 771 | y = (coordxy) luaL_checkinteger(L, 2); |
| 772 | r = (int) luaL_checkinteger(L, 3); |
| 773 | lua_pop(L, 3); |
| 774 | (void) l_selection_new(L); |
| 775 | sel = l_selection_check(L, 1); |
| 776 | filled = 0; |
| 777 | } else if (argc == 4 && lua_type(L, 1) == LUA_TNUMBER) { |
| 778 | x = (coordxy) luaL_checkinteger(L, 1); |
| 779 | y = (coordxy) luaL_checkinteger(L, 2); |
| 780 | r = (int) luaL_checkinteger(L, 3); |
| 781 | filled = (int) luaL_checkinteger(L, 4); /* TODO: boolean*/ |
| 782 | lua_pop(L, 4); |
| 783 | (void) l_selection_new(L); |
| 784 | sel = l_selection_check(L, 1); |
| 785 | } else if (argc == 4 || argc == 5) { |
| 786 | sel = l_selection_check(L, 1); |
| 787 | x = (coordxy) luaL_checkinteger(L, 2); |
| 788 | y = (coordxy) luaL_checkinteger(L, 3); |
| 789 | r = (int) luaL_checkinteger(L, 4); |
| 790 | filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ |
| 791 | } else { |
| 792 | nhl_error(L, "wrong parameters"); |
| 793 | /*NOTREACHED*/ |
| 794 | } |
| 795 | |
| 796 | get_location_coord(&x, &y, ANY_LOC, gc.coder ? gc.coder->croom : NULL, |
| 797 | SP_COORD_PACK(x, y)); |
| 798 | |
| 799 | selection_do_ellipse(sel, x, y, r, r, !filled); |
| 800 | |
| 801 | lua_settop(L, 1); |
| 802 | return 1; |
| 803 | } |
| 804 | |
| 805 | /* local s = selection.ellipse(x, y, radius1, radius2); */ |
| 806 | /* local s = selection.ellipse(x, y, radius1, radius2, filled); */ |
nothing calls this directly
no test coverage detected