Struct zng::render::FrameUpdate

source ·
pub struct FrameUpdate { /* private fields */ }
Expand description

A frame quick update.

A frame update causes a frame render without needing to fully rebuild the display list. It is a more performant but also more limited way of generating a frame.

Any FrameValueKey used in the creation of the frame can be used for updating the frame.

Implementations§

source§

impl FrameUpdate

source

pub fn new( render_update_widgets: Arc<RenderUpdates>, frame_id: FrameId, root_id: WidgetId, root_bounds: WidgetBoundsInfo, clear_color: Rgba, ) -> FrameUpdate

New frame update builder.

  • render_update_widgets - External update requests.
  • frame_id - Id of the new frame.
  • root_id - Id of the window root widget.
  • root_bounds - Bounds info of the window root widget.
  • clear_color - The current clear color.
source

pub fn frame_id(&self) -> FrameId

Id of the new frame.

source

pub fn is_outer(&self) -> bool

Returns true if the widget inner transform update is still being build.

This is true when inside an update_widget call but false when inside an update_inner call.

source

pub fn transform(&self) -> &PxTransform

Current transform.

source

pub fn set_clear_color(&mut self, color: Rgba)

Change the color used to clear the pixel buffer when redrawing the frame.

source

pub fn auto_hit_test(&self) -> bool

Returns true if all transform updates are also applied to hit-test transforms.

source

pub fn with_auto_hit_test( &mut self, auto_hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )

Runs render_update with auto_hit_test set to a value for the duration of the render call.

source

pub fn is_visible(&self) -> bool

Returns true if view updates are actually collected, if false only transforms and hit-test are updated.

source

pub fn hidden(&mut self, update: impl FnOnce(&mut FrameUpdate))

Calls update with is_visible set to false.

Nodes that set the visibility to Hidden must render using the FrameBuilder::hide method and update using this method.

source

pub fn update_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, )

Update a transform value that does not potentially affect widget bounds.

Use with_transform to update transforms that affect widget bounds.

If hit_test is true the hit-test transform is also updated.

source

pub fn update_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, )

Update a transform value, if there is one.

source

pub fn with_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )

Update a transform that potentially affects widget bounds.

The transform is updated to include this space for the call to the render_update closure. The closure must call render update on child nodes.

If hit_test is true the hit-test transform is also updated.

source

pub fn with_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )

Update a transform that potentially affects widget bounds, if there is one.

The render_update is always called.

source

pub fn with_child( &mut self, offset: Vector2D<Px, Px>, render_update: impl FnOnce(&mut FrameUpdate), )

Calls render_update with an offset that affects the first inner child inner bounds.

Nodes that used FrameBuilder::push_child during render must use this method to update the value.

source

pub fn with_transform_value( &mut self, value: &PxTransform, render_update: impl FnOnce(&mut FrameUpdate), )

Calls render_update while the transform is updated to include the value space.

This is useful for cases where the inner transforms are affected by a value that is only rendered, never updated.

source

pub fn with_inner_transform( &mut self, transform: &PxTransform, render_update: impl FnOnce(&mut FrameUpdate), )

Update the transform applied after the inner bounds translate.

This is only valid if is_outer.

source

pub fn can_reuse_widget(&self) -> bool

If widget update can be skipped by setting reuse in update_widget.

source

pub fn with_no_reuse(&mut self, render_update: impl FnOnce(&mut FrameUpdate))

Calls render_update with can_reuse_widget set to false.

source

pub fn update_widget(&mut self, render_update: impl FnOnce(&mut FrameUpdate))

Update the widget’s outer transform.

If render-update was not requested for the widget and can_reuse_widget only update outer/inner transforms of descendants. If the widget is reused the render_update is not called.

source

pub fn reuse_widget(&mut self)

Update the info transforms of the widget and descendants.

Widgets that did not request render-update can use this method to update only the outer and inner transforms of itself and descendants as those values are global and the parent widget may have changed.

source

pub fn update_inner( &mut self, layout_translation_key: FrameValueKey<PxTransform>, layout_translation_animating: bool, render_update: impl FnOnce(&mut FrameUpdate), )

Update the widget’s inner transform.

The layout_translation_animating affects some webrender caches, see FrameBuilder::push_inner for details.

source

pub fn update_f32(&mut self, new_value: FrameValueUpdate<f32>)

Update a float value.

source

pub fn update_f32_opt(&mut self, new_value: Option<FrameValueUpdate<f32>>)

Update a float value, if there is one.

source

pub fn update_color(&mut self, new_value: FrameValueUpdate<Rgba>)

Update a color value.

See FrameBuilder::push_color for details.

source

pub fn update_color_opt(&mut self, new_value: Option<FrameValueUpdate<Rgba>>)

Update a color value, if there is one.

source

pub fn update_extension_raw( &mut self, extension_id: ApiExtensionId, extension_payload: ApiExtensionPayload, )

Update a custom extension value with custom encoding.

source

pub fn update_extension<T>(&mut self, extension_id: ApiExtensionId, payload: &T)
where T: Serialize,

Update a custom extension value.

source

pub fn parallel_split(&self) -> ParallelBuilder<FrameUpdate>

Create an update builder that can be send to a parallel task and must be folded back into this builder.

This should be called just before the call to update_widget, an error is traced if called inside a widget outer bounds.

source

pub fn parallel_fold(&mut self, split: ParallelBuilder<FrameUpdate>)

Collect updates from split into self.

source

pub fn with_nested_window( &mut self, render_update_widgets: Arc<RenderUpdates>, root_id: WidgetId, root_bounds: WidgetBoundsInfo, update: impl FnOnce(&mut FrameUpdate), )

Calls update to render update a separate nested window on this frame.

source

pub fn render_update_widgets(&self) -> &Arc<RenderUpdates>

External render update requests for this frame.

source

pub fn finalize(self, info_tree: &WidgetInfoTree) -> BuiltFrameUpdate

Finalize the update.

Returns the property updates and the new clear color if any was set.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

source§

impl<T> StateValue for T
where T: Any + Send + Sync,