diff options
author | kriegsman@gmail.com <kriegsman@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b> | 2013-07-24 00:39:00 +0400 |
---|---|---|
committer | kriegsman@gmail.com <kriegsman@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b> | 2013-07-24 00:39:00 +0400 |
commit | 9d6be4506c179990b6035e08aa8a2e415badf715 (patch) | |
tree | 6a79297bf6bee94836e4ea2cc5abfb148da3e6f2 /pixeltypes.h | |
parent | 37458e1991ff6dc38cc3200311e01477869f595a (diff) |
MEK: fadeLightBy, fadeToBlackBy, maximizeBrightness
Diffstat (limited to 'pixeltypes.h')
-rw-r--r-- | pixeltypes.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pixeltypes.h b/pixeltypes.h index 949b7fc7..7b66ee63 100644 --- a/pixeltypes.h +++ b/pixeltypes.h @@ -289,6 +289,13 @@ struct CRGB { return *this; } + // fadeLightBy is a synonym for nscale8_video( ..., 255-fadefactor) + inline CRGB& fadeLightBy (uint8_t fadefactor ) + { + nscale8x3_video( r, g, b, 255 - fadefactor); + return *this; + } + // scale down a RGB to N 256ths of it's current brightness, using // 'plain math' dimming rules, which means that if the low light levels // may dim all the way to 100% black. @@ -298,6 +305,13 @@ struct CRGB { return *this; } + // fadeToBlackBy is a synonym for nscale8( ..., 255-fadefactor) + inline CRGB& fadeToBlackBy (uint8_t fadefactor ) + { + nscale8x3( r, g, b, 255 - fadefactor); + return *this; + } + // "or" operator brings each channel up to the higher of the two values inline CRGB& operator|= (const CRGB& rhs ) { @@ -367,7 +381,7 @@ struct CRGB { return avg; } - inline void nMaximizeBrightness( uint8_t limit = 255 ) { + inline void maximizeBrightness( uint8_t limit = 255 ) { uint8_t max = red; if( green > max) max = green; if( blue > max) max = blue; |