Skip to main content

Design

Struct Design 

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

A design’s scene — its one copy — the files it uses, and its drawing in each theme it was asked to draw in.

Implementations§

Source§

impl Design

Source

pub fn new(scene: Scene) -> Design

scene, drawn in no theme yet: every tile of both is stale.

Source

pub fn scene(&self) -> &Scene

The scene.

Source

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

The scene replaced whole — a watch stream sent all of it again. Every tile of both themes is stale, and each drawing is made afresh when next asked for; until one can be, the last good drawing in its theme is what is shown — rounded first where updates left it unrounded, while the scene it shows is still at hand.

Source

pub fn apply( &mut self, renderer: &mut Renderer, edits: &Edits, ) -> Result<Applied, String>

Applies edits to the scene and brings every drawing along by what they did — at the cost of the edits, never the scene’s — or says why they don’t apply, leaving everything as it was. A theme whose scene they leave undrawable has its last good drawing made, from the scene before them: what it shows until a change makes the scene drawable again.

Source

pub fn patch( &mut self, renderer: &mut Renderer, patch: &Patch, ) -> Result<(), String>

Applies a watch stream’s patch: Design::apply with the edits it carries, each image and font file the scene holds already taken from it.

Source

pub fn draw( &mut self, renderer: &mut Renderer, theme: Theme, ) -> Result<(), &Undrawable>

Draws the scene in theme, if it isn’t: made afresh the first time, or after a whole scene — painting the last drawing’s images, in either theme, when it paints the same ones, so the GPU keeps its atlas — or why it can’t be drawn. A scene that couldn’t be drawn isn’t tried again until it changes.

Source

pub fn forget(&mut self, theme: Theme)

Lets the drawing in theme go: the design isn’t shown in it.

Source

pub fn problem(&self, theme: Theme) -> Option<&Undrawable>

Why the scene can’t be drawn in theme, when it can’t.

Source

pub fn take_damage(&mut self) -> Vec<(Theme, Damage)>

The damage since it was last taken, per theme, in the order it was done.

Source

pub fn drawing( &mut self, renderer: &mut Renderer, theme: Theme, ) -> Option<&Drawing>

The drawing shown in theme, drawn if it isn’t — the last good one while the scene can’t be drawn — or None when there is none to show: no scene could be drawn in it yet.

Source

pub fn area(&mut self, renderer: &mut Renderer, theme: Theme) -> Option<Frame>

The shown drawing’s area in theme: its top-left and size, in the design’s coordinates.

Source

pub fn action_at( &mut self, renderer: &mut Renderer, theme: Theme, x: f64, y: f64, ) -> 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 view_tiles( &mut self, renderer: &mut Renderer, theme: Theme, view: &View, ) -> Vec<(u32, u32)>

The tiles view needs at its own zoom’s level, nearest its middle first — of the last good drawing while the scene can’t be drawn.

Source

pub fn images( &mut self, renderer: &mut Renderer, theme: Theme, ) -> Option<&[ImageData]>

The images the shown drawing in theme paints, in the order it first paints them: what the GPU’s atlas holds for it.

Source

pub fn tile( &mut self, renderer: &mut Renderer, theme: Theme, scale: f64, col: u32, row: u32, ) -> Option<&List>

The display list to paint tile (col, row) at scale from, in theme — the last good drawing’s while the scene can’t be drawn.

Source

pub fn strip( &mut self, renderer: &mut Renderer, theme: Theme, col: u32, y: u32, rows: u32, ) -> Option<&List>

The display list to paint a strip of the drawing at 1× from, in theme: tiles::TILE pixels wide at tile column col, rows tall from pixel row y — a piece of a PNG band too wide for whole tiles.

Source

pub fn whole(&mut self, renderer: &mut Renderer, theme: Theme) -> Option<&List>

The display list to paint the whole drawing from, in theme.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Design

§

impl !Sync for Design

§

impl !UnwindSafe for Design

§

impl Freeze for Design

§

impl Send for Design

§

impl Unpin for Design

§

impl UnsafeUnpin for Design

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.