|
aest 0.1.0
Collection of C++ utility libraries
|
Partition aest.colors:random: random colors drawn from a caller-supplied random bit generator. More...
Go to the source code of this file.
Concepts | |
| concept | aest::colors::RandomBitGenerator |
| A uniform random bit generator whose every output bit is random: its range is a power of two, of at least 2^24. | |
Functions | |
| template<RandomBitGenerator Generator> | |
| constexpr float | aest::colors::unit_float (Generator &generator) |
| Draw a float uniformly distributed in [0, 1). | |
| template<BoundedRGBSpace Space = SRGB, RandomBitGenerator Generator> | |
| constexpr Space | aest::colors::random_color (Generator &generator) |
| A random opaque color, uniform over the channels of an encoded RGB space. | |
| template<HueSpace Space = OKLCH, ColorType Color, RandomBitGenerator Generator> requires ConvertibleTo<Space, Color> && ConvertibleTo<Color, Space> | |
| constexpr Color | aest::colors::random_hue (const Color &color, Generator &generator, In< Space > space={}) |
| A copy of a color with a random hue, keeping the rest. | |
Partition aest.colors:random: random colors drawn from a caller-supplied random bit generator.
Definition in file Random.cppm.
|
constexprexport |
A random opaque color, uniform over the channels of an encoded RGB space.
Each channel is drawn uniformly from [0, 1), red first. The draws are uniform in the encoding, not to the eye: random_hue() gives colors of an even lightness instead.
| Space | The bounded RGB space to draw in, SRGB by default |
| Generator | The random bit generator |
| [in,out] | generator | The generator to draw from; it advances by three outputs |
Definition at line 74 of file Random.cppm.
|
constexprexport |
A copy of a color with a random hue, keeping the rest.
The color is converted to Space, its hue is replaced by one drawn uniformly from [0, 360) and it is converted back. In the default, OKLCH, the perceived lightness and chroma are kept, so every result looks as bright and as vivid as color: drawing from one base color gives a palette of even weight. The result may fall outside the gamut and clip when converted back. Gray colors have no hue and stay as they are.
| Space | The color space the hue is drawn in |
| Color | The color type of the input and the result |
| Generator | The random bit generator |
| [in] | color | The color whose hue to replace |
| [in,out] | generator | The generator to draw from; it advances by one output |
| [in] | space | The working space, e.g. in<HSL>; OKLCH when omitted |
color. Definition at line 103 of file Random.cppm.
|
constexpr |
Draw a float uniformly distributed in [0, 1).
std::uniform_real_distribution is not used: its algorithm is left to the standard library, so one seed would give different colors on each.
| Generator | The random bit generator |
| [in,out] | generator | The generator to draw from; it advances by one output |
Definition at line 51 of file Random.cppm.