guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
elevation.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <utility/graphic/color.hpp>
26
27#include "guillaume/ecs/component.hpp"
28#include "guillaume/theme/tokens.hpp"
29
31{
32
63 {
64 private:
65 float _level { 1.0f };
66 int _layers { 4 };
67 float _spread { 0.0f };
68 utility::graphic::Color32Bit _color {
69 0, 0, 0, 0
70 };
71
72 theme::ElevationLevel _elevationLevel {
74 };
75
76 public:
81 Elevation(void);
82
86 ~Elevation(void) = default;
87
93 float getLevel(void) const;
94
106 Elevation &setLevel(float level);
107
112 int getLayers(void) const;
113
124 Elevation &setLayers(int layers);
125
130 float getSpread(void) const;
131
141 Elevation &setSpread(float spread);
142
148 utility::graphic::Color32Bit getColor(void) const;
149
160 Elevation &setColor(const utility::graphic::Color32Bit &color);
161
176
183
189 bool hasShadow(void) const;
190 };
191
192} // namespace guillaume::components
Elevation & setLayers(int layers)
Set the number of shapes the shadow is made of.
Definition elevation.cpp:86
~Elevation(void)=default
Default destructor for the Elevation component.
float getLevel(void) const
Get the factor applied to the spread.
Definition elevation.cpp:66
float getSpread(void) const
Get how far the shadow reaches beyond the bound.
Definition elevation.cpp:96
bool hasShadow(void) const
Check whether a visible shadow must be painted.
Definition elevation.cpp:61
int getLayers(void) const
Get the number of shapes the shadow is made of.
Definition elevation.cpp:81
Elevation & setElevationLevel(theme::ElevationLevel level)
Resolve the shadow from a Material 3 elevation level.
Definition elevation.cpp:35
Elevation & setLevel(float level)
Set the factor applied to the spread.
Definition elevation.cpp:71
Elevation & setSpread(float spread)
Set how far the shadow reaches beyond the bound.
utility::graphic::Color32Bit getColor(void) const
Get the shadow color.
Elevation & setColor(const utility::graphic::Color32Bit &color)
Set the shadow color.
theme::ElevationLevel getElevationLevel(void) const
Get the level last applied with setElevationLevel().
Definition elevation.cpp:56
Elevation(void)
Construct an elevation resolved from the Level1 token of the active theme. The component starts uncha...
Definition elevation.cpp:29
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
Definition component.hpp:72
State. Every class here is plain data attached to an entity.
ElevationLevel
How far a surface is raised above the background, in six steps.
Definition tokens.hpp:130
@ Level1
Lowest raised level.
Definition tokens.hpp:132