From 76f357b27cb28af757b15f5e7bdf97d3d30cafc6 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 29 Mar 2023 11:07:45 -0700 Subject: [PATCH] Updated RgbColor object API (markdown) --- RgbColor-object-API.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/RgbColor-object-API.md b/RgbColor-object-API.md index 88e4ad9..cfd4569 100644 --- a/RgbColor-object-API.md +++ b/RgbColor-object-API.md @@ -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. 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); Darken will adjust the color by the given delta toward black. 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); ``` + +### 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); This will blend between four colors by the amount defined by 2d weighting values. > * _c00_ - upper left quadrant color