Struct PaintParts
pub struct PaintParts { /* private fields */ }Expand description
A self-drawn widget’s draw, split into the parts of a PaintFrame as
it paints: each part is drawn on its own, appended to the scene the
widget paints in, and kept for the comparison with the last frame. A
widget that paints its regions by hand (a timeline, a composer, a side
panel) thereby reports the regions whose drawing changed, without
tracking what each event touched.
Everything the widget paints must be in a part: ink added to the scene
between parts is not compared, so the frame then proves nothing
(Self::finish gives no frame).
Implementations§
§impl PaintParts
impl PaintParts
pub fn new(scene: &Scene) -> PaintParts
pub fn new(scene: &Scene) -> PaintParts
Start splitting the draw into scene, whatever it holds already.
pub fn draw<R>(
&mut self,
scene: &mut Scene,
key: impl Into<Cow<'static, str>>,
bounds: Rect,
draw: impl FnOnce(&mut Scene) -> R,
) -> R
pub fn draw<R>( &mut self, scene: &mut Scene, key: impl Into<Cow<'static, str>>, bounds: Rect, draw: impl FnOnce(&mut Scene) -> R, ) -> R
Draw the part key, whose bounds (logical, as the widget’s rect)
cover every pixel draw paints, antialiasing and shadows included:
a change inside it repaints where it was and is.
pub fn draw_bounded<R>(
&mut self,
scene: &mut Scene,
key: impl Into<Cow<'static, str>>,
draw: impl FnOnce(&mut Scene) -> (Rect, R),
) -> R
pub fn draw_bounded<R>( &mut self, scene: &mut Scene, key: impl Into<Cow<'static, str>>, draw: impl FnOnce(&mut Scene) -> (Rect, R), ) -> R
Self::draw for a part whose bounds its drawing decides (a bar
that measures itself as it paints): draw returns them with its
result.
Auto Trait Implementations§
impl Freeze for PaintParts
impl !RefUnwindSafe for PaintParts
impl Send for PaintParts
impl Sync for PaintParts
impl Unpin for PaintParts
impl UnsafeUnpin for PaintParts
impl !UnwindSafe for PaintParts
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more