get_location_coord(&x2, &y2, ANY_LOC, g.coder ? g.coder->croom : NULL,
SP_COORD_PACK(x2, y2));
+ lua_settop(L, 1);
+ (void) l_selection_clone(L);
+ sel = l_selection_check(L, 1);
selection_do_line(x1, y1, x2, y1, sel);
selection_do_line(x1, y1, x1, y2, sel);
selection_do_line(x2, y1, x2, y2, sel);
selection_do_line(x1, y2, x2, y2, sel);
- lua_settop(L, 1);
return 1;
}
get_location_coord(&x2, &y2, ANY_LOC, g.coder ? g.coder->croom : NULL,
SP_COORD_PACK(x2, y2));
+ lua_settop(L, 1);
+ (void) l_selection_clone(L);
+ sel = l_selection_check(L, 1);
if (x1 == x2) {
for (y = y1; y <= y2; y++)
selection_setpoint(x1, y, sel, 1);
for (y = y1; y <= y2; y++)
selection_do_line(x1, y, x2, y, sel);
}
- lua_settop(L, 1);
return 1;
}
end -- test_sel_line
+function test_sel_rect()
+ local __func__ = "test_sel_rect";
+ local sela = selection.new();
+ local sela_clone = sela:clone();
+
+ local selb = sela:rect(1,1, 3,3);
+ sel_are_equal(sela, sela_clone, __func__);
+ sel_has_n_points(selb, 8, __func__);
+
+ for x = 1,3 do
+ for y = 1,3 do
+ local v = 1;
+ if (x == 2 and y == 2) then v = 0; end;
+ sel_pt_ne(selb, x,y, v, __func__);
+ end
+ end
+end -- test_sel_rect
+
+function test_sel_fillrect()
+ local __func__ = "test_sel_fillrect";
+ local sela = selection.new();
+ local sela_clone = sela:clone();
+
+ local selb = sela:fillrect(1,1, 3,3);
+ sel_are_equal(sela, sela_clone, __func__);
+ sel_has_n_points(selb, 9, __func__);
+
+ for x = 1,3 do
+ for y = 1,3 do
+ sel_pt_ne(selb, x,y, 1, __func__);
+ end
+ end
+end -- test_sel_fillrect
+
test_selection_params();
test_sel_negate();
test_sel_logical_and();
test_sel_logical_xor();
test_sel_filter_percent();
test_sel_line();
+test_sel_rect();
+test_sel_fillrect();