Struct buffer_graphics_lib::clipping::Clip
source · 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
source§impl Clip
impl Clip
pub fn update_pixel_map(&mut self)
Auto Trait Implementations§
impl RefUnwindSafe for Clip
impl Send for Clip
impl Sync for Clip
impl Unpin for Clip
impl UnwindSafe for Clip
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more