|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Soft shadow drawn around an elevated surface. More...
#include <headers/guillaume/components/elevation.hpp>


Public Member Functions | |
| Elevation (void) | |
| Construct an elevation resolved from the Level1 token of the active theme. The component starts unchanged. | |
| ~Elevation (void)=default | |
| Default destructor for the Elevation component. | |
| float | getLevel (void) const |
| Get the factor applied to the spread. | |
| Elevation & | setLevel (float level) |
| Set the factor applied to the spread. | |
| int | getLayers (void) const |
| Get the number of shapes the shadow is made of. | |
| Elevation & | setLayers (int layers) |
| Set the number of shapes the shadow is made of. | |
| float | getSpread (void) const |
| Get how far the shadow reaches beyond the bound. | |
| 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. | |
| Elevation & | setElevationLevel (theme::ElevationLevel level) |
| Resolve the shadow from a Material 3 elevation level. | |
| theme::ElevationLevel | getElevationLevel (void) const |
| Get the level last applied with setElevationLevel(). | |
| bool | hasShadow (void) const |
| Check whether a visible shadow must be painted. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
Soft shadow drawn around an elevated surface.
systems::ElevationRender (Render phase) reads it with the entity's Transform and Bound. It draws getLayers() rounded shapes centered on the bound: layer i (from 1 to the layer count) is larger than the bound by spread * level * i / layers on every side and its alpha is the shadow alpha times 1 - i / layers, which approximates a blurred shadow.
The usual way to set it is setElevationLevel(), which resolves the spread and the opacity from the elevation scale of the active theme. Widget systems do so for their surfaces (systems::SurfaceTone, systems::Card, the button systems, ...); setLevel(), setSpread() and setColor() then adjust one value, for example while animating between two levels.
Definition at line 62 of file elevation.hpp.
| guillaume::components::Elevation::Elevation | ( | void | ) |
Construct an elevation resolved from the Level1 token of the active theme. The component starts unchanged.
Definition at line 29 of file elevation.cpp.


| utility::graphic::Color32Bit guillaume::components::Elevation::getColor | ( | void | ) | const |
Get the shadow color.
Definition at line 111 of file elevation.cpp.
| theme::ElevationLevel guillaume::components::Elevation::getElevationLevel | ( | void | ) | const |
Get the level last applied with setElevationLevel().
Definition at line 56 of file elevation.cpp.
| int guillaume::components::Elevation::getLayers | ( | void | ) | const |
Get the number of shapes the shadow is made of.
Definition at line 81 of file elevation.cpp.
| float guillaume::components::Elevation::getLevel | ( | void | ) | const |
Get the factor applied to the spread.
Definition at line 66 of file elevation.cpp.
| float guillaume::components::Elevation::getSpread | ( | void | ) | const |
Get how far the shadow reaches beyond the bound.
Definition at line 96 of file elevation.cpp.
| bool guillaume::components::Elevation::hasShadow | ( | void | ) | const |
Check whether a visible shadow must be painted.
Definition at line 61 of file elevation.cpp.
| Elevation & guillaume::components::Elevation::setColor | ( | const utility::graphic::Color32Bit & | color | ) |
Set the shadow color.
Marks the component changed only when the color differs. setElevationLevel() replaces it with black at the token's opacity.
| color | The color; an alpha of 0 paints no shadow. |
Definition at line 116 of file elevation.cpp.

| Elevation & guillaume::components::Elevation::setElevationLevel | ( | theme::ElevationLevel | level | ) |
Resolve the shadow from a Material 3 elevation level.
Reads the token of level in the active theme and writes three values: the level factor (0 for Level0, 1 otherwise), the spread and the color (black at the token's opacity). Level0 therefore paints no shadow. The component is marked changed only when one of the resolved values differs, so calling it every frame is cheap and still picks up a theme change.
| level | The Material 3 elevation level. |
Definition at line 35 of file elevation.cpp.


| Elevation & guillaume::components::Elevation::setLayers | ( | int | layers | ) |
Set the number of shapes the shadow is made of.
More layers give a smoother fade for more triangles. Marks the component changed only when the value differs.
| layers | The layer count; systems::ElevationRender draws at least 1 layer whatever the value. |
Definition at line 86 of file elevation.cpp.

| Elevation & guillaume::components::Elevation::setLevel | ( | float | level | ) |
Set the factor applied to the spread.
The shadow reaches spread * level dp beyond the bound. This is a plain multiplier, not a theme::ElevationLevel; to pick a Material level use setElevationLevel(). Marks the component changed only when the value differs.
| level | The factor; 0 or less paints no shadow. |
Definition at line 71 of file elevation.cpp.

| Elevation & guillaume::components::Elevation::setSpread | ( | float | spread | ) |
Set how far the shadow reaches beyond the bound.
Marks the component changed only when the value differs. setElevationLevel() replaces it with the token's spread.
| spread | The spread, in dp, for a level factor of 1. |
Definition at line 101 of file elevation.cpp.
