Forked

Fork of Multi_WS2811 by Ned Konz

Committer:
bikeNomad
Date:
Sat Jan 04 00:40:08 2014 +0000
Revision:
0:a8535703f23b
Initial revision of library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bikeNomad 0:a8535703f23b 1 #include <mbed.h>
bikeNomad 0:a8535703f23b 2
bikeNomad 0:a8535703f23b 3 #ifndef __included_colors_h
bikeNomad 0:a8535703f23b 4 #define __included_colors_h
bikeNomad 0:a8535703f23b 5
bikeNomad 0:a8535703f23b 6 /**
bikeNomad 0:a8535703f23b 7 * Converts the components of a color, as specified by the HSB
bikeNomad 0:a8535703f23b 8 * model, to an equivalent set of values for the default RGB model.
bikeNomad 0:a8535703f23b 9 * <p>
bikeNomad 0:a8535703f23b 10 * The <code>saturation</code> and <code>brightness</code> components
bikeNomad 0:a8535703f23b 11 * should be floating-point values between zero and one
bikeNomad 0:a8535703f23b 12 * (numbers in the range 0.0-1.0). The <code>hue</code> component
bikeNomad 0:a8535703f23b 13 * can be any floating-point number. The floor of this number is
bikeNomad 0:a8535703f23b 14 * subtracted from it to create a fraction between 0 and 1. This
bikeNomad 0:a8535703f23b 15 * fractional number is then multiplied by 360 to produce the hue
bikeNomad 0:a8535703f23b 16 * angle in the HSB color model.
bikeNomad 0:a8535703f23b 17 * <p>
bikeNomad 0:a8535703f23b 18 * The integer that is returned by <code>HSBtoRGB</code> encodes the
bikeNomad 0:a8535703f23b 19 * value of a color in bits 0-23 of an integer value that is the same
bikeNomad 0:a8535703f23b 20 * format used by the method {@link #getRGB() <code>getRGB</code>}.
bikeNomad 0:a8535703f23b 21 * This integer can be supplied as an argument to the
bikeNomad 0:a8535703f23b 22 * <code>Color</code> constructor that takes a single integer argument.
bikeNomad 0:a8535703f23b 23 * @param hue the hue component of the color
bikeNomad 0:a8535703f23b 24 * @param saturation the saturation of the color
bikeNomad 0:a8535703f23b 25 * @param brightness the brightness of the color
bikeNomad 0:a8535703f23b 26 * @return the RGB value of the color with the indicated hue,
bikeNomad 0:a8535703f23b 27 * saturation, and brightness.
bikeNomad 0:a8535703f23b 28 */
bikeNomad 0:a8535703f23b 29 void HSBtoRGB(float hue, float saturation, float brightness, uint8_t *pr, uint8_t *pg, uint8_t *pb);
bikeNomad 0:a8535703f23b 30
bikeNomad 0:a8535703f23b 31 /**
bikeNomad 0:a8535703f23b 32 * Converts the components of a color, as specified by the default RGB
bikeNomad 0:a8535703f23b 33 * model, to an equivalent set of values for hue, saturation, and
bikeNomad 0:a8535703f23b 34 * brightness that are the three components of the HSB model.
bikeNomad 0:a8535703f23b 35 * <p>
bikeNomad 0:a8535703f23b 36 * If the <code>hsbvals</code> argument is <code>null</code>, then a
bikeNomad 0:a8535703f23b 37 * new array is allocated to return the result. Otherwise, the method
bikeNomad 0:a8535703f23b 38 * returns the array <code>hsbvals</code>, with the values put into
bikeNomad 0:a8535703f23b 39 * that array.
bikeNomad 0:a8535703f23b 40 * @param r the red component of the color
bikeNomad 0:a8535703f23b 41 * @param g the green component of the color
bikeNomad 0:a8535703f23b 42 * @param b the blue component of the color
bikeNomad 0:a8535703f23b 43 * @param hsbvals the array used to return the
bikeNomad 0:a8535703f23b 44 * three HSB values, or <code>null</code>
bikeNomad 0:a8535703f23b 45 * @return an array of three elements containing the hue, saturation,
bikeNomad 0:a8535703f23b 46 * and brightness (in that order), of the color with
bikeNomad 0:a8535703f23b 47 * the indicated red, green, and blue components.
bikeNomad 0:a8535703f23b 48 */
bikeNomad 0:a8535703f23b 49 float* RGBtoHSB(uint8_t r, uint8_t g, uint8_t b, float* hsbvals);
bikeNomad 0:a8535703f23b 50
bikeNomad 0:a8535703f23b 51 #endif