|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Turns a ShapeRole into a corner radius in dp, scaled by one "roundness" value. More...
#include <headers/guillaume/theme/tokens.hpp>
Public Member Functions | |
| ShapeScale (void)=default | |
| Create a scale with DefaultRoundness. | |
| float | getRoundness (void) const |
| Get the roundness of the scale. | |
| void | setRoundness (float roundness) |
| Change the roundness, which rescales every role except None and Full. | |
| float | getRadius (ShapeRole role) const |
| Get the corner radius of a role for the current roundness. | |
Static Public Attributes | |
| static constexpr float | FullRadius = 10000.0f |
| Radius returned for ShapeRole::Full, in dp. Renderers clamp radii to half the smallest extent, which yields a pill or a circle. | |
| static constexpr float | DefaultRoundness = 4.0f |
| The roundness for which each role has the radius listed in ShapeRole. | |
Turns a ShapeRole into a corner radius in dp, scaled by one "roundness" value.
The roundness is the single knob of the scale (the name comes from react-native-paper, whose Material 3 themes use 4). Every role scales linearly with it: radius = base * roundness / 4, where base is the value listed in ShapeRole. None stays 0 and Full stays FullRadius whatever the roundness.
Read it through guillaume::getShapeRadius. To make the whole UI squarer or rounder, change the roundness in a copy of the theme:
Definition at line 73 of file tokens.hpp.
| float guillaume::theme::ShapeScale::getRadius | ( | ShapeRole | role | ) | const |
Get the corner radius of a role for the current roundness.
| role | The shape role to resolve. |
| std::out_of_range | When role is ShapeRole::Count. |
Definition at line 55 of file tokens.cpp.
| float guillaume::theme::ShapeScale::getRoundness | ( | void | ) | const |
Get the roundness of the scale.
Definition at line 42 of file tokens.cpp.
| void guillaume::theme::ShapeScale::setRoundness | ( | float | roundness | ) |
Change the roundness, which rescales every role except None and Full.
| roundness | The new roundness. 4 gives the Material 3 radii, 8 doubles them, 0 makes corners square. |
| std::invalid_argument | When roundness is negative. |
Definition at line 47 of file tokens.cpp.
|
staticconstexpr |
The roundness for which each role has the radius listed in ShapeRole.
Definition at line 86 of file tokens.hpp.
|
staticconstexpr |
Radius returned for ShapeRole::Full, in dp. Renderers clamp radii to half the smallest extent, which yields a pill or a circle.
Definition at line 80 of file tokens.hpp.