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> ⓘ
pub fn fill( &mut self, x1: f32, y1: f32, x2: f32, y2: f32, top: u32, bottom: u32, )
Sourcepub fn text(
&mut self,
text: &str,
font: &str,
x: f32,
y: f32,
color: u32,
shadow: bool,
)
pub fn text( &mut self, text: &str, font: &str, x: f32, y: f32, color: u32, shadow: bool, )
Font.drawInBatch: the shadow pass (offset, color / 4), then the text.
Sourcepub fn text_scaled(
&mut self,
text: &str,
font: &str,
x: f32,
y: f32,
k: f32,
color: u32,
shadow: bool,
)
pub fn text_scaled( &mut self, text: &str, font: &str, x: f32, y: f32, k: f32, color: u32, shadow: bool, )
Self::text k times its size (the host scales the pose: no
rounding to whole pixels).
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