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 of a stroke.
#[derive(Debug, Clone)]
@ -66,6 +66,15 @@ pub enum StrokeStyle<'a> {
Gradient(&'a Gradient),
}
impl <'a> Into<Shader> for StrokeStyle<'a> {
fn into(self) -> Shader {
match self {
StrokeStyle::Solid(color) => Shader::Solid(color),
StrokeStyle::Gradient(gradient) => gradient.clone().into()
}
}
}
/// The shape used at the end of open subpaths when they are stroked.
#[derive(Debug, Clone, Copy)]
pub enum LineCap {