pub struct DrawingTarget { /* private fields */ }
Expand description

A drawing target sends drawing instructions to a DrawStream

flo_draw provides two structures for sending drawing instructions to other part of the application. DrawingTarget is used when the instructions do not need to be retained: eg, when rendering to a window or to an offscreen target.

See Canvas for a structure that can store drawing instructions as well as send them to a target.

Implementations§

source§

impl DrawingTarget

source

pub fn new() -> (DrawingTarget, DrawStream)

Creates a new drawing target and a stream that can be used to read the instructions sent to it

source

pub fn write<Drawing: Send + IntoIterator<Item = Draw>>(&self, drawing: Drawing)

Sends some drawing instructions to this target

source

pub fn draw<FnAction>(&self, action: FnAction)where FnAction: Send + FnOnce(&mut Vec<Draw>),

Provides a way to draw on this target via a graphics context

source

pub fn receive<DrawStream: Unpin + Stream<Item = Draw>>( self, actions: DrawStream ) -> impl Future

Sends the results of a future to this target

Trait Implementations§

source§

impl Clone for DrawingTarget

A drawing context can be cloned in order to create multiple sources for a single drawing target.

This is particularly useful when combined with layers: multiple threads can draw to different layers without interfering with each other, so it’s possible to design renderers where the rendering instructions have multiple sources (see the mandelbrot example for an example of where this is used)

source§

fn clone(&self) -> DrawingTarget

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 DrawingTarget

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.