Skip to main content

Canvas

Struct Canvas 

Source
pub struct Canvas { /* private fields */ }

Implementations§

Source§

impl Canvas

Source

pub fn new(size: Size) -> Self

Source

pub fn size(&self) -> Size

Source

pub fn measure_text( &self, text: impl AsRef<str>, style: &TextStyle, ) -> TextMetrics

Source

pub fn clear(&mut self, color: Color)

Source

pub fn rect(&mut self, rect: Rect, color: Color)

Source

pub fn round_rect(&mut self, rect: Rect, radius: f32, color: Color)

Source

pub fn line(&mut self, start: Point, end: Point, stroke: Stroke, color: Color)

Source

pub fn circle(&mut self, center: Point, radius: f32, color: Color)

Source

pub fn ellipse( &mut self, center: Point, radius_x: f32, radius_y: f32, color: Color, )

Source

pub fn text( &mut self, position: Point, text: impl Into<String>, style: TextStyle, color: Color, )

Source

pub fn image_placeholder(&mut self, rect: Rect, color: Color)

Source

pub fn clip_rect(&mut self, rect: Rect)

Source

pub fn save(&mut self)

Source

pub fn restore(&mut self)

Source

pub fn translate(&mut self, dx: f32, dy: f32)

Source

pub fn experimental_raw(&mut self, f: impl FnOnce(&mut RawCanvas<'_>))

Source

pub fn into_frame(self) -> RenderFrame

Trait Implementations§

Source§

impl Debug for Canvas

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.