Updated Rgbw64Color object API (markdown)

Michael Miller
2023-04-05 21:22:56 -07:00
parent 758dfde98e
commit 6791e0f902

@@ -60,12 +60,12 @@ CAUTION: The R,G,B,W members are not initialized and may not be consistent unti
CalculateBrightness will calculate the overall brightness.
NOTE: For color objects with only W set, it will return W. For color objects with W set to zero this is a simple linear brightness. For color objects with values in W and another color component, the overall brightness is the brighter of the color components and the W.
### RgbwColor Dim(uint16_t ratio);
### Rgbw64Color Dim(uint16_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-65535) where 65535 will return the original color and 0 will return black.
### RgbwColor Brighten(uint16_t ratio);
### Rgbw64Color Brighten(uint16_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-65535) where 65535 will return the original color and 0 will return white.
@@ -80,6 +80,19 @@ Lighten will adjust the color by the given delta toward white.
NOTE: This is a simple linear change. If the color only has W value set, only W will be modified; otherwise only the R,G,B will be modified leaving W alone.
> * _delta_ - (0-65535) the amount to lighten the color by.
### int32_t CompareTo(const Rgbw64Color& other, uint16_t epsilon = 1)
Compares against another color with the given epsilon.
Returns the greatest difference of a set of elements, where 0 means the colors are equal within epsilon delta, negative means this is less than the other, positive means this is greater than the other.
> * _other_ - the color to compare against.
> * _epsilon_ - the max delta acceptable for them to be considered the same color.
### static int32_t Compare(const Rgbw64Color& left, const Rgbw64Color& right, uint16_t epsilon = 1)
Compares two colors with the given epsilon.
Returns the greatest difference of a set of elements, where 0 means the colors are equal within epsilon delta, negative means left is less than the right, positive means left is greater than the right.
> * _left_ - the first color to compare.
> * _right_ - the other color to compare.
> * _epsilon_ - the max delta acceptable for them to be considered the same color.
### static Rgbw64Color LinearBlend(Rgbw64Color left, Rgbw64Color right, float progress);
This will blend between two colors by the amount defined by the progress variable.
> * _left_ - the color to start the blend at.
@@ -90,7 +103,7 @@ This is a static function, which means you need to call it scoped to the object
Rgbw64Color results = Rgbw64Color::LinearBlend(Rgbw64Color(65535,0,0,0), Rgbw64Color(0,65535,0,10), 0.33f);
```
### static RgbwColor LinearBlend(RgbwColor left, RgbwColor right, uint8_t progress);
### static Rgbw64Color LinearBlend(Rgbw64Color left, Rgbw64Color 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.