[−][src]Enum piet::PaintBrush
A color or a gradient.
This type is provided as a convenience, so that library consumers can easily write methods and types that use or reference something that can be used as a brush, without needing to know what it is.
Examples
use piet::{Color, PaintBrush, RadialGradient}; use piet::kurbo::Rect; struct Widget { frame: Rect, background: PaintBrush, } fn make_widget<T: Into<PaintBrush>>(frame: Rect, bg: T) -> Widget { Widget { frame, background: bg.into(), } } let color_widget = make_widget(Rect::ZERO, Color::BLACK); let rad_grad = RadialGradient::new(0.8, (Color::WHITE, Color::BLACK)); let gradient_widget = make_widget(Rect::ZERO, rad_grad);
Variants
Color(Color)
Trait Implementations
impl Clone for PaintBrush
[src]
fn clone(&self) -> PaintBrush
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl From<Color> for PaintBrush
[src]
fn from(src: Color) -> PaintBrush
[src]
impl<P: RenderContext> IntoBrush<P> for PaintBrush
[src]
fn make_brush<'a>(
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> P::Brush
[src]
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> P::Brush
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,