figma_api/models/
paint.rs

1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).  Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15#[serde(untagged)]
16pub enum Paint {
17    SolidPaint(Box<models::SolidPaint>),
18    GradientPaint(Box<models::GradientPaint>),
19    ImagePaint(Box<models::ImagePaint>),
20    PatternPaint(Box<models::PatternPaint>),
21}
22
23impl Default for Paint {
24    fn default() -> Self {
25        Self::SolidPaint(Default::default())
26    }
27}
28/// The string literal \"SOLID\" representing the paint's type. Always check the `type` before reading other properties.
29#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
30pub enum Type {
31    #[serde(rename = "SOLID")]
32    Solid,
33    #[serde(rename = "GRADIENT_LINEAR")]
34    GradientLinear,
35    #[serde(rename = "GRADIENT_RADIAL")]
36    GradientRadial,
37    #[serde(rename = "GRADIENT_ANGULAR")]
38    GradientAngular,
39    #[serde(rename = "GRADIENT_DIAMOND")]
40    GradientDiamond,
41    #[serde(rename = "IMAGE")]
42    Image,
43    #[serde(rename = "PATTERN")]
44    Pattern,
45}
46
47impl Default for Type {
48    fn default() -> Type {
49        Self::Solid
50    }
51}
52/// Image scaling mode.
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum ScaleMode {
55    #[serde(rename = "FILL")]
56    Fill,
57    #[serde(rename = "FIT")]
58    Fit,
59    #[serde(rename = "TILE")]
60    Tile,
61    #[serde(rename = "STRETCH")]
62    Stretch,
63}
64
65impl Default for ScaleMode {
66    fn default() -> ScaleMode {
67        Self::Fill
68    }
69}
70/// The tile type for the pattern
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum TileType {
73    #[serde(rename = "RECTANGULAR")]
74    Rectangular,
75    #[serde(rename = "HORIZONTAL_HEXAGONAL")]
76    HorizontalHexagonal,
77    #[serde(rename = "VERTICAL_HEXAGONAL")]
78    VerticalHexagonal,
79}
80
81impl Default for TileType {
82    fn default() -> TileType {
83        Self::Rectangular
84    }
85}
86/// The horizontal alignment for the pattern
87#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
88pub enum HorizontalAlignment {
89    #[serde(rename = "START")]
90    Start,
91    #[serde(rename = "CENTER")]
92    Center,
93    #[serde(rename = "END")]
94    End,
95}
96
97impl Default for HorizontalAlignment {
98    fn default() -> HorizontalAlignment {
99        Self::Start
100    }
101}
102/// The vertical alignment for the pattern
103#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
104pub enum VerticalAlignment {
105    #[serde(rename = "START")]
106    Start,
107    #[serde(rename = "CENTER")]
108    Center,
109    #[serde(rename = "END")]
110    End,
111}
112
113impl Default for VerticalAlignment {
114    fn default() -> VerticalAlignment {
115        Self::Start
116    }
117}
118