Struct flo_canvas::Canvas

source ·
pub struct Canvas { /* private fields */ }
Expand description

A canvas is an abstract interface for drawing graphics. It doesn’t actually provide a means to render anything, but rather a way to describe how things should be drawn and pass those on to a renderer elsewhere.

A canvas can be cloned and sent between threads, so it’s possible for multiple sources to write to the same drawing target.

Canvases maintain a copy of enough of the drawing instructions sent to them to reproduce the rendering on a new render target.

Implementations§

source§

impl Canvas

source

pub fn new() -> Canvas

Creates a new, blank, canvas

source

pub fn write(&self, to_draw: Vec<Draw>)

Sends some new drawing commands to this canvas

source

pub fn draw<FnAction>(&self, action: FnAction)where FnAction: Send + FnOnce(&mut CanvasGraphicsContext<'_>),

Provides a way to draw on this canvas via a GC

source

pub fn stream(&self) -> impl Stream<Item = Draw> + Send

Creates a stream for reading the instructions from this canvas

source

pub fn get_drawing(&self) -> Vec<Draw>

Retrieves the list of drawing actions in this canvas

Trait Implementations§

source§

impl Clone for Canvas

source§

fn clone(&self) -> Canvas

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Drop for Canvas

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.