pub struct SceneBuilder { /* private fields */ }Expand description
Builds a Scene containing the given visuals.
A Scene can then be rendered using crate::View::present.
To draw graphical operations onto a Scene, first create a Canvas, record into it, and
add the resulting Picture with add_picture. Each push_* opens a
compositing scope that pop closes; unbalanced scopes are a bug the builder
asserts on.
Implementations§
Source§impl SceneBuilder
impl SceneBuilder
Sourcepub fn new() -> SceneBuilder
pub fn new() -> SceneBuilder
Creates an empty SceneBuilder object.
Sourcepub fn push_transform(&mut self, matrix4: &Matrix4)
pub fn push_transform(&mut self, matrix4: &Matrix4)
Pushes a transform operation onto the operation stack.
The objects are transformed by the given matrix before rasterization.
Sourcepub fn push_offset(&mut self, dx: f64, dy: f64)
pub fn push_offset(&mut self, dx: f64, dy: f64)
Pushes an offset operation onto the operation stack.
This is equivalent to push_transform with a matrix with only
translation.
Sourcepub fn push_clip_rect(&mut self, rect: Rect, clip_behavior: Clip)
pub fn push_clip_rect(&mut self, rect: Rect, clip_behavior: Clip)
Pushes a rectangular clip operation onto the operation stack.
Rasterization outside the given rectangle is discarded.
Sourcepub fn push_clip_rrect(&mut self, rrect: RRect, clip_behavior: Clip)
pub fn push_clip_rrect(&mut self, rrect: RRect, clip_behavior: Clip)
Pushes a rounded-rectangular clip operation onto the operation stack.
Rasterization outside the given rounded rectangle is discarded.
Sourcepub fn push_clip_path(&mut self, path: &Arc<Path>, clip_behavior: Clip)
pub fn push_clip_path(&mut self, path: &Arc<Path>, clip_behavior: Clip)
Pushes a path clip operation onto the operation stack.
Rasterization outside the given path is discarded.
Sourcepub fn push_opacity(&mut self, alpha: i32, offset: Offset)
pub fn push_opacity(&mut self, alpha: i32, offset: Offset)
Pushes an opacity operation onto the operation stack.
The given alpha value is blended into the alpha value of the objects’ rasterization. An alpha value of 0 makes the objects entirely invisible. An alpha value of 255 has no effect (i.e., the objects retain the current opacity).
Sourcepub fn push_backdrop_filter(
&mut self,
filter: &ImageFilter,
blend_mode: BlendMode,
backdrop_id: Option<u64>,
)
pub fn push_backdrop_filter( &mut self, filter: &ImageFilter, blend_mode: BlendMode, backdrop_id: Option<u64>, )
Pushes a backdrop filter operation onto the operation stack.
The given filter is applied to the current contents of the scene as far back as the most
recent save layer and rendered back to the scene using the indicated blend_mode prior to
rasterizing the child layers.
Filters sharing a backdrop_id sample one backdrop, as Flutter’s BackdropKey groups
them. valo’s backdrop is a blur: a colour filter in filter contributes nothing (see the
host’s PORTING.md).
Sourcepub fn pop(&mut self)
pub fn pop(&mut self)
Ends the effect of the most recently pushed operation.
§Panics
In debug builds, if nothing is pushed.
Sourcepub fn add_picture(
&mut self,
offset: Offset,
picture: &Arc<Picture>,
is_complex_hint: bool,
will_change_hint: bool,
)
pub fn add_picture( &mut self, offset: Offset, picture: &Arc<Picture>, is_complex_hint: bool, will_change_hint: bool, )
Adds a Picture to the scene.
The picture is rasterized at the given offset. The hints are for a raster cache valo
does not have; they are accepted so a layer can pass what Flutter passes.