MCPcopy Create free account
hub / github.com/FastLED/FastLED / Color3i

Class Color3i

examples/LuminescentGrand/shared/color.h:6–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "fl/stl/stdint.h"
5
6struct Color3i {
7 static Color3i Black() { return Color3i(0x0, 0x0, 0x0); }
8 static Color3i White() { return Color3i(0xff, 0xff, 0xff); }
9 static Color3i Red() { return Color3i(0xff, 0x00, 0x00); }
10 static Color3i Orange() { return Color3i(0xff, 0xff / 2,00); }
11 static Color3i Yellow() { return Color3i(0xff, 0xff,00); }
12 static Color3i Green() { return Color3i(0x00, 0xff, 0x00); }
13 static Color3i Cyan() { return Color3i(0x00, 0xff, 0xff); }
14 static Color3i Blue() { return Color3i(0x00, 0x00, 0xff); }
15 Color3i(uint8_t r, uint8_t g, uint8_t b) { Set(r,g,b); }
16 Color3i() { Set(0xff, 0xff, 0xff); }
17 Color3i(const Color3i& other) { Set(other); }
18 Color3i& operator=(const Color3i& other) {
19 if (this != &other) {
20 Set(other);
21 }
22 return *this;
23 }
24
25 void Set(uint8_t r, uint8_t g, uint8_t b) { r_ = r; g_ = g; b_ = b; }
26 void Set(const Color3i& c) { Set(c.r_, c.g_, c.b_); }
27 void Mul(const Color3i& other_color);
28 void Mulf(float scale); // Input range is 0.0 -> 1.0
29 void Mul(uint8_t val) {
30 Mul(Color3i(val, val, val));
31 }
32 void Sub(const Color3i& color);
33 void Add(const Color3i& color);
34 uint8_t Get(int rgb_index) const;
35 void Set(int rgb_index, uint8_t val);
36 void Fill(uint8_t val) { Set(val, val, val); }
37 uint8_t MaxRGB() const {
38 uint8_t max_r_g = r_ > g_ ? r_ : g_;
39 return max_r_g > b_ ? max_r_g : b_;
40 }
41
42 template <typename PrintStream>
43 inline void Print(PrintStream* stream) const {
44 stream->print("RGB:\t");
45 stream->print(r_); stream->print(",\t");
46 stream->print(g_); stream->print(",\t");
47 stream->print(b_);
48 stream->print("\n");
49 }
50
51 void Interpolate(const Color3i& other_color, float t);
52
53 uint8_t* At(int rgb_index);
54 const uint8_t* At(int rgb_index) const;
55
56 uint8_t r_, g_, b_;
57};
58
59
60struct ColorHSV {

Callers 11

BlackMethod · 0.70
WhiteMethod · 0.70
RedMethod · 0.70
OrangeMethod · 0.70
YellowMethod · 0.70
GreenMethod · 0.70
CyanMethod · 0.70
BlueMethod · 0.70
MulMethod · 0.70
ToRGBMethod · 0.70
color_mapper.cppFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected