-
Notifications
You must be signed in to change notification settings - Fork 1
/
Color.h
49 lines (37 loc) · 1.3 KB
/
Color.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef Color_h
#define Color_h
#include <inttypes.h>
//#include "Colors.h"
struct Color
{
public:
Color();
Color(uint8_t red, uint8_t green, uint8_t blue);
static Color fromRGB(uint8_t red, uint8_t green, uint8_t blue);
static Color from16BitRGB(uint16_t colorShort);
static Color from32BitRGB(uint32_t colorLong);
static Color rand();
static Color rand(uint8_t max);
static Color rand(uint8_t min, uint8_t max);
static Color blend(Color color1, Color color2, uint8_t color1Amount);
static uint32_t blend32Bit(uint32_t color1, uint32_t color2, uint8_t color1Amount);
static uint16_t blend16Bit(uint16_t color1, uint16_t color2, uint8_t color1Amount);
uint16_t to16BitRGB();
static uint16_t to16BitRGB(uint8_t red, uint8_t green, uint8_t blue);
static uint16_t to16BitRGB(uint32_t colorLong);
uint32_t to32BitRGB();
static uint32_t to32BitRGB(uint8_t red, uint8_t green, uint8_t blue);
static uint32_t to32BitRGB(uint16_t colorShort);
uint8_t getRed();
uint8_t getGreen();
uint8_t getBlue();
void setRed(uint8_t value);
void setGreen(uint8_t value);
void setBlue(uint8_t value);
private:
void _init(uint8_t red, uint8_t green, uint8_t blue);
uint8_t _red;
uint8_t _green;
uint8_t _blue;
};
#endif