48 conversion constructors (#688)

This commit is contained in:
Michael Miller
2023-04-15 07:18:47 -07:00
committed by GitHub
parent e862b7154e
commit 3fc819c31e
3 changed files with 26 additions and 0 deletions

View File

@@ -33,6 +33,16 @@ License along with NeoPixel. If not, see
#include "HsbColor.h"
#include "HtmlColor.h"
#include "RgbwColor.h"
#include "Rgbw64Color.h"
Rgb48Color::Rgb48Color(const Rgbw64Color& color) :
R(color.R),
G(color.G),
B(color.B)
{
}
Rgb48Color::Rgb48Color(const HslColor& color)
{
float r;

View File

@@ -25,6 +25,8 @@ License along with NeoPixel. If not, see
-------------------------------------------------------------------------*/
#pragma once
struct Rgbw64Color; // forward declared
// ------------------------------------------------------------------------
// Rgb48Color represents a color object that is represented by Red, Green, Blue
// component values. It contains helpful color routines to manipulate the
@@ -63,6 +65,19 @@ struct Rgb48Color : RgbColorBase
B = (uint16_t)color.B * 257;
};
// ------------------------------------------------------------------------
// explicitly Construct a Rgb48Color using RgbwColor
// ------------------------------------------------------------------------
explicit Rgb48Color(const RgbwColor& color)
{
*this = RgbColor(color);
}
// ------------------------------------------------------------------------
// explicitly Construct a Rgb48Color using Rgbw64Color
// ------------------------------------------------------------------------
explicit Rgb48Color(const Rgbw64Color& color);
// ------------------------------------------------------------------------
// Construct a Rgb48Color using HtmlColor
// ------------------------------------------------------------------------

View File

@@ -33,6 +33,7 @@ License along with NeoPixel. If not, see
#include "HslColor.h"
#include "HsbColor.h"
#include "HtmlColor.h"
#include "RgbwColor.h"
RgbColor::RgbColor(const RgbwColor& color) :