8 #ifndef COMPONENTS_WS281X_SRC_RGBLEDCOLOR_H_
9 #define COMPONENTS_WS281X_SRC_RGBLEDCOLOR_H_
23 #define min(a,b) ((a)<(b)?(a):(b))
43 inline RgbLedColor_t( uint8_t ir, uint8_t ig, uint8_t ib) __attribute__((always_inline))
44 : red(ir), green(ig), blue(ib)
49 inline RgbLedColor_t( uint32_t colorcode) __attribute__((always_inline))
50 : red((colorcode >> 16) & 0xFF), green((colorcode >> 8) & 0xFF), blue((colorcode >> 0) & 0xFF)
54 void setColor(uint32_t colorcode) {
55 red = ((colorcode >> 16) & 0xFF);
56 green = ((colorcode >> 8) & 0xFF);
57 blue = ((colorcode >> 0) & 0xFF);
62 return(this->red == c.red and this->green == c.green and this->blue == c.blue);
72 int r0 = min(color.red + red, 255);
73 int g0 = min(color.green + green, 255);
74 int b0 = min(color.blue + blue, 255);
80 int r0 = x*(color.red - red) + red;
81 int g0 = x*(color.green - green) + green;
82 int b0 = x*(color.blue - blue) + blue;
88 int r0 = min(red*k, 255);
89 int g0 = min(green*k, 255);
90 int b0 = min(blue*k, 255);
107 int i0 = (int)i%(numColors);
108 int i1 = (int)(i+1)%(numColors);
111 float t0 = i - trunc(i);
114 return colors[i0].interpolate(colors[i1], t0);
119 if (!(this->numColors == c.numColors))
122 for(
int i=0; i<numColors; i++)
124 if (!(this->colors[i] == c.colors[i]))
RgbLedColor_t getPaletteColor(float i)
Definition: RgbLedColor.h:105
Definition: RgbLedColor.h:96
Definition: RgbLedColor.h:25