Skip to main content

ScreenScene

Struct ScreenScene 

Source
pub struct ScreenScene { /* private fields */ }
Expand description

A bounded 2D scene whose geometry is expressed in logical screen pixels.

The origin is the top-left of the active logical viewport and positive y points downward. Geometry stays fixed while world cameras pan, zoom, rotate, or change pseudo-projection. Physical DPI conversion remains a renderer boundary operation. Gradient coordinates inside a ShapeStyle are also interpreted in this top-left/downward space and converted exactly once at insertion; the same style passed to an ordinary Scene instead uses world coordinates.

Implementations§

Source§

impl ScreenScene

Source

pub fn new(background: Color) -> Result<Self, SceneError>

Creates an explicitly unbounded logical-screen scene.

Source

pub fn with_budget( background: Color, budget: SceneBudget, ) -> Result<Self, SceneError>

Creates a logical-screen scene with explicit work and upload limits.

Source

pub fn background(&self) -> Color

Returns the normalized linear-RGBA clear color.

Source

pub fn set_background(&mut self, background: Color) -> Result<(), SceneError>

Replaces the clear color after normalized-color validation.

Source

pub fn clear(&mut self)

Removes all screen commands and resets their work statistics.

Source

pub const fn budget(&self) -> Option<SceneBudget>

Returns the explicit scene budget, if configured.

Source

pub const fn statistics(&self) -> SceneStatistics

Returns accepted, rejected, and conservatively estimated work.

Source

pub fn command_count(&self) -> usize

Returns the number of accepted screen commands.

Source

pub fn allocation_bytes(&self) -> usize

Returns actual command/polyline allocation bytes retained for reuse.

Source

pub fn set_screen_clip( &mut self, clip: Option<ScreenClipRect>, ) -> Result<Option<ScreenClipRect>, SceneError>

Replaces the logical-screen clip captured by subsequent commands.

Source

pub fn with_screen_clip<R>( &mut self, clip: ScreenClipRect, draw: impl FnOnce(&mut Self) -> R, ) -> Result<R, SceneError>

Draws with a temporary nested logical-screen clip.

Source

pub fn try_circle( &mut self, center: LogicalScreenPosition, radius: LogicalPixels, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a filled/stroked circle in logical screen pixels.

Source

pub fn try_circle_on_layer( &mut self, layer: Layer, center: LogicalScreenPosition, radius: LogicalPixels, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a logical-screen circle to an explicit shared draw layer.

Source

pub fn try_rect( &mut self, min: LogicalScreenPosition, size: LogicalScreenVector, corner_radius: LogicalPixels, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a rectangle from a logical top-left position and positive size.

Source

pub fn try_square_rect( &mut self, min: LogicalScreenPosition, size: LogicalScreenVector, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a square-cornered rectangle from a logical top-left position and positive size.

This entry point represents an exact zero corner radius without weakening LogicalPixels’ strictly-positive length invariant.

Source

pub fn try_rect_on_layer( &mut self, layer: Layer, min: LogicalScreenPosition, size: LogicalScreenVector, corner_radius: LogicalPixels, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a logical-screen rectangle with positive size to a shared layer.

Source

pub fn try_square_rect_on_layer( &mut self, layer: Layer, min: LogicalScreenPosition, size: LogicalScreenVector, style: ShapeStyle, ) -> Result<(), SceneError>

Appends a square-cornered logical-screen rectangle to a shared layer.

Source

pub fn try_line( &mut self, from: LogicalScreenPosition, to: LogicalScreenPosition, width: LogicalPixels, color: Color, ) -> Result<(), SceneError>

Appends a line whose endpoints and width use logical pixels.

Source

pub fn try_line_on_layer( &mut self, layer: Layer, from: LogicalScreenPosition, to: LogicalScreenPosition, width: LogicalPixels, color: Color, ) -> Result<(), SceneError>

Appends a logical-screen line to an explicit shared draw layer.

Source

pub fn try_styled_line( &mut self, from: LogicalScreenPosition, to: LogicalScreenPosition, style: StrokeStyle2d, ) -> Result<(), SceneError>

Appends a logical-screen line with explicit bounded stroke styling.

Source

pub fn try_styled_line_on_layer( &mut self, layer: Layer, from: LogicalScreenPosition, to: LogicalScreenPosition, style: StrokeStyle2d, ) -> Result<(), SceneError>

Appends an explicitly styled logical-screen line to a shared layer.

Source

pub fn try_polyline( &mut self, points: &[LogicalScreenPosition], width: LogicalPixels, color: Color, ) -> Result<(), SceneError>

Appends a connected logical-screen line strip with fallible point copying.

Source

pub fn try_polyline_on_layer( &mut self, layer: Layer, points: &[LogicalScreenPosition], width: LogicalPixels, color: Color, ) -> Result<(), SceneError>

Appends a logical-screen line strip to an explicit shared draw layer.

Source

pub fn try_styled_polyline( &mut self, points: &[LogicalScreenPosition], style: StrokeStyle2d, ) -> Result<(), SceneError>

Appends an explicitly styled logical-screen line strip.

Source

pub fn try_styled_polyline_on_layer( &mut self, layer: Layer, points: &[LogicalScreenPosition], style: StrokeStyle2d, ) -> Result<(), SceneError>

Appends an explicitly styled logical-screen line strip to a shared layer.

Source

pub fn linear_gradient( start: LogicalScreenPosition, end: LogicalScreenPosition, start_color: Color, end_color: Color, ) -> Fill

Creates a linear-gradient fill using typed logical-screen endpoints.

Source

pub fn radial_gradient( center: LogicalScreenPosition, inner_radius: Option<LogicalPixels>, outer_radius: LogicalPixels, inner_color: Color, outer_color: Color, ) -> Fill

Creates a radial-gradient fill centered in logical screen pixels.

Trait Implementations§

Source§

impl Clone for ScreenScene

Source§

fn clone(&self) -> ScreenScene

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 ScreenScene

Source§

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

Formats the value using the given formatter. Read more

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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