pub struct Canvas {
pub width: u32,
pub height: u32,
pub receivers: Vec<Receiver>,
pub panels: Vec<Panel>,
}Expand description
A complete wall.
Fields§
§width: u32§height: u32§receivers: Vec<Receiver>§panels: Vec<Panel>Implementations§
Source§impl Canvas
impl Canvas
Sourcepub fn single(width: u32, height: u32) -> Self
pub fn single(width: u32, height: u32) -> Self
The common case: a single panel on a single receiver.
Sourcepub fn grid(panel_w: u32, panel_h: u32, cols: u32, rows: u32) -> Self
pub fn grid(panel_w: u32, panel_h: u32, cols: u32, rows: u32) -> Self
A regular grid of identical panels across one receiver.
Sourcepub fn cards(panel_w: u32, panel_h: u32, cols: u32, rows: u32) -> Self
pub fn cards(panel_w: u32, panel_h: u32, cols: u32, rows: u32) -> Self
A regular grid of identical panels, one receiving card per panel, cards numbered row-major from 0.
Sourcepub fn validate(&self) -> Result<(), LayoutError>
pub fn validate(&self) -> Result<(), LayoutError>
Check the description is self-consistent before anything is driven.
§Errors
Reports receivers that fall off the canvas and panels that fall off the canvas, name an unknown receiver, or exceed their receiver’s window.
Sourcepub fn screen_frame(&self) -> Frame
pub fn screen_frame(&self) -> Frame
A black framebuffer the size of the screen.
Sourcepub fn render(&self, src: &Frame) -> Frame
pub fn render(&self, src: &Frame) -> Frame
Map one canvas image onto the screen: each panel’s pixels land where its receiver’s window shows them.
Sourcepub fn render_into(&self, src: &Frame, out: &mut Frame)
pub fn render_into(&self, src: &Frame, out: &mut Frame)
render into a caller-owned screen frame, so a refresh
loop allocates nothing. out is cleared to black and reused when it is
the screen size, replaced otherwise.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Canvas
impl<'de> Deserialize<'de> for Canvas
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Canvas
impl StructuralPartialEq for Canvas
Auto Trait Implementations§
impl Freeze for Canvas
impl RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnsafeUnpin for Canvas
impl UnwindSafe for Canvas
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