Skip to main content

Draw

Struct Draw 

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

Implementations§

Source§

impl Draw

Source

pub fn fill(&mut self, shape: Shape, paint: impl Into<Paint>)

Fill a shape with a solid color or a [LinearGradient] (both convert to Paint; gradient unit points resolve against the shape’s bounding box — docs/shapes.md §3.2).

Source

pub fn stroke(&mut self, shape: Shape, color: Color, width: f64)

Source

pub fn text(&mut self, text: &str, at: Point, style: TextStyle)

Source

pub fn save(&mut self)

Save the current transform/clip; pair with Draw::restore.

Source

pub fn restore(&mut self)

Restore the transform/clip saved by the matching Draw::save.

Source

pub fn concat(&mut self, m: Affine)

Multiply an affine onto the current transform (shape rotate/scale/offset, §11).

Source

pub fn transformed(&mut self, m: Affine, f: impl FnOnce(&mut Draw))

Draw within m applied to the CTM, restoring afterwards.

Auto Trait Implementations§

§

impl Freeze for Draw

§

impl RefUnwindSafe for Draw

§

impl Send for Draw

§

impl Sync for Draw

§

impl Unpin for Draw

§

impl UnsafeUnpin for Draw

§

impl UnwindSafe for Draw

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
§

impl<T> ErasedDestructor for T
where T: 'static,

Day API ↩ Guides· daybrite.dev