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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#ifndef LLMR_STYLE_STYLE_PROPERTIES
#define LLMR_STYLE_STYLE_PROPERTIES
#include <llmr/util/variant.hpp>
#include <llmr/style/types.hpp>
#include <llmr/style/function_properties.hpp>
#include <array>
#include <string>
#include <type_traits>
#include <memory>
namespace llmr {
struct FillProperties {
FillProperties() {}
bool antialias = true;
float opacity = 1.0f;
Color fill_color = {{ 0, 0, 0, 1 }};
Color stroke_color = {{ 0, 0, 0, -1 }};
std::array<float, 2> translate = {{ 0, 0 }};
TranslateAnchorType translateAnchor = TranslateAnchorType::Default;
std::string image;
inline bool isVisible() const {
return opacity > 0 && (fill_color[3] > 0 || stroke_color[3] > 0);
}
};
struct LineProperties {
inline LineProperties() {}
float opacity = 1.0f;
Color color = {{ 0, 0, 0, 1 }};
std::array<float, 2> translate = {{ 0, 0 }};
TranslateAnchorType translateAnchor = TranslateAnchorType::Default;
float width = 0;
float offset = 0;
float blur = 0;
std::array<float, 2> dash_array = {{ 1, -1 }};
std::string image;
inline bool isVisible() const {
return opacity > 0 && color[3] > 0 && width > 0;
}
};
struct IconProperties {
inline IconProperties() {}
float opacity = 1.0f;
float rotate = 0.0f;
RotateAnchorType rotate_anchor = RotateAnchorType::Default;
inline bool isVisible() const {
return opacity > 0;
}
};
struct TextProperties {
inline TextProperties() {}
float opacity = 1.0f;
float size = 12.0f;
Color color = {{ 0, 0, 0, 1 }};
Color halo_color = {{ 1, 1, 1, 0.75 }};
float halo_width = 0.25f;
float halo_blur = 1.0f;
inline bool isVisible() const {
return opacity > 0 && (color[3] > 0 || halo_color[3] > 0) && size > 0;
}
};
struct CompositeProperties {
inline CompositeProperties() {}
float opacity = 1.0f;
inline bool isVisible() const {
return opacity > 0;
}
};
struct RasterProperties {
inline RasterProperties() {}
float opacity = 1.0f;
float spin = 0.0f;
std::array<float, 2> brightness = {{ 0, 1 }};
float saturation = 0.0f;
float contrast = 0.0f;
float fade = 0.0f;
inline bool isVisible() const {
return opacity > 0;
}
};
struct BackgroundProperties {
inline BackgroundProperties() {}
Color color = {{ 1, 1, 1, 1 }};
};
typedef util::variant<
FillProperties,
LineProperties,
IconProperties,
TextProperties,
CompositeProperties,
RasterProperties,
BackgroundProperties,
std::false_type
> StyleProperties;
template <typename T>
const T &defaultStyleProperties();
}
#endif
|