Enum ElementWithUtils
pub enum ElementWithUtils {
Rect(RectElement),
Svg(SvgElement),
Paragraph(ParagraphElement),
Image(ImageElement),
Label(LabelElement),
}
Variants§
Rect(RectElement)
Svg(SvgElement)
Paragraph(ParagraphElement)
Image(ImageElement)
Label(LabelElement)
Implementations§
§impl ElementWithUtils
impl ElementWithUtils
pub fn get_drawing_area(
&self,
layout_node: &LayoutNode,
node_ref: &NodeRef<'_, CustomAttributeValues>,
layout: &Torin<NodeId>,
scale_factor: f32,
node_style: &StyleState,
transform_state: &TransformState,
) -> Rect<f32, ()>
pub fn get_drawing_area( &self, layout_node: &LayoutNode, node_ref: &NodeRef<'_, CustomAttributeValues>, layout: &Torin<NodeId>, scale_factor: f32, node_style: &StyleState, transform_state: &TransformState, ) -> Rect<f32, ()>
Measure the area that this element once rendered will use. This takes into consideration things like borders and shadows.
pub fn get_drawing_area_if_viewports_allow(
&self,
layout_node: &LayoutNode,
node_ref: &NodeRef<'_, CustomAttributeValues>,
layout: &Torin<NodeId>,
scale_factor: f32,
node_style: &StyleState,
node_viewports: &ViewportState,
transform_state: &TransformState,
) -> Option<Rect<f32, ()>>
pub fn get_drawing_area_if_viewports_allow( &self, layout_node: &LayoutNode, node_ref: &NodeRef<'_, CustomAttributeValues>, layout: &Torin<NodeId>, scale_factor: f32, node_style: &StyleState, node_viewports: &ViewportState, transform_state: &TransformState, ) -> Option<Rect<f32, ()>>
Just like Self::get_drawing_area but only if all the viewports allow the element to be visible.
pub fn needs_cached_drawing_area(
&self,
node_ref: &NodeRef<'_, CustomAttributeValues>,
transform_state: &TransformState,
style_state: &StyleState,
) -> bool
pub fn needs_cached_drawing_area( &self, node_ref: &NodeRef<'_, CustomAttributeValues>, transform_state: &TransformState, style_state: &StyleState, ) -> bool
Check if this element needs its drawing area to be cached in case it needs to be invalidated in the next frame due to potential rotation or scale changes.
pub fn needs_explicit_render(
&self,
node_transform: &TransformState,
node_style: &StyleState,
) -> bool
pub fn needs_explicit_render( &self, node_transform: &TransformState, node_style: &StyleState, ) -> bool
Some elements such as rect
might always need to rerender as Skia doesnt work well with clipped canvases with applied blur.
Trait Implementations§
§impl ElementUtils for ElementWithUtils
impl ElementUtils for ElementWithUtils
fn clip( &self, layout_node: &LayoutNode, node_ref: &NodeRef<'_, CustomAttributeValues>, canvas: &Canvas, scale_factor: f32, )
fn is_point_inside_area( &self, point: &Point2D<f64, ()>, node_ref: &NodeRef<'_, CustomAttributeValues>, layout_node: &LayoutNode, scale_factor: f32, ) -> bool
fn render( self, layout_node: &LayoutNode, node_ref: &NodeRef<'_, CustomAttributeValues>, canvas: &Canvas, font_collection: &mut RCHandle<skia_textlayout_FontCollection>, font_manager: &RCHandle<SkFontMgr>, fallback_fonts: &[String], images_cache: &mut ImagesCache, scale_factor: f32, )
fn element_drawing_area( &self, layout_node: &LayoutNode, node_ref: &NodeRef<'_, CustomAttributeValues>, scale_factor: f32, node_style: &StyleState, ) -> Rect<f32, ()>
§fn element_needs_cached_area(
&self,
node_ref: &NodeRef<'_, CustomAttributeValues>,
style_state: &StyleState,
) -> bool
fn element_needs_cached_area( &self, node_ref: &NodeRef<'_, CustomAttributeValues>, style_state: &StyleState, ) -> bool
Check if this element requires any kind of special caching.
Mainly used for text-like elements with shadows.
See crate::render::CompositorCache.
Default to
false
.Auto Trait Implementations§
impl Freeze for ElementWithUtils
impl RefUnwindSafe for ElementWithUtils
impl Send for ElementWithUtils
impl Sync for ElementWithUtils
impl Unpin for ElementWithUtils
impl UnwindSafe for ElementWithUtils
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
§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>
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>
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)
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)
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
impl<T> DowncastSync for T
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.