Updated T_GAMMA (markdown)

Michael Miller
2023-04-02 12:18:22 -07:00
parent 12413b62df
commit 3fc8c04ff6

@@ -2,21 +2,27 @@ The T_GAMMA is a template class specialization feature that defines the specific
You as the sketch author do not need to write one of these as a library of them is available for you to choose from. If you need something custom then you can write your own, just copy one of the following and modify as you see fit.
### NeoGammaEquationMethod
If not specified this is the default used. It uses an equation to calculate the gamma correction. It is slower but more accurate.
It uses an equation to calculate the gamma correction. It is slower but more accurate.
```
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaEquationMethod> strip(PixelCount, PixelPin);
or
NeoGamma<NeoGammaEquationMethod> colorGamma;
```
### NeoGammaCieLabEquationMethod
Like the NeoGammaEquationMethod but uses as a specific model by the CIE Lab. It is slower but more accurate.
```
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaCieLabEquationMethod> strip(PixelCount, PixelPin);
or
NeoGamma<NeoGammaCieLabEquationMethod> colorGamma;
```
### NeoGammaTableMethod
This will use a pre-calculated static lookup table to improve performance. This consumes memory to contain the lookup table. While just as accurate when using 8-bit color elements, the accuracy is not as good when using 16-bit color elements.
```
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaTableMethod> strip(PixelCount, PixelPin);
or
NeoGamma<NeoGammaTableMethod> colorGamma;
```
### NeoGammaDynamicTableMethod
@@ -24,7 +30,9 @@ This will use sketch defined equation to dynamically create at runtime the pre-c
Using this specialization object will require that you provide a callback function that will calculate the gamma and that in setup() of your sketch that you call NeoGammaDynamicTableMethod::Initialize(yourGammaCalcFunction).
```
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoPixelGammaDynamic> strip(PixelCount, PixelPin);
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaDynamicTableMethod> strip(PixelCount, PixelPin);
or
NeoGamma<NeoGammaDynamicTableMethod> colorGamma;
float GammaCalc(float unitValue) {
// we will use CieLab gamma equation for our custom table
@@ -44,9 +52,11 @@ This will cause no gamma correction to be applied. Use this as way to disable g
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaNullMethod> strip(PixelCount, PixelPin);
```
### NeoGammaInvert<T_GAMMA_INNER>
### NeoGammaInvertMethod<T_GAMMA_INNER>
In the rare case that your NeoPixels have values that are inverted where it thinks 0 is full bright and 255 is black; you can use this wrapping specialization class to invert the colors at the last stage of pixel adjustments.
Below demonstrates the construction of a NeoPixelBusLg object using an inverted NeoGammaTableMethod for gamma specialization.
Below demonstrates the use for an inverted NeoGammaTableMethod for gamma specialization.
```
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaInvert<NeoGammaTableMethod>> strip(PixelCount, PixelPin);
NeoPixelBusLg<NeoGrbFeature, NeoWs2812xMethod, NeoGammaInvertMethod<NeoGammaTableMethod>> strip(PixelCount, PixelPin);
or
NeoGamma<NeoGammaInvertMethod<NeoGammaTableMethod>> colorGamma;
```