pub struct Scene { /* private fields */ }Expand description
An ordered display list. Reused between frames to avoid reallocating.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn set_clear_color(&mut self, color: Color)
pub fn set_clear_color(&mut self, color: Color)
Sets the color the frame is cleared to before drawing.
Sourcepub fn clear_color(&self) -> Color
pub fn clear_color(&self) -> Color
Color the frame is cleared to before drawing.
Sourcepub fn push_glyphs(&mut self, run: GlyphRun)
pub fn push_glyphs(&mut self, run: GlyphRun)
Appends a glyph run; empty runs are skipped.
Sourcepub fn push_image(&mut self, image: ImageQuad)
pub fn push_image(&mut self, image: ImageQuad)
Appends an image.
Sourcepub fn push_clip(&mut self, rect: Rect)
pub fn push_clip(&mut self, rect: Rect)
Clips subsequent primitives to rect (intersected with the current clip)
until Scene::pop_clip.
Sourcepub fn pop_clip(&mut self)
pub fn pop_clip(&mut self)
Ends the clip started by the matching Scene::push_clip.
Sourcepub fn apply_effect(
&mut self,
range: Range<usize>,
effect: Effect,
pivot: Point,
)
pub fn apply_effect( &mut self, range: Range<usize>, effect: Effect, pivot: Point, )
Applies effect to a range of primitives, scaling around pivot.
use ravenrs_core::{Color, Effect, Point, Primitive, Quad, Rect, Scene};
let mut scene = Scene::new();
scene.push_quad(Quad::new(Rect::new(0.0, 0.0, 10.0, 10.0), Color::WHITE));
scene.apply_effect(0..1, Effect::moved(5.0, 0.0), Point::ZERO);
let Primitive::Quad(q) = &scene.primitives()[0] else { unreachable!() };
assert_eq!(q.rect.x(), 5.0);Sourcepub fn extend_from_slice(&mut self, primitives: &[Primitive])
pub fn extend_from_slice(&mut self, primitives: &[Primitive])
Appends primitives recorded earlier.
Sourcepub fn primitives(&self) -> &[Primitive]
pub fn primitives(&self) -> &[Primitive]
All primitives in painter’s order.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more