Enum piet_common::PaintBrush [−][src]
pub enum PaintBrush {
Color(Color),
Linear(LinearGradient),
Radial(RadialGradient),
Fixed(FixedGradient),
}
Expand description
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)
A Color
.
Tuple Fields of Color
0: Color
Linear(LinearGradient)
Tuple Fields of Linear
Radial(RadialGradient)
Tuple Fields of Radial
Fixed(FixedGradient)
Tuple Fields of Fixed
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
pub fn make_brush(
&'a self,
piet: &mut P,
bbox: impl FnOnce() -> Rect
) -> Cow<'a, <P as RenderContext>::Brush>
Auto Trait Implementations
impl RefUnwindSafe for PaintBrush
impl Send for PaintBrush
impl Sync for PaintBrush
impl Unpin for PaintBrush
impl UnwindSafe for PaintBrush
Blanket Implementations
Mutably borrows from an owned value. Read more
Performs the conversion.
Performs the conversion.