23#include "guillaume/components/elevation.hpp"
25#include "guillaume/theme.hpp"
38 const float resolvedLevel =
40 const utility::graphic::Color32Bit color(0, 0, 0, token.shadowAlpha);
44 if (_elevationLevel == level && _level == resolvedLevel
45 && _spread == token.shadowSpread && _color == color) {
48 _elevationLevel = level;
49 _level = resolvedLevel;
50 _spread = token.shadowSpread;
58 return _elevationLevel;
63 return _level > 0.0f && _color.getAlpha() > 0;
73 if (_level == level) {
88 if (_layers == layers) {
103 if (_spread == spread) {
118 if (_color == color) {
Elevation & setLayers(int layers)
Set the number of shapes the shadow is made of.
float getLevel(void) const
Get the factor applied to the spread.
float getSpread(void) const
Get how far the shadow reaches beyond the bound.
bool hasShadow(void) const
Check whether a visible shadow must be painted.
int getLayers(void) const
Get the number of shapes the shadow is made of.
Elevation & setElevationLevel(theme::ElevationLevel level)
Resolve the shadow from a Material 3 elevation level.
Elevation & setLevel(float level)
Set the factor applied to the spread.
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().
Elevation(void)
Construct an elevation resolved from the Level1 token of the active theme. The component starts uncha...
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.
ElevationLevel
How far a surface is raised above the background, in six steps.
@ Level1
Lowest raised level.
@ Level0
Flat: no shadow, no tint.
const theme::ElevationToken & getElevationToken(theme::ElevationLevel level)
Get the shadow and tint the active theme gives to an elevation level.