Enum piet::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
A Color
.
Tuple Fields of Color
0: Color
Tuple Fields of Linear
Tuple Fields of Radial
Tuple Fields of Fixed
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
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