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
impl ScreenScene
Sourcepub fn new(background: Color) -> Result<Self, SceneError>
pub fn new(background: Color) -> Result<Self, SceneError>
Creates an explicitly unbounded logical-screen scene.
Sourcepub fn with_budget(
background: Color,
budget: SceneBudget,
) -> Result<Self, SceneError>
pub fn with_budget( background: Color, budget: SceneBudget, ) -> Result<Self, SceneError>
Creates a logical-screen scene with explicit work and upload limits.
Sourcepub fn background(&self) -> Color
pub fn background(&self) -> Color
Returns the normalized linear-RGBA clear color.
Sourcepub fn set_background(&mut self, background: Color) -> Result<(), SceneError>
pub fn set_background(&mut self, background: Color) -> Result<(), SceneError>
Replaces the clear color after normalized-color validation.
Sourcepub const fn budget(&self) -> Option<SceneBudget>
pub const fn budget(&self) -> Option<SceneBudget>
Returns the explicit scene budget, if configured.
Sourcepub const fn statistics(&self) -> SceneStatistics
pub const fn statistics(&self) -> SceneStatistics
Returns accepted, rejected, and conservatively estimated work.
Sourcepub fn command_count(&self) -> usize
pub fn command_count(&self) -> usize
Returns the number of accepted screen commands.
Sourcepub fn allocation_bytes(&self) -> usize
pub fn allocation_bytes(&self) -> usize
Returns actual command/polyline allocation bytes retained for reuse.
Sourcepub fn set_screen_clip(
&mut self,
clip: Option<ScreenClipRect>,
) -> Result<Option<ScreenClipRect>, SceneError>
pub fn set_screen_clip( &mut self, clip: Option<ScreenClipRect>, ) -> Result<Option<ScreenClipRect>, SceneError>
Replaces the logical-screen clip captured by subsequent commands.
Sourcepub fn with_screen_clip<R>(
&mut self,
clip: ScreenClipRect,
draw: impl FnOnce(&mut Self) -> R,
) -> Result<R, SceneError>
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.
Sourcepub fn try_circle(
&mut self,
center: LogicalScreenPosition,
radius: LogicalPixels,
style: ShapeStyle,
) -> Result<(), SceneError>
pub fn try_circle( &mut self, center: LogicalScreenPosition, radius: LogicalPixels, style: ShapeStyle, ) -> Result<(), SceneError>
Appends a filled/stroked circle in logical screen pixels.
Sourcepub fn try_circle_on_layer(
&mut self,
layer: Layer,
center: LogicalScreenPosition,
radius: LogicalPixels,
style: ShapeStyle,
) -> Result<(), SceneError>
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.
Sourcepub fn try_rect(
&mut self,
min: LogicalScreenPosition,
size: LogicalScreenVector,
corner_radius: LogicalPixels,
style: ShapeStyle,
) -> Result<(), SceneError>
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.
Sourcepub fn try_square_rect(
&mut self,
min: LogicalScreenPosition,
size: LogicalScreenVector,
style: ShapeStyle,
) -> Result<(), SceneError>
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.
Sourcepub fn try_rect_on_layer(
&mut self,
layer: Layer,
min: LogicalScreenPosition,
size: LogicalScreenVector,
corner_radius: LogicalPixels,
style: ShapeStyle,
) -> Result<(), SceneError>
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.
Sourcepub fn try_square_rect_on_layer(
&mut self,
layer: Layer,
min: LogicalScreenPosition,
size: LogicalScreenVector,
style: ShapeStyle,
) -> Result<(), SceneError>
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.
Sourcepub fn try_line(
&mut self,
from: LogicalScreenPosition,
to: LogicalScreenPosition,
width: LogicalPixels,
color: Color,
) -> Result<(), SceneError>
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.
Sourcepub fn try_line_on_layer(
&mut self,
layer: Layer,
from: LogicalScreenPosition,
to: LogicalScreenPosition,
width: LogicalPixels,
color: Color,
) -> Result<(), SceneError>
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.
Sourcepub fn try_styled_line(
&mut self,
from: LogicalScreenPosition,
to: LogicalScreenPosition,
style: StrokeStyle2d,
) -> Result<(), SceneError>
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.
Sourcepub fn try_styled_line_on_layer(
&mut self,
layer: Layer,
from: LogicalScreenPosition,
to: LogicalScreenPosition,
style: StrokeStyle2d,
) -> Result<(), SceneError>
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.
Sourcepub fn try_polyline(
&mut self,
points: &[LogicalScreenPosition],
width: LogicalPixels,
color: Color,
) -> Result<(), SceneError>
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.
Sourcepub fn try_polyline_on_layer(
&mut self,
layer: Layer,
points: &[LogicalScreenPosition],
width: LogicalPixels,
color: Color,
) -> Result<(), SceneError>
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.
Sourcepub fn try_styled_polyline(
&mut self,
points: &[LogicalScreenPosition],
style: StrokeStyle2d,
) -> Result<(), SceneError>
pub fn try_styled_polyline( &mut self, points: &[LogicalScreenPosition], style: StrokeStyle2d, ) -> Result<(), SceneError>
Appends an explicitly styled logical-screen line strip.
Sourcepub fn try_styled_polyline_on_layer(
&mut self,
layer: Layer,
points: &[LogicalScreenPosition],
style: StrokeStyle2d,
) -> Result<(), SceneError>
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.
Sourcepub fn linear_gradient(
start: LogicalScreenPosition,
end: LogicalScreenPosition,
start_color: Color,
end_color: Color,
) -> Fill
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.
Sourcepub fn radial_gradient(
center: LogicalScreenPosition,
inner_radius: Option<LogicalPixels>,
outer_radius: LogicalPixels,
inner_color: Color,
outer_color: Color,
) -> Fill
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
impl Clone for ScreenScene
Source§fn clone(&self) -> ScreenScene
fn clone(&self) -> ScreenScene
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more