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)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Clip
impl<'de> Deserialize<'de> for Clip
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Clip, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Clip, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Clip
impl Serialize for Clip
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Clip
impl StructuralPartialEq for Clip
Auto Trait Implementations§
impl Freeze for Clip
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.