diff options
| author | 2022-09-29 10:52:58 -0700 | |
|---|---|---|
| committer | 2022-09-29 11:15:35 -0700 | |
| commit | 40f45d7b7e35dd4937abe6b5ce16b6256b4f1eeb (patch) | |
| tree | 38ffc5dd6bae5da4da3b93664dfe27e024dfa261 /graphics/src/widget/canvas/gradient.rs | |
| parent | 97f385e093711c269df315b28f76e66e0220e22a (diff) | |
| download | iced-40f45d7b7e35dd4937abe6b5ce16b6256b4f1eeb.tar.gz iced-40f45d7b7e35dd4937abe6b5ce16b6256b4f1eeb.tar.bz2 iced-40f45d7b7e35dd4937abe6b5ce16b6256b4f1eeb.zip  | |
Adds linear gradient support to 2D meshes in the canvas widget.
Diffstat (limited to 'graphics/src/widget/canvas/gradient.rs')
| -rw-r--r-- | graphics/src/widget/canvas/gradient.rs | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/graphics/src/widget/canvas/gradient.rs b/graphics/src/widget/canvas/gradient.rs new file mode 100644 index 00000000..7d2daabc --- /dev/null +++ b/graphics/src/widget/canvas/gradient.rs @@ -0,0 +1,21 @@ +//! Define a color gradient. +use iced_native::Point; + +pub mod linear; + +pub use linear::Linear; + +/// A gradient that can be used in the style of [`super::Fill`] or [`super::Stroke`]. +#[derive(Debug, Clone)] +pub enum Gradient { +    /// A linear gradient +    Linear(Linear), +    //TODO: radial, conical +} + +impl Gradient { +    /// Creates a new linear [`linear::Builder`]. +    pub fn linear(start: Point, end: Point) -> linear::Builder { +        linear::Builder::new(start, end) +    } +}
\ No newline at end of file  | 
