Skip to main content

SceneNode

Enum SceneNode 

Source
pub enum SceneNode {
    Rect {
        x: f32,
        y: f32,
        w: f32,
        h: f32,
        fill: Color,
        stroke: Option<Color>,
        stroke_width: f32,
        corner_radius: f32,
    },
    Circle {
        cx: f32,
        cy: f32,
        r: f32,
        fill: Color,
        stroke: Option<Color>,
        stroke_width: f32,
    },
    Path {
        d: String,
        fill: Option<Color>,
        stroke: Option<Color>,
        stroke_width: f32,
        opacity: f32,
    },
    Text {
        x: f32,
        y: f32,
        content: String,
        font_size: f32,
        color: Color,
        font_weight: u16,
        font_sources: Vec<String>,
    },
    Image {
        src: String,
        x: f32,
        y: f32,
        w: f32,
        h: f32,
        fit: ImageFit,
        opacity: f32,
    },
    Video {
        src: String,
        time: f64,
        looped: bool,
        x: f32,
        y: f32,
        w: f32,
        h: f32,
        fit: ImageFit,
        opacity: f32,
    },
    Audio {
        track: AudioTrack,
    },
    LinearGradient {
        x: f32,
        y: f32,
        w: f32,
        h: f32,
        angle_deg: f32,
        stops: Vec<GradientStop>,
    },
    RadialGradient {
        cx: f32,
        cy: f32,
        r: f32,
        stops: Vec<GradientStop>,
    },
    Group {
        transform: Transform2D,
        opacity: f32,
        children: Vec<SceneNode>,
    },
    Layer {
        opacity: f32,
        blend_mode: BlendMode,
        clip: Option<ClipRegion>,
        mask: Option<Vec<SceneNode>>,
        mask_mode: MaskMode,
        filters: Vec<SceneFilter>,
        shadow: Option<SceneShadow>,
        children: Vec<SceneNode>,
    },
}
Expand description

A node in the scene graph.

Variants§

§

Rect

Solid-coloured rectangle with optional corner radius.

Fields

§fill: Color
§stroke: Option<Color>
§stroke_width: f32
§corner_radius: f32
§

Circle

Circle.

Fields

§cx: f32
§cy: f32
§fill: Color
§stroke: Option<Color>
§stroke_width: f32
§

Path

Arbitrary SVG path string (M, L, C, Q, Z commands).

Fields

§stroke: Option<Color>
§stroke_width: f32
§opacity: f32
§

Text

Single-line text.

Fields

§content: String
§font_size: f32
§color: Color
§font_weight: u16
§font_sources: Vec<String>

Ordered local TTF/OTF sources. Missing glyphs fall through to the next source and finally the renderer’s system fallback.

§

Image

Local raster image asset. src may be a filesystem path or file:// URI.

Fields

§opacity: f32
§

Video

A decoded frame from a local video file at time seconds.

Fields

§time: f64
§looped: bool

Repeat the video timeline after the source duration.

§opacity: f32
§

Audio

Non-visual audio track collected by the output encoder.

Fields

§

LinearGradient

Linear gradient background covering a rectangle.

Fields

§angle_deg: f32
§

RadialGradient

Radial gradient background.

Fields

§cx: f32
§cy: f32
§

Group

Group with a 2D transform applied to all children.

Fields

§transform: Transform2D
§opacity: f32
§children: Vec<SceneNode>
§

Layer

Offscreen compositing boundary with filters, clipping, masking, shadow, and a destination blend mode.

Fields

§opacity: f32
§blend_mode: BlendMode
§mask_mode: MaskMode
§filters: Vec<SceneFilter>
§children: Vec<SceneNode>

Trait Implementations§

Source§

impl Clone for SceneNode

Source§

fn clone(&self) -> SceneNode

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 SceneNode

Source§

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

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

impl<'de> Deserialize<'de> for SceneNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SceneNode

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for SceneNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SceneNode

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.