diff options
Diffstat (limited to 'graphics/src/gradient.rs')
-rw-r--r-- | graphics/src/gradient.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/graphics/src/gradient.rs b/graphics/src/gradient.rs new file mode 100644 index 00000000..da0f911d --- /dev/null +++ b/graphics/src/gradient.rs @@ -0,0 +1,30 @@ +//! For creating a Gradient. +mod linear; + +pub use crate::gradient::linear::{Linear, Location, Position}; +use crate::Color; + +#[derive(Debug, Clone, PartialEq)] +/// A fill which transitions colors progressively along a direction, either linearly, radially (TBD), +/// or conically (TBD). +pub enum Gradient { + /// A linear gradient interpolates colors along a direction from its [`start`] to its [`end`] + /// point. + Linear(Linear), +} + +#[derive(Debug, Clone, Copy, PartialEq)] +/// A point along the gradient vector where the specified [`color`] is unmixed. +pub struct ColorStop { + /// Offset along the gradient vector. + pub offset: f32, + /// The color of the gradient at the specified [`offset`]. + pub color: Color, +} + +impl Gradient { + /// Creates a new linear [`linear::Builder`]. + pub fn linear(position: impl Into<Position>) -> linear::Builder { + linear::Builder::new(position.into()) + } +} |