Enum druid::piet::PaintBrush
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§
Trait Implementations§
§impl Clone for PaintBrush
impl Clone for PaintBrush
§fn clone(&self) -> PaintBrush
fn clone(&self) -> PaintBrush
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for PaintBrush
impl Debug for PaintBrush
§impl From<Color> for PaintBrush
impl From<Color> for PaintBrush
§fn from(src: Color) -> PaintBrush
fn from(src: Color) -> PaintBrush
Converts to this type from the input type.
§impl From<FixedGradient> for PaintBrush
impl From<FixedGradient> for PaintBrush
§fn from(src: FixedGradient) -> PaintBrush
fn from(src: FixedGradient) -> PaintBrush
Converts to this type from the input type.
§impl From<FixedLinearGradient> for PaintBrush
impl From<FixedLinearGradient> for PaintBrush
§fn from(src: FixedLinearGradient) -> PaintBrush
fn from(src: FixedLinearGradient) -> PaintBrush
Converts to this type from the input type.
§impl From<FixedRadialGradient> for PaintBrush
impl From<FixedRadialGradient> for PaintBrush
§fn from(src: FixedRadialGradient) -> PaintBrush
fn from(src: FixedRadialGradient) -> PaintBrush
Converts to this type from the input type.
§impl From<LinearGradient> for PaintBrush
impl From<LinearGradient> for PaintBrush
§fn from(src: LinearGradient) -> PaintBrush
fn from(src: LinearGradient) -> PaintBrush
Converts to this type from the input type.
source§impl<T> From<PaintBrush> for BackgroundBrush<T>
impl<T> From<PaintBrush> for BackgroundBrush<T>
source§fn from(src: PaintBrush) -> BackgroundBrush<T>
fn from(src: PaintBrush) -> BackgroundBrush<T>
Converts to this type from the input type.
§impl From<RadialGradient> for PaintBrush
impl From<RadialGradient> for PaintBrush
§fn from(src: RadialGradient) -> PaintBrush
fn from(src: RadialGradient) -> PaintBrush
Converts to this type from the input type.
impl<P> IntoBrush<P> for PaintBrushwhere P: RenderContext,
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§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.