Fixed some importing issues since you can use a Shader::Gradient outside a Canvas widget, where it was previously only accessible.

This commit is contained in:
shan 2022-09-30 10:27:00 -07:00
parent e25f3d3dea
commit 5d0fffc626
11 changed files with 126 additions and 148 deletions

View file

@ -1,6 +1,6 @@
use iced_native::Color;
use crate::widget::canvas::Gradient;
use crate::gradient::Gradient;
use crate::shader::Shader;
/// The style used to fill geometry.
#[derive(Debug, Clone)]
@ -48,6 +48,15 @@ pub enum FillStyle<'a> {
Gradient(&'a Gradient),
}
impl <'a> Into<Shader> for FillStyle<'a> {
fn into(self) -> Shader {
match self {
FillStyle::Solid(color) => Shader::Solid(color),
FillStyle::Gradient(gradient) => gradient.clone().into()
}
}
}
/// The fill rule defines how to determine what is inside and what is outside of
/// a shape.
///