Struct ShotFrame
pub struct ShotFrame {
pub state: State,
pub theme: Theme,
pub text: TextRenderer,
pub presence: PresenceCtx,
pub permission: PermissionContext,
/* private fields */
}Expand description
The document, theme, text renderer and layout tree of one offscreen frame.
Fields§
§state: StateDocument the widget syncs from. Seed it before ShotFrame::sync.
theme: ThemeTheme passed to layout and every draw pass.
text: TextRendererText renderer shared by measurement and drawing.
presence: PresenceCtxPresence passed to the draw passes; empty unless a shot stages peers.
permission: PermissionContextPermission context scoped around the root draw.
Implementations§
§impl ShotFrame
impl ShotFrame
pub fn new(viewport: (u32, u32), theme: Theme) -> ShotFrame
pub fn new(viewport: (u32, u32), theme: Theme) -> ShotFrame
A frame at viewport with a fresh document, the theme’s text scale
applied to the text renderer, and settled layout. Its PNG lands on the
window ground (surfaces.content), as a live window clears.
pub fn with_state(self, state: State) -> ShotFrame
pub fn with_state(self, state: State) -> ShotFrame
Replace the document the widget syncs from.
pub fn sync(&mut self, widget: &mut dyn Widget)
pub fn sync(&mut self, widget: &mut dyn Widget)
Pull the widget’s visual state from ShotFrame::state.
pub fn layout(
&mut self,
widget: &mut dyn Widget,
) -> Result<(), WidgetLayoutError>
pub fn layout( &mut self, widget: &mut dyn Widget, ) -> Result<(), WidgetLayoutError>
Build a fresh layout tree for the widget inside a viewport-sized root, resolve it, and apply the result.
§Errors
Returns the solver’s error when Taffy rejects the tree or allocation dependent styles do not settle.
pub fn layout_at(
&mut self,
widget: &mut dyn Widget,
_: (u32, u32),
) -> Result<(), WidgetLayoutError>
pub fn layout_at( &mut self, widget: &mut dyn Widget, _: (u32, u32), ) -> Result<(), WidgetLayoutError>
ShotFrame::layout at a viewport other than the frame’s own, to
simulate the window size a widget saw before a resize.
§Errors
pub fn layout_parts(&mut self) -> Option<(&mut State, &TaffyTree, NodeId)>
pub fn layout_parts(&mut self) -> Option<(&mut State, &TaffyTree, NodeId)>
The document, the layout tree of the last ShotFrame::layout and the
widget’s node in it, for scenarios that stage input against laid-out
geometry.
pub fn draw(&mut self, widget: &mut dyn Widget) -> Scene
pub fn draw(&mut self, widget: &mut dyn Widget) -> Scene
Paint the widget’s main pass into a new scene, culled against the frame’s window as a live host culls.
pub fn draw_overlay(&mut self, widget: &mut dyn Widget, scene: &mut Scene)
pub fn draw_overlay(&mut self, widget: &mut dyn Widget, scene: &mut Scene)
Composite the widget’s top layer (open menus, popovers, modals) onto
scene over the frame’s window, as the live host does after the main
pass and the window chrome.
pub fn draw_floating_surfaces(
&mut self,
widget: &mut dyn Widget,
scene: &mut Scene,
)
pub fn draw_floating_surfaces( &mut self, widget: &mut dyn Widget, scene: &mut Scene, )
Paint app-owned floating surfaces onto scene, in the order the live
compositor stacks them above the window.
Auto Trait Implementations§
impl !Freeze for ShotFrame
impl !RefUnwindSafe for ShotFrame
impl !Send for ShotFrame
impl !Sync for ShotFrame
impl Unpin for ShotFrame
impl UnsafeUnpin for ShotFrame
impl !UnwindSafe for ShotFrame
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> 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