Skip to main content

OffsetLayerMixin

Trait OffsetLayerMixin 

Source
pub trait OffsetLayerMixin: ContainerLayer {
    // Required methods
    fn offset_layer_data(self: Handle<Self>, app: &App) -> &OffsetLayerData;
    fn offset_layer_data_mut(
        self: Handle<Self>,
        app: &mut App,
    ) -> &mut OffsetLayerData;

    // Provided methods
    fn as_offset_layer(self: Handle<Self>) -> AnyOffsetLayer { ... }
    fn offset(self: Handle<Self>, app: &App) -> Offset { ... }
    fn set_offset(self: Handle<Self>, app: &mut App, value: Offset) { ... }
    fn find_annotations(
        self: Handle<Self>,
        app: &App,
        result: &mut AnnotationSearch,
        local_position: Offset,
        only_first: bool,
    ) -> bool { ... }
    fn apply_transform(
        self: Handle<Self>,
        app: &App,
        child: Option<AnyLayer>,
        transform: &mut Matrix4,
    ) { ... }
    fn add_to_scene(
        self: Handle<Self>,
        app: &mut App,
        builder: &mut SceneBuilder,
    ) { ... }
}
Expand description

A layer that is displayed at an offset from its parent layer.

Offset layers are key to efficient repainting because they are created by repaint boundaries in the RenderObject tree (see RenderObject.isRepaintBoundary). When a render object that is a repaint boundary is asked to paint at given offset in a PaintingContext, the render object first checks whether it needs to repaint itself. If not, it reuses its existing OffsetLayer (and its entire subtree) by mutating its offset property, cutting off the paint walk.

Flutter’s OffsetLayer is a concrete class that TransformLayer, OpacityLayer and ImageFilterLayer extend: the bodies are here, OffsetLayer is the concrete leaf.

Required Methods§

Source

fn offset_layer_data(self: Handle<Self>, app: &App) -> &OffsetLayerData

Mixin field access.

Source

fn offset_layer_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut OffsetLayerData

Provided Methods§

Source

fn as_offset_layer(self: Handle<Self>) -> AnyOffsetLayer

Dart’s implicit upcast of a concrete layer to OffsetLayer.

Source

fn offset(self: Handle<Self>, app: &App) -> Offset

Offset from parent in the parent’s coordinate system.

Source

fn set_offset(self: Handle<Self>, app: &mut App, value: Offset)

See offset.

Source

fn find_annotations( self: Handle<Self>, app: &App, result: &mut AnnotationSearch, local_position: Offset, only_first: bool, ) -> bool

OffsetLayer.findAnnotations.

Source

fn apply_transform( self: Handle<Self>, app: &App, child: Option<AnyLayer>, transform: &mut Matrix4, )

OffsetLayer.applyTransform.

Source

fn add_to_scene(self: Handle<Self>, app: &mut App, builder: &mut SceneBuilder)

OffsetLayer.addToScene.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§