gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
rainbow_cycle.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "../../core/color.hpp"
5#include "../../core/coords.hpp"
6#include "../../core/size.hpp"
7
8namespace ui::shader {
9
18template <unsigned int frequency>
19color_t rainbow_cycle(color_t pixel, const Coords &coords, const Size &size, time_t time) {
20 int h;
21 float s, v;
22 hsvComponents(pixel, h, s, v);
23
24 h += time * 360 / frequency;
25
26 return hsv(h, s, v);
27}
28
29} // namespace ui::shader
color_t hsv(const int hue, const float saturation, const float value)
Convert HSV color components into an RGB565 value.
uint16_t color_t
An RGB565 color value. 5 bits red, 6 bits green, 5 bits blue.
Definition color.hpp:13
void hsvComponents(color_t color, int &hue, float &saturation, float &value)
Convert an RGB565 value into HSV color components.
color_t rainbow_cycle(color_t pixel, const Coords &coords, const Size &size, time_t time)
A pixel shader that smoothly rotates the original color's hue through the rainbow.
Definition rainbow_cycle.hpp:19
A struct for storing the pixel coordinates of various UI elements.
Definition coords.hpp:17
A struct that holds the number of pixels that a widget would take up on the screen.
Definition size.hpp:17