Skip to main content

Drawing

Struct Drawing 

Source
pub struct Drawing {
    pub list: List,
    pub images: Vec<ImageData>,
    /* private fields */
}
Expand description

A scene laid out, in one theme, and made into its display list: kept, so a later scene updates it by what changed. Its layout tree, every node’s box by its id, the property-tree nodes each node made, the list, and the images the list paints.

Fields§

§list: List

The display list: chunks under property trees, and their index.

§images: Vec<ImageData>

Every image the list paints, each under a blob of its own, in the order the list first paints it: what the GPU’s atlas holds for this drawing, placed as crate::atlas::place places them.

Implementations§

Source§

impl Drawing

Source

pub fn area(&self) -> Frame

The design’s drawing: its root’s box plus anything painted outside it, cut by any clipping frame, in whole pixels.

Source

pub fn frames(&self) -> Vec<Frame>

Every node’s box, in tree order, in the design’s coordinates.

Source

pub fn theme(&self) -> Theme

Source

pub fn view_tiles(&self, view: &View) -> Vec<(u32, u32)>

The tiles view needs at its own zoom’s level, nearest its middle first: what a compositor asks to be painted.

Source

pub fn action_at(&self, x: f32, y: f32) -> Option<&str>

The interaction of the topmost node at (x, y) — in the design’s coordinates — that has one, where its clipping frames show it.

Source

pub fn update( &mut self, renderer: &mut Renderer, new: &Scene, applied: &Applied, ) -> Result<Damage, Undrawable>

Updates the drawing to new by the patch that made it: applied, what crate::wire::apply did to the scene the drawing showed — the subtrees removed and placed and the nodes changed, by id. Only those are laid out and painted again, and nodes that only moved keep their chunks — the work is the patch’s, never the scene’s. The damage it returns is what changed; or why new can’t be painted — its images too many for the GPU’s atlas — in which case the drawing is new’s all the same.

Source

pub fn prepare(&mut self, renderer: &mut Renderer, scene: &Scene, area: KRect)

Rounds anew, before area — in the design’s coordinates — is painted, hit or read, the children of runs there that an update moved by a fraction of a pixel: an update moves them by the sums alone and leaves their boxes and chunks as they were, so an edit costs what it changed and the rounding costs what is read. scene is the scene the drawing shows. After it, the drawing there is a fresh one’s, box for box.

Source

pub fn prepare_all(&mut self, renderer: &mut Renderer, scene: &Scene)

Drawing::prepare over the whole drawing.

Source

pub fn update_between( &mut self, renderer: &mut Renderer, old: &mut Scene, new: &Scene, ) -> Result<Damage, Undrawable>

Drawing::update from old, the scene the drawing shows, to the content of new, by the patch between them — old patched to it, keeping its places, so it stays the scene the drawing shows: for a caller holding both.

Trait Implementations§

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<T> ErasedDestructor for T
where T: 'static,

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

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.