layers::prelude

Struct Layer

Source
#[repr(C)]
pub struct Layer { pub engine: Arc<Engine>, pub id: NodeRef, pub layout_id: NodeId, /* private fields */ }

Fields§

§engine: Arc<Engine>§id: NodeRef§layout_id: NodeId

Implementations§

Source§

impl Layer

Source

pub fn id(&self) -> NodeRef

Source

pub fn set_key(&self, key: impl Into<String>)

Source

pub fn key(&self) -> String

Source

pub fn set_hidden(&self, hidden: bool)

Source

pub fn hidden(&self) -> bool

Source

pub fn set_pointer_events(&self, pointer_events: bool)

Source

pub fn pointer_events(&self) -> bool

Source

pub fn set_position( &self, value: impl Into<Point>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn position(&self) -> Point

Source

pub fn position_value_id(&self) -> usize

Source

pub fn change_position(&self, value: impl Into<Point>) -> AnimatedNodeChange

Source

pub fn set_scale( &self, value: impl Into<Point>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn scale(&self) -> Point

Source

pub fn scale_value_id(&self) -> usize

Source

pub fn change_scale(&self, value: impl Into<Point>) -> AnimatedNodeChange

Source

pub fn set_rotation( &self, value: impl Into<Point3d>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn rotation(&self) -> Point3d

Source

pub fn rotation_value_id(&self) -> usize

Source

pub fn change_rotation(&self, value: impl Into<Point3d>) -> AnimatedNodeChange

Source

pub fn set_anchor_point( &self, value: impl Into<Point>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn anchor_point(&self) -> Point

Source

pub fn anchor_point_value_id(&self) -> usize

Source

pub fn change_anchor_point(&self, value: impl Into<Point>) -> AnimatedNodeChange

Source

pub fn set_opacity( &self, value: impl Into<f32>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn opacity(&self) -> f32

Source

pub fn opacity_value_id(&self) -> usize

Source

pub fn change_opacity(&self, value: impl Into<f32>) -> AnimatedNodeChange

Source

pub fn set_background_color( &self, value: impl Into<PaintColor>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn background_color(&self) -> PaintColor

Source

pub fn background_color_value_id(&self) -> usize

Source

pub fn change_background_color( &self, value: impl Into<PaintColor>, ) -> AnimatedNodeChange

Source

pub fn set_border_corner_radius( &self, value: impl Into<BorderRadius>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn border_corner_radius(&self) -> BorderRadius

Source

pub fn border_corner_radius_value_id(&self) -> usize

Source

pub fn change_border_corner_radius( &self, value: impl Into<BorderRadius>, ) -> AnimatedNodeChange

Source

pub fn set_border_color( &self, value: impl Into<PaintColor>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn border_color(&self) -> PaintColor

Source

pub fn border_color_value_id(&self) -> usize

Source

pub fn change_border_color( &self, value: impl Into<PaintColor>, ) -> AnimatedNodeChange

Source

pub fn set_border_width( &self, value: impl Into<f32>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn border_width(&self) -> f32

Source

pub fn border_width_value_id(&self) -> usize

Source

pub fn change_border_width(&self, value: impl Into<f32>) -> AnimatedNodeChange

Source

pub fn set_shadow_offset( &self, value: impl Into<Point>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn shadow_offset(&self) -> Point

Source

pub fn shadow_offset_value_id(&self) -> usize

Source

pub fn change_shadow_offset( &self, value: impl Into<Point>, ) -> AnimatedNodeChange

Source

pub fn set_shadow_radius( &self, value: impl Into<f32>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn shadow_radius(&self) -> f32

Source

pub fn shadow_radius_value_id(&self) -> usize

Source

pub fn change_shadow_radius(&self, value: impl Into<f32>) -> AnimatedNodeChange

Source

pub fn set_shadow_spread( &self, value: impl Into<f32>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn shadow_spread(&self) -> f32

Source

pub fn shadow_spread_value_id(&self) -> usize

Source

pub fn change_shadow_spread(&self, value: impl Into<f32>) -> AnimatedNodeChange

Source

pub fn set_shadow_color( &self, value: impl Into<Color>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn shadow_color(&self) -> Color

Source

pub fn shadow_color_value_id(&self) -> usize

Source

pub fn change_shadow_color(&self, value: impl Into<Color>) -> AnimatedNodeChange

Source

pub fn set_image_filter_progress( &self, value: impl Into<f32>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn image_filter_progress(&self) -> f32

Source

pub fn image_filter_progress_value_id(&self) -> usize

Source

pub fn change_image_filter_progress( &self, value: impl Into<f32>, ) -> AnimatedNodeChange

Source

pub fn set_clip_content( &self, value: impl Into<bool>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn clip_content(&self) -> bool

Source

pub fn clip_content_value_id(&self) -> usize

Source

pub fn change_clip_content(&self, value: impl Into<bool>) -> AnimatedNodeChange

Source

pub fn set_clip_children( &self, value: impl Into<bool>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn clip_children(&self) -> bool

Source

pub fn clip_children_value_id(&self) -> usize

Source

pub fn change_clip_children(&self, value: impl Into<bool>) -> AnimatedNodeChange

Source

pub fn shape(&self, shape: Shape)

Set a custom shape for this layer.

The shape affects the layer’s visual boundary for rendering, hit-testing, and clipping. By default, layers use Shape::RoundRect with the border_corner_radius attribute.

§Examples
use layers::prelude::*;

// Create a triangle path
let mut path = skia_safe::Path::new();
path.move_to((50.0, 0.0));
path.line_to((100.0, 100.0));
path.line_to((0.0, 100.0));
path.close();

layer.shape(Shape::from_path(&path));
Source

pub fn set_anchor_point_preserving_position( &self, anchor_point: impl Into<Point>, ) -> Point

Sets the anchor point while compensating the position so the layer stays in the same place on screen. Returns the newly applied position.

Source

pub fn change_size(&self, value: Size) -> AnimatedNodeChange

Source

pub fn set_size( &self, value: impl Into<Size>, transition: impl Into<Option<Transition>>, ) -> TransactionRef

Source

pub fn size(&self) -> Size

Source

pub fn get_node_layout_style(&self) -> Style

Source

pub fn set_layout_style(&self, style: Style)

Source

pub fn set_node_layout_size(&self, size: Size)

Source

pub fn node_layout_style(&self) -> Style

Source

pub fn set_draw_content<F: Into<ContentDrawFunction>>(&self, content_handler: F)

Source

pub fn remove_draw_content(&self)

Source

pub fn add_sublayer<'a>( &self, layer: impl Into<&'a NodeRef>, ) -> Result<(), LayerError>

Source

pub fn prepend_sublayer(&self, layer: Layer) -> Result<(), LayerError>

Source

pub fn set_blend_mode(&self, blend_mode: BlendMode)

Source

pub fn set_display(&self, display: Display)

Source

pub fn add_on_pointer_move<F: Into<PointerHandlerFunction>>( &self, handler: F, ) -> usize

Source

pub fn remove_on_pointer_move(&self, handler_id: usize)

Source

pub fn add_on_pointer_in<F: Into<PointerHandlerFunction>>( &self, handler: F, ) -> usize

Source

pub fn remove_on_pointer_in(&self, handler_id: Option<usize>)

Source

pub fn add_on_pointer_out<F: Into<PointerHandlerFunction>>( &self, handler: F, ) -> usize

Source

pub fn remove_on_pointer_out(&self, handler_id: Option<usize>)

Source

pub fn add_on_pointer_press<F: Into<PointerHandlerFunction>>( &self, handler: F, ) -> usize

Source

pub fn remove_on_pointer_press(&self, handler_id: Option<usize>)

Source

pub fn add_on_pointer_release<F: Into<PointerHandlerFunction>>( &self, handler: F, ) -> usize

Source

pub fn remove_on_pointer_release(&self, handler_id: Option<usize>)

Source

pub fn remove_all_pointer_handlers(&self)

Source

pub fn render_layer(&self) -> RenderLayer

Source

pub fn render_position(&self) -> Point

Source

pub fn render_size_transformed(&self) -> Point

Source

pub fn render_size(&self) -> Point

Source

pub fn render_bounds_transformed(&self) -> Rect

Source

pub fn render_bounds_with_children_transformed(&self) -> Rect

Source

pub fn render_bounds_with_children(&self) -> Rect

Source

pub fn cointains_point(&self, point: impl Into<Point>) -> bool

Source

pub fn children_nodes(&self) -> Vec<NodeRef>

Source

pub fn children(&self) -> Vec<Layer>

Source

pub fn set_image_filter(&self, filter: impl Into<Option<ImageFilter>>)

Sets the image filter for this layer.

Source

pub fn image_filter(&self) -> Option<ImageFilter>

Returns the current image filter.

Source

pub fn image_filter_value_id(&self) -> usize

Returns the value ID for the image filter attribute.

Source

pub fn set_color_filter(&self, filter: impl Into<Option<ColorFilter>>)

Sets the color filter for this layer.

Source

pub fn color_filter(&self) -> Option<ColorFilter>

Returns the current color filter.

Source

pub fn color_filter_value_id(&self) -> usize

Returns the value ID for the color filter attribute.

Source

pub fn set_filter_bounds(&self, bounds: impl Into<Option<Rect>>)

Source

pub fn remove(&self)

Source

pub fn set_effect(&self, effect: impl Effect + 'static)

Source

pub fn remove_effect(&self)

Source

pub fn clear_on_change_size_handlers(&self)

Source

pub fn on_change_size<F: Into<TransactionCallback>>(&self, f: F, once: bool)

Source

pub fn set_image_cached(&self, image_cached: bool)

Source

pub fn set_content_opaque(&self, content_opaque: bool)

Declare that the custom draw content fills the entire layer bounds with opaque pixels. This allows occlusion culling to treat the layer as an occluder even when its background color is transparent.

Source

pub fn set_picture_cached(&self, picture_cache: bool)

Source

pub fn add_follower_node(&self, follower: impl Into<NodeRef>)

Source

pub fn remove_follower_node(&self, follower: impl Into<NodeRef>)

Source

pub fn as_content(&self) -> ContentDrawFunction

Source

pub fn redraw(&self)

Trait Implementations§

Source§

impl BuildLayerTree for Layer

Source§

fn build_layer_tree_internal( &self, viewlayer_tree: &LayerTree, cache_viewlayer: &mut HashMap<String, VecDeque<NodeRef>>, )

Source§

fn build_layer_tree(&self, viewlayer_tree: impl AsRef<LayerTree>)

Source§

impl Clone for Layer

Source§

fn clone(&self) -> Layer

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Layer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a Layer> for &'a NodeRef

Source§

fn from(val: &'a Layer) -> Self

Converts to this type from the input type.
Source§

impl From<&Layer> for NodeRef

Source§

fn from(val: &Layer) -> Self

Converts to this type from the input type.
Source§

impl From<Layer> for NodeRef

Source§

fn from(val: Layer) -> Self

Converts to this type from the input type.
Source§

impl From<Layer> for Option<NodeRef>

Source§

fn from(val: Layer) -> Self

Converts to this type from the input type.
Source§

impl Hash for Layer

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Layer

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Layer

Auto Trait Implementations§

§

impl Freeze for Layer

§

impl RefUnwindSafe for Layer

§

impl Send for Layer

§

impl Sync for Layer

§

impl Unpin for Layer

§

impl UnwindSafe for Layer

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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