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:
parent
e25f3d3dea
commit
5d0fffc626
11 changed files with 126 additions and 148 deletions
|
|
@ -1,8 +1,7 @@
|
|||
//! Supported shaders;
|
||||
|
||||
use crate::{Color, widget};
|
||||
use crate::Color;
|
||||
use crate::gradient::Gradient;
|
||||
use crate::widget::canvas::{FillStyle, StrokeStyle};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
/// Supported shaders for primitives.
|
||||
|
|
@ -13,28 +12,10 @@ pub enum Shader {
|
|||
Gradient(Gradient)
|
||||
}
|
||||
|
||||
impl <'a> Into<Shader> for StrokeStyle<'a> {
|
||||
impl <'a> Into<Shader> for Gradient {
|
||||
fn into(self) -> Shader {
|
||||
match self {
|
||||
StrokeStyle::Solid(color) => Shader::Solid(color),
|
||||
StrokeStyle::Gradient(gradient) => gradient.clone().into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl <'a> Into<Shader> for widget::canvas::Gradient {
|
||||
fn into(self) -> Shader {
|
||||
match self {
|
||||
widget::canvas::Gradient::Linear(linear) => {
|
||||
Gradient::Linear(linear) => {
|
||||
Shader::Gradient(Gradient::Linear(linear))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue