mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-10 06:14:26 +02:00
Updated RgbColor object API (markdown)
@@ -40,6 +40,16 @@ CAUTION: The R,G,B members are not initialized and may not be consistent until
|
|||||||
CalculateBrightness will calculate the overall brightness.
|
CalculateBrightness will calculate the overall brightness.
|
||||||
NOTE: This is a simple linear brightness
|
NOTE: This is a simple linear brightness
|
||||||
|
|
||||||
|
### RgbColor Dim(uint8_t ratio);
|
||||||
|
Dim will return a new color that is blended to black with the given ratio.
|
||||||
|
NOTE: This is a simple linear change.
|
||||||
|
> * _ratio_ - (0-255) where 255 will return the original color and 0 will return black.
|
||||||
|
|
||||||
|
### RgbColor Brighten(uint8_t ratio);
|
||||||
|
Brighten will return a new color that is blended to white with the given ratio.
|
||||||
|
NOTE: This is a simple linear change.
|
||||||
|
> * _ratio_ - (0-255) where 255 will return the original color and 0 will return white.
|
||||||
|
|
||||||
### void Darken(uint8_t delta);
|
### void Darken(uint8_t delta);
|
||||||
Darken will adjust the color by the given delta toward black.
|
Darken will adjust the color by the given delta toward black.
|
||||||
NOTE: This is a simple linear change.
|
NOTE: This is a simple linear change.
|
||||||
@@ -59,6 +69,17 @@ This is a static function, which means you need to call it scoped to the object
|
|||||||
```
|
```
|
||||||
RgbColor results = RgbColor::LinearBlend(RgbColor(255,0,0), RgbColor(0,255,0), 0.33f);
|
RgbColor results = RgbColor::LinearBlend(RgbColor(255,0,0), RgbColor(0,255,0), 0.33f);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### static RgbColor LinearBlend(RgbColor left, RgbColor right, uint8_t progress);
|
||||||
|
This will blend between two colors by the amount defined by the progress variable.
|
||||||
|
> * _left_ - the color to start the blend at.
|
||||||
|
> * _right_ - the color to end the blend at.
|
||||||
|
> * _progress_ - (0 - 255) value where 0 will return left and 255 will return right and a value between will blend the color weighted linearly between them.
|
||||||
|
This is a static function, which means you need to call it scoped to the object class and not an instance like...
|
||||||
|
```
|
||||||
|
RgbColor results = RgbColor::LinearBlend(RgbColor(255,0,0), RgbColor(0,255,0), 85);
|
||||||
|
```
|
||||||
|
|
||||||
### static RgbColor BilinearBlend(RgbColor c00, RgbColor c01, RgbColor c10, RgbColor c11, float x, float y);
|
### static RgbColor BilinearBlend(RgbColor c00, RgbColor c01, RgbColor c10, RgbColor c11, float x, float y);
|
||||||
This will blend between four colors by the amount defined by 2d weighting values.
|
This will blend between four colors by the amount defined by 2d weighting values.
|
||||||
> * _c00_ - upper left quadrant color
|
> * _c00_ - upper left quadrant color
|
||||||
|
Reference in New Issue
Block a user