Enhance ColorObject (#340)

Enahnce Dim
Add Brighten
NeoPixelBrightnessBus use enhancement
This commit is contained in:
Michael Miller authored and GitHub committed 2020-02-25 11:04:34 -08:00
1 parent 4157d1d618
commit fc0b739893
5 files changed
+71 -30

No files matched your search

+7 -1
View File
@@ -70,7 +70,13 @@ uint8_t RgbwColor::CalculateBrightness() const
RgbwColor RgbwColor::Dim(uint8_t ratio) const
{
// specifically avoids float math
return RgbwColor(R * ratio / 255, G * ratio / 255, B * ratio / 255, W * ratio / 255);
return RgbwColor(_elementDim(R, ratio), _elementDim(G, ratio), _elementDim(B, ratio), _elementDim(W, ratio));
}
RgbwColor RgbwColor::Brighten(uint8_t ratio) const
{
// specifically avoids float math
return RgbwColor(_elementBrighten(R, ratio), _elementBrighten(G, ratio), _elementBrighten(B, ratio), _elementBrighten(W, ratio));
}
void RgbwColor::Darken(uint8_t delta)