Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
NeoGammaEquationMethod.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 NeoGammaEquationMethod class is used to correct RGB colors for human eye gamma levels equally
3 across all color channels
4 
5 Written by Michael C. Miller.
6 
7 I invest time and resources providing this open source code,
8 please support me by dontating (see https://github.com/Makuna)
9 
10 -------------------------------------------------------------------------
11 This file is part of the LUMITRONIX_iFlex_Workshop library.
12 
13 LumitronixIFlexBus is free software: you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as
15 published by the Free Software Foundation, either version 3 of
16 the License, or (at your option) any later version.
17 
18 LumitronixIFlexBus is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 
23 You should have received a copy of the GNU Lesser General Public
24 License along with LumitronixIFlex. If not, see
25 <http://www.gnu.org/licenses/>.
26 -------------------------------------------------------------------------*/
27 #pragma once
28 
29 
30 // NeoGammaEquationMethod uses no memory but is slower than NeoGammaTableMethod
32 {
33 public:
34  static uint8_t Correct(uint8_t value)
35  {
36  return static_cast<uint8_t>(255.0f * NeoEase::Gamma(value / 255.0f) + 0.5f);
37  }
38  static uint16_t Correct(uint16_t value)
39  {
40  return static_cast<uint16_t>(65535.0f * NeoEase::Gamma(value / 65535.0f) + 0.5f);
41  }
42 };
43 
44 
static float Gamma(float unitValue)
Definition: NeoEase.h:309
Definition: NeoGammaEquationMethod.h:32
static uint16_t Correct(uint16_t value)
Definition: NeoGammaEquationMethod.h:38
static uint8_t Correct(uint8_t value)
Definition: NeoGammaEquationMethod.h:34