forked from Makuna/NeoPixelBus
RgbwColor supported (#775)
This commit is contained in:
@@ -37,7 +37,6 @@ License along with NeoPixel. If not, see
|
||||
#include "RgbwColor.h"
|
||||
#include "RgbwwColor.h"
|
||||
#include "RgbwwwColor.h"
|
||||
#include "Rgb48Color.h"
|
||||
#include "Rgbw64Color.h"
|
||||
#include "Rgbww80Color.h"
|
||||
|
||||
|
@@ -34,6 +34,43 @@ License along with NeoPixel. If not, see
|
||||
#include "RgbwColor.h"
|
||||
#include "HtmlColor.h"
|
||||
|
||||
#include "RgbwwColor.h"
|
||||
#include "RgbwwwColor.h"
|
||||
#include "Rgbw64Color.h"
|
||||
#include "Rgbww80Color.h"
|
||||
|
||||
RgbwColor::RgbwColor(const RgbwwColor& color) :
|
||||
R(color.R),
|
||||
G(color.G),
|
||||
B(color.B),
|
||||
W(static_cast<uint8_t>((static_cast<uint16_t>(color.WW) + static_cast<uint16_t>(color.CW)) / 2))
|
||||
{
|
||||
};
|
||||
|
||||
RgbwColor::RgbwColor(const RgbwwwColor& color) :
|
||||
R(color.R),
|
||||
G(color.G),
|
||||
B(color.B),
|
||||
W(static_cast<uint8_t>((static_cast<uint16_t>(color.W1) + static_cast<uint16_t>(color.W2) + static_cast<uint16_t>(color.W3)) / 3))
|
||||
{
|
||||
};
|
||||
|
||||
RgbwColor::RgbwColor(const Rgbw64Color& color) :
|
||||
R(color.R >> 8),
|
||||
G(color.G >> 8),
|
||||
B(color.B >> 8),
|
||||
W(color.W >> 8)
|
||||
{
|
||||
};
|
||||
|
||||
RgbwColor::RgbwColor(const Rgbww80Color& color) :
|
||||
R(color.R >> 8),
|
||||
G(color.G >> 8),
|
||||
B(color.B >> 8),
|
||||
W(static_cast<uint8_t>((static_cast<uint32_t>(color.WW) + static_cast<uint32_t>(color.CW)) >> 9)) // div 2 >> 8
|
||||
{
|
||||
};
|
||||
|
||||
RgbwColor::RgbwColor(const HtmlColor& color)
|
||||
{
|
||||
uint32_t temp = color.Color;
|
||||
|
@@ -29,6 +29,11 @@ struct RgbColor;
|
||||
struct HslColor;
|
||||
struct HsbColor;
|
||||
|
||||
struct RgbwwColor;
|
||||
struct RgbwwwColor;
|
||||
struct Rgbw64Color;
|
||||
struct Rgbww80Color;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// RgbwColor represents a color object that is represented by Red, Green, Blue
|
||||
// component values and an extra White component. It contains helpful color
|
||||
@@ -67,6 +72,26 @@ struct RgbwColor : RgbColorBase
|
||||
{
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// explicitly Construct a RgbColor using RgbwwColor
|
||||
// ------------------------------------------------------------------------
|
||||
explicit RgbwColor(const RgbwwColor& color);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// explicitly Construct a RgbColor using RgbwwwColor
|
||||
// ------------------------------------------------------------------------
|
||||
explicit RgbwColor(const RgbwwwColor& color);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// explicitly Construct a RgbColor using Rgbw64Color
|
||||
// ------------------------------------------------------------------------
|
||||
explicit RgbwColor(const Rgbw64Color& color);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// explicitly Construct a RgbColor using Rgbww80Color
|
||||
// ------------------------------------------------------------------------
|
||||
explicit RgbwColor(const Rgbww80Color& color);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Construct a RgbwColor using HtmlColor
|
||||
// ------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user