pub struct Painter<'a, 'frame> {
pub theme: &'a Theme,
/* private fields */
}Expand description
Paint-only access to the active paint surface, handed to deferred paint closures.
Mirrors the paint surface of RenderCtx: widgets and raw buffer writes,
never the frame itself. Paint deferred inside a modal or popup layer lands
on that layer’s canvas and composites with it.
Fields§
§theme: &'a ThemeThe active theme supplied to Ratcn::render.
Implementations§
Source§impl Painter<'_, '_>
impl Painter<'_, '_>
Sourcepub fn render_widget(&mut self, widget: impl Widget, area: Rect)
pub fn render_widget(&mut self, widget: impl Widget, area: Rect)
Paint a ratatui widget onto the active paint surface.
Sourcepub fn render_stateful_widget<W: StatefulWidget>(
&mut self,
widget: W,
area: Rect,
state: &mut W::State,
)
pub fn render_stateful_widget<W: StatefulWidget>( &mut self, widget: W, area: Rect, state: &mut W::State, )
Paint a ratatui stateful widget onto the active paint surface.
Sourcepub fn with_buffer<R>(&mut self, paint: impl FnOnce(&mut Buffer) -> R) -> R
pub fn with_buffer<R>(&mut self, paint: impl FnOnce(&mut Buffer) -> R) -> R
Run a paint closure over the active paint surface’s raw cell buffer. Inside a layer, the whole layer footprint counts as painted.
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'frame> !UnwindSafe for Painter<'a, 'frame>
impl<'a, 'frame> Freeze for Painter<'a, 'frame>
impl<'a, 'frame> RefUnwindSafe for Painter<'a, 'frame>
impl<'a, 'frame> Send for Painter<'a, 'frame>
impl<'a, 'frame> Sync for Painter<'a, 'frame>
impl<'a, 'frame> Unpin for Painter<'a, 'frame>
impl<'a, 'frame> UnsafeUnpin for Painter<'a, 'frame>
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
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> ⓘ
Converts
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> ⓘ
Converts
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