Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Multi_WS2811 by
Colors Class Reference
Color Functions. More...
#include <Colors.h>
Static Public Member Functions | |
| static void | HSBtoRGB (float hue, float saturation, float brightness, uint8_t *pr, uint8_t *pg, uint8_t *pb) |
| Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model. | |
| static float * | RGBtoHSB (uint8_t r, uint8_t g, uint8_t b, float *hsbvals) |
| Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model. | |
Detailed Description
Color Functions.
Definition at line 7 of file Colors.h.
Member Function Documentation
| void HSBtoRGB | ( | float | hue, |
| float | saturation, | ||
| float | brightness, | ||
| uint8_t * | pr, | ||
| uint8_t * | pg, | ||
| uint8_t * | pb | ||
| ) | [static] |
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.
The saturation and brightness components should be floating-point values between zero and one (numbers in the range 0.0-1.0). The hue component can be any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1. This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model.
The integer that is returned by HSBtoRGB encodes the value of a color in bits 0-23 of an integer value that is the same format used by the method getRGB. This integer can be supplied as an argument to the Color constructor that takes a single integer argument.
- Parameters:
-
hue the hue component of the color saturation the saturation of the color brightness the brightness of the color
- Returns:
- the RGB value of the color with the indicated hue, saturation, and brightness.
Definition at line 5 of file Colors.cpp.
| float * RGBtoHSB | ( | uint8_t | r, |
| uint8_t | g, | ||
| uint8_t | b, | ||
| float * | hsbvals | ||
| ) | [static] |
Converts the components of a color, as specified by the default RGB model, to an equivalent set of values for hue, saturation, and brightness that are the three components of the HSB model.
If the hsbvals argument is null, then a new array is allocated to return the result. Otherwise, the method returns the array hsbvals, with the values put into that array.
- Parameters:
-
r the red component of the color g the green component of the color b the blue component of the color hsbvals the array used to return the three HSB values, or null
- Returns:
- an array of three elements containing the hue, saturation, and brightness (in that order), of the color with the indicated red, green, and blue components.
Definition at line 54 of file Colors.cpp.
Generated on Thu Jul 14 2022 14:43:43 by
1.7.2
