Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub tolerance: f64,
    pub commands: Vec<RenderCommand>,
}
Expand description

A recording of a Scene or Scene Fragment stored as plain data types that can be stored and passed around.

Fields§

§tolerance: f64§commands: Vec<RenderCommand>

Implementations§

Source§

impl Scene

Source

pub fn new() -> Self

Create a new empty

Source

pub fn with_tolerance(tolerance: f64) -> Self

Trait Implementations§

Source§

impl Clone for Scene

Source§

fn clone(&self) -> Scene

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Scene

Source§

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

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

impl Default for Scene

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PaintScene for Scene

Source§

fn reset(&mut self)

Removes all content from the scene
Source§

fn push_layer( &mut self, blend: impl Into<BlendMode>, alpha: f32, transform: Affine, clip: &impl Shape, filter: Option<Arc<Filter>>, backdrop_filter: Option<Arc<Filter>>, )

Pushes a new layer clipped by the specified shape and composed with previous layers using the specified blend mode. Every drawing command after this call will be clipped by the shape until the layer is popped. However, the transforms are not saved or modified by the layer stack.
Source§

fn push_clip_layer(&mut self, transform: Affine, clip: &impl Shape)

Pushes a new clip layer clipped by the specified shape. Every drawing command after this call will be clipped by the shape until the layer is popped. However, the transforms are not saved or modified by the layer stack.
Source§

fn pop_layer(&mut self)

Pops the current layer.
Source§

fn stroke<'a>( &mut self, style: &Stroke, transform: Affine, paint_ref: impl Into<PaintRef<'a>>, brush_transform: Option<Affine>, shape: &impl Shape, )

Strokes a shape using the specified style and brush.
Source§

fn fill<'a>( &mut self, style: Fill, transform: Affine, paint: impl Into<PaintRef<'a>>, brush_transform: Option<Affine>, shape: &impl Shape, )

Fills a shape using the specified style and brush.
Source§

fn draw_glyphs<'a, 's: 'a>( &'a mut self, font: &'a FontData, font_size: f32, hint: bool, normalized_coords: &'a [NormalizedCoord], embolden: Vec2, style: impl Into<StyleRef<'a>>, paint_ref: impl Into<PaintRef<'a>>, brush_alpha: f32, transform: Affine, glyph_transform: Option<Affine>, glyphs: impl Iterator<Item = Glyph>, )

Draws a run of glyphs
Source§

fn draw_box_shadow( &mut self, transform: Affine, rect: Rect, brush: Color, radius: f64, std_dev: f64, )

Draw a rounded rectangle blurred with a gaussian filter.
Source§

fn append_scene(&mut self, scene: Scene, scene_transform: Affine)

Append a recorded Scene Fragment to the current scene
Source§

fn draw_image(&mut self, image: ImageBrushRef<'_>, transform: Affine)

Utility method to draw an image at it’s natural size. For more advanced image drawing use the fill method
Source§

impl PartialEq for Scene

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl RenderContext for Scene

Source§

fn try_register_custom_resource( &mut self, resource: Box<dyn Any>, ) -> Result<ResourceId, RegisterResourceError>

Source§

fn unregister_resource(&mut self, resource_id: ResourceId)

Source§

fn renderer_specific_context(&self) -> Option<Box<dyn Any>>

Return a type-erased context type that is passed to custom widgets in order to enable them to render renderer-specific content
Source§

impl StructuralPartialEq for Scene

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scene

§

impl !UnwindSafe for Scene

§

impl Freeze for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,