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
impl Design
Sourcepub fn replace(&mut self, renderer: &mut Renderer, scene: Scene)
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.
Sourcepub fn apply(
&mut self,
renderer: &mut Renderer,
edits: &Edits,
) -> Result<Applied, String>
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.
Sourcepub fn patch(
&mut self,
renderer: &mut Renderer,
patch: &Patch,
) -> Result<(), String>
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.
Sourcepub fn draw(
&mut self,
renderer: &mut Renderer,
theme: Theme,
) -> Result<(), &Undrawable>
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.
Sourcepub fn forget(&mut self, theme: Theme)
pub fn forget(&mut self, theme: Theme)
Lets the drawing in theme go: the design isn’t shown in it.
Sourcepub fn problem(&self, theme: Theme) -> Option<&Undrawable>
pub fn problem(&self, theme: Theme) -> Option<&Undrawable>
Why the scene can’t be drawn in theme, when it can’t.
Sourcepub fn take_damage(&mut self) -> Vec<(Theme, Damage)>
pub fn take_damage(&mut self) -> Vec<(Theme, Damage)>
The damage since it was last taken, per theme, in the order it was done.
Sourcepub fn drawing(
&mut self,
renderer: &mut Renderer,
theme: Theme,
) -> Option<&Drawing>
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.
Sourcepub fn area(&mut self, renderer: &mut Renderer, theme: Theme) -> Option<Frame>
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.
Sourcepub fn action_at(
&mut self,
renderer: &mut Renderer,
theme: Theme,
x: f64,
y: f64,
) -> Option<&str>
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.
Sourcepub fn view_tiles(
&mut self,
renderer: &mut Renderer,
theme: Theme,
view: &View,
) -> Vec<(u32, u32)>
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.
Sourcepub fn images(
&mut self,
renderer: &mut Renderer,
theme: Theme,
) -> Option<&[ImageData]>
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.
Sourcepub fn tile(
&mut self,
renderer: &mut Renderer,
theme: Theme,
scale: f64,
col: u32,
row: u32,
) -> Option<&List>
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.
Sourcepub fn strip(
&mut self,
renderer: &mut Renderer,
theme: Theme,
col: u32,
y: u32,
rows: u32,
) -> Option<&List>
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.