This commit is contained in:
Michael Miller
2023-04-11 14:32:38 -07:00
committed by GitHub
parent d212d3ac5c
commit e862b7154e
3 changed files with 12 additions and 11 deletions

View File

@@ -57,9 +57,10 @@ struct Rgb48Color : RgbColorBase
// ------------------------------------------------------------------------
Rgb48Color(const RgbColor& color)
{
// x16 = map(x8, 0, 255, 0, 65535); // refactors to just * 257
R = (uint16_t)color.R * 257; // 257 = MAXUINT16/MAXUINT8 = 65535/255
G = (uint16_t)color.R * 257;
B = (uint16_t)color.R * 257;
G = (uint16_t)color.G * 257;
B = (uint16_t)color.B * 257;
};
// ------------------------------------------------------------------------

View File

@@ -35,14 +35,6 @@ License along with NeoPixel. If not, see
#include "Rgbw64Color.h"
#include "HtmlColor.h"
Rgbw64Color::Rgbw64Color(const RgbwColor& color)
{
R = (color.R == 0) ? 0 : (color.R << 8 | 0xff);
G = (color.G == 0) ? 0 : (color.G << 8 | 0xff);
B = (color.B == 0) ? 0 : (color.B << 8 | 0xff);
W = (color.W == 0) ? 0 : (color.W << 8 | 0xff);
};
Rgbw64Color::Rgbw64Color(const HslColor& color)
{
Rgb48Color rgbColor(color);

View File

@@ -78,7 +78,15 @@ struct Rgbw64Color : RgbColorBase
// ------------------------------------------------------------------------
// Construct a Rgbw64Color using RgbwColor
// ------------------------------------------------------------------------
Rgbw64Color(const RgbwColor& color);
Rgbw64Color(const RgbwColor& color)
{
// x16 = map(x8, 0, 255, 0, 65535); // refactors to just * 257
R = (uint16_t)color.R * 257; // 257 = MAXUINT16/MAXUINT8 = 65535/255
G = (uint16_t)color.G * 257;
B = (uint16_t)color.B * 257;
W = (uint16_t)color.W * 257;
};
// ------------------------------------------------------------------------
// Construct a Rgbw64Color using HtmlColor