pub struct Canvas<'r> {
pub w: u32,
pub h: u32,
pub rgba: Vec<u8>,
/* private fields */
}Expand description
An RGBA canvas w × h physical pixels.
Fields§
§w: u32§h: u32§rgba: Vec<u8>Implementations§
Source§impl<'r> Canvas<'r>
impl<'r> Canvas<'r>
pub fn new(gui_w: u32, gui_h: u32, scale: u32, res: &'r Resources) -> Self
pub fn font(&mut self, id: &str) -> Arc<Font> ⓘ
Sourcepub fn fill(&mut self, [x1, y1, x2, y2]: [f32; 4], top: u32, bottom: u32)
pub fn fill(&mut self, [x1, y1, x2, y2]: [f32; 4], top: u32, bottom: u32)
Fills [x1, y1, x2, y2] (GUI pixels), top’s colour fading to bottom’s.
Sourcepub fn text(&mut self, text: &str, at: [f32; 2], style: &TextStyle<'_>)
pub fn text(&mut self, text: &str, at: [f32; 2], style: &TextStyle<'_>)
Font.drawInBatch: the shadow pass (offset, color / 4), then the
text, at whole pixels (at’s rounded down) — scaled, the host scales
the pose: no rounding.
pub fn draw(&mut self, op: &DrawOp)
pub fn png(&self) -> Result<Vec<u8>, String>
Auto Trait Implementations§
impl<'r> Freeze for Canvas<'r>
impl<'r> RefUnwindSafe for Canvas<'r>
impl<'r> Send for Canvas<'r>
impl<'r> Sync for Canvas<'r>
impl<'r> Unpin for Canvas<'r>
impl<'r> UnsafeUnpin for Canvas<'r>
impl<'r> UnwindSafe for Canvas<'r>
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