[doc] Magic wand: a visible pixel matches by colour, so a stroke's soft edge goes with it
This commit is contained in:
@@ -55,6 +55,17 @@ fn wand_selects_a_region_and_delete_clears_only_it() {
|
||||
assert!(!m.outline().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wand_and_delete_take_a_stroke_with_its_soft_edge() {
|
||||
let mut r = Raster::new(120, 60);
|
||||
let b = Brush { radius: 8.0, hardness: 0.3, color: [31, 42, 68, 255], opacity: 1.0, erase: false };
|
||||
bitmap::brush(&mut r, &[(10.0, 30.0, 1.0), (110.0, 30.0, 1.0)], &b, None);
|
||||
assert!(r.rgba.chunks_exact(4).any(|p| p[3] > 0 && p[3] < 255), "the stroke has a soft edge");
|
||||
let m = bitmap::region(&r, 60, 30, 24);
|
||||
bitmap::clear(&mut r, Some(&m));
|
||||
assert!(r.rgba.chunks_exact(4).all(|p| p[3] == 0), "pixels of the stroke were left behind");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lasso_and_rect_masks() {
|
||||
let m = Mask::polygon(100, 100, &[(10.0, 10.0), (90.0, 10.0), (10.0, 90.0)]);
|
||||
|
||||
Reference in New Issue
Block a user