local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */
| 278 | |
| 279 | /* local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */ |
| 280 | staticfn int |
| 281 | l_selection_and(lua_State *L) |
| 282 | { |
| 283 | int x, y; |
| 284 | struct selectionvar *sela = l_selection_check(L, 1); |
| 285 | struct selectionvar *selb = l_selection_check(L, 2); |
| 286 | struct selectionvar *selr = l_selection_push_new(L); |
| 287 | NhRect rect = cg.zeroNhRect; |
| 288 | |
| 289 | rect_bounds(sela->bounds, selb->bounds, &rect); |
| 290 | |
| 291 | for (x = rect.lx; x <= rect.hx; x++) |
| 292 | for (y = rect.ly; y <= rect.hy; y++) { |
| 293 | int val = (selection_getpoint(x, y, sela) |
| 294 | & selection_getpoint(x, y, selb)); |
| 295 | |
| 296 | selection_setpoint(x, y, selr, val); |
| 297 | } |
| 298 | |
| 299 | lua_remove(L, 1); |
| 300 | lua_remove(L, 1); |
| 301 | return 1; |
| 302 | } |
| 303 | |
| 304 | /* local sel = selection.area(4,5, 40,10) | selection.rect(7,8, 60,14); */ |
| 305 | staticfn int |
nothing calls this directly
no test coverage detected