mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Updates
This commit is contained in:
parent
926441549e
commit
eb2624aaa6
@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
#include <QList>
|
||||
|
||||
#define QSTRING_CSTR(str) str.toUtf8().constData()
|
||||
typedef QList< int > QIntList;
|
||||
|
||||
constexpr double DOUBLE_MAX_SQUARED = static_cast<double>(std::numeric_limits<unsigned char>::max()) * std::numeric_limits<unsigned char>::max();
|
||||
constexpr double DOUBLE_UINT8_MAX_SQUARED = static_cast<double>(UINT8_MAX) * UINT8_MAX;
|
||||
|
@ -125,14 +125,14 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
|
||||
uint32_t nr_g = static_cast<uint32_t>((UINT8_MAX - ored) * ogreen);
|
||||
uint32_t r_g = static_cast<uint32_t>(ored * ogreen);
|
||||
|
||||
uint8_t black = static_cast<uint8_t>(nr_ng * (UINT8_MAX - oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t red = static_cast<uint8_t>(r_ng * (UINT8_MAX - oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t green = static_cast<uint8_t>(nr_g * (UINT8_MAX - oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t blue = static_cast<uint8_t>(nr_ng * (oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t cyan = static_cast<uint8_t>(nr_g * (oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t magenta = static_cast<uint8_t>(r_ng * (oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t yellow = static_cast<uint8_t>(r_g * (UINT8_MAX - oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t white = static_cast<uint8_t>(r_g * (oblue) / DOUBLE_MAX_SQUARED);
|
||||
uint8_t black = static_cast<uint8_t>(nr_ng * (UINT8_MAX - oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t red = static_cast<uint8_t>(r_ng * (UINT8_MAX - oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t green = static_cast<uint8_t>(nr_g * (UINT8_MAX - oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t blue = static_cast<uint8_t>(nr_ng * (oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t cyan = static_cast<uint8_t>(nr_g * (oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t magenta = static_cast<uint8_t>(r_ng * (oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t yellow = static_cast<uint8_t>(r_g * (UINT8_MAX - oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
uint8_t white = static_cast<uint8_t>(r_g * (oblue) / DOUBLE_UINT8_MAX_SQUARED);
|
||||
|
||||
uint8_t OR, OG, OB; // Original Colors
|
||||
uint8_t RR, RG, RB; // Red Adjustments
|
||||
|
@ -61,7 +61,7 @@ void RgbChannelAdjustment::apply(uint8_t input, uint8_t brightness, uint8_t & re
|
||||
|
||||
if (!_initialized[input])
|
||||
{
|
||||
const double adjustedInput = _brightness * input / DOUBLE_MAX_SQUARED;
|
||||
const double adjustedInput = _brightness * input / DOUBLE_UINT8_MAX_SQUARED;
|
||||
_mapping.red[input] = static_cast<quint8>(qBound(0, static_cast<int>(_adjust.red * adjustedInput), static_cast<int>(UINT8_MAX)));
|
||||
_mapping.green[input] = static_cast<quint8>(qBound(0 ,static_cast<int>(_adjust.green * adjustedInput), static_cast<int>(UINT8_MAX)));
|
||||
_mapping.blue[input] = static_cast<quint8>(qBound(0, static_cast<int>(_adjust.blue * adjustedInput), static_cast<int>(UINT8_MAX)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user