logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use super::*;
mod transform;

pub use transform::{TextureFilter, TextureTransform, TextureWrap};

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Texture {
    Color(Color),
    Image(Image),
    Gradient(Gradient),
}

impl From<Color> for Texture {
    fn from(color: Color) -> Self {
        Self::Color(color)
    }
}

impl From<Image> for Texture {
    fn from(image: Image) -> Self {
        Self::Image(image)
    }
}
impl From<Gradient> for Texture {
    fn from(gradient: Gradient) -> Self {
        Self::Gradient(gradient)
    }
}

impl Default for Texture {
    fn default() -> Self {
        Self::Color(Color::new(0, 0, 0, 0))
    }
}