pub struct Clip { /* private fields */ }
Expand description
Clip has four modes:
- Nothing - All pixels are valid
- Simple - Only pixels in the shape (rect or circle) are valid
- Custom - User provides a list of which pixels are valid
- Complex - A series of shapes adding and removing clip area
Complex starts with all pixels being valid
- use
add_*
to decrease the valid area - use
remove_*
to increase the valid area
the last shape to touch a pixel determines it’s validity
With complex mode a list of valid pixels is stored internally and each time the complex clip is updated the valid list is updated as well, if you’re making a bulk edit call set_auto_build_map(false)
first
Implementations§
Source§impl Clip
impl Clip
pub fn is_nothing(&self) -> bool
pub fn is_simple(&self) -> bool
pub fn is_complex(&self) -> bool
pub fn is_custom(&self) -> bool
pub fn set_auto_build_map(&mut self, auto_build_map: bool)
Source§impl Clip
impl Clip
Sourcepub fn set_all_valid(&mut self)
pub fn set_all_valid(&mut self)
Clears the clip so all pixels can be drawn to
Sourcepub fn set_valid_rect(&mut self, rect: Rect)
pub fn set_valid_rect(&mut self, rect: Rect)
Set the valid pixels to rect
Sourcepub fn set_valid_circle(&mut self, circle: Circle)
pub fn set_valid_circle(&mut self, circle: Circle)
Set the valid pixels to circle
pub fn get_pixel_map(&mut self) -> Vec<bool>
Source§impl Clip
impl Clip
Sourcepub fn add_rect(&mut self, rect: Rect)
pub fn add_rect(&mut self, rect: Rect)
Set the mode to complex
(clearing any other mode)
Set any pixels in rect
to valid
Sourcepub fn remove_rect(&mut self, rect: Rect)
pub fn remove_rect(&mut self, rect: Rect)
Set the mode to complex
(clearing any other mode)
Set any pixels in rect
to invalid
Sourcepub fn add_circle(&mut self, circle: Circle)
pub fn add_circle(&mut self, circle: Circle)
Set the mode to complex
(clearing any other mode)
Set any pixels in circle
to valid
Sourcepub fn remove_circle(&mut self, circle: Circle)
pub fn remove_circle(&mut self, circle: Circle)
Set the mode to complex
(clearing any other mode)
Set any pixels in circle
to invalid