mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-07 04:44:26 +02:00
Created NeoGamma object (markdown)
25
NeoGamma-object.md
Normal file
25
NeoGamma-object.md
Normal file
@@ -0,0 +1,25 @@
|
||||
The NeoGamma object provides an easy way to convert a color object to a gamma corrected value. The human eye perceives light levels differently than what the NeoPixels show. NeoPixels brightness levels are very linear so this object will convert them to the nonlinear so that what you see is what you expected.
|
||||
|
||||
To construct one, you need provide a method that defines how it does the calculation. There are two methods supported, either by the equation or by a look-up table.
|
||||
```
|
||||
NeoGamma<NeoGammaEquationMethod> colorGamma;
|
||||
|
||||
NeoGamma<NeoGammaTableMethod> colorGamma;
|
||||
```
|
||||
Once you have one, you can then just call the Correct() method on it to get a gamma corrected color.
|
||||
```
|
||||
color = colorGamma.Correct(color);
|
||||
```
|
||||
|
||||
## NeoGamma
|
||||
### Methods
|
||||
#### RgbColor Correct(RgbColor original)
|
||||
This will return the color corrected into the human perceived linear visible spectrum.
|
||||
#### RgbwColor Correct(RgbwColor original)
|
||||
This will return the color corrected into the human perceived linear visible spectrum.
|
||||
|
||||
## NeoGammaEquationMethod
|
||||
This method will use a floating point equation to calculate the conversion. It requires very little memory but will require more CPU overhead to run than the NeoGammaTableMethod. Its provided for those with restricted memory devices.
|
||||
|
||||
## NeoGammaTableMethod
|
||||
This method will use a 256 byte table to lookup the conversion values. It will be very fast to do conversion and should be the method to use if you can spare the memory.
|
Reference in New Issue
Block a user