FastLED 3.9.7
Loading...
Searching...
No Matches
Dimming and Brightening Functions

Detailed Description

Functions to dim or brighten data.

The eye does not respond in a linear way to light. High speed PWM'd LEDs at 50% duty cycle appear far brighter then the "half as bright" you might expect.

If you want your midpoint brightness LEDs (128) to appear half as bright as "full" brightness (255), you have to apply a "dimming function".

Note
These are approximations of gamma correction with a gamma value of 2.0.
See also
Gamma Adjustment Functions

Functions

uint8_t brightness_bitshifter8 (uint8_t *brightness_src, uint8_t *brightness_dst, uint8_t max_shifts)
 
uint8_t brightness_bitshifter16 (uint8_t *brightness_src, uint16_t *brightness_dst, uint8_t max_shifts, uint8_t steps=2)
 
LIB8STATIC uint8_t dim8_raw (uint8_t x)
 Adjust a scaling value for dimming.
 
LIB8STATIC uint8_t dim8_video (uint8_t x)
 Adjust a scaling value for dimming for video (value will never go below 1)
 
LIB8STATIC uint8_t dim8_lin (uint8_t x)
 Linear version of the dimming function that halves for values < 128.
 
LIB8STATIC uint8_t brighten8_raw (uint8_t x)
 Brighten a value (inverse of dim8_raw())
 
LIB8STATIC uint8_t brighten8_video (uint8_t x)
 Brighten a value (inverse of dim8_video())
 
LIB8STATIC uint8_t brighten8_lin (uint8_t x)
 Brighten a value (inverse of dim8_lin())
 

Function Documentation

◆ brighten8_lin()

LIB8STATIC uint8_t brighten8_lin ( uint8_t x)

Brighten a value (inverse of dim8_lin())

Definition at line 733 of file scale8.h.

◆ brighten8_raw()

LIB8STATIC uint8_t brighten8_raw ( uint8_t x)

Brighten a value (inverse of dim8_raw())

Definition at line 721 of file scale8.h.

◆ brighten8_video()

LIB8STATIC uint8_t brighten8_video ( uint8_t x)

Brighten a value (inverse of dim8_video())

Definition at line 727 of file scale8.h.

◆ brightness_bitshifter16()

uint8_t brightness_bitshifter16 ( uint8_t * brightness_src,
uint16_t * brightness_dst,
uint8_t max_shifts,
uint8_t steps = 2 )
inline

Definition at line 43 of file brightness_bitshifter.h.

◆ brightness_bitshifter8()

uint8_t brightness_bitshifter8 ( uint8_t * brightness_src,
uint8_t * brightness_dst,
uint8_t max_shifts )
inline

Definition at line 14 of file brightness_bitshifter.h.

◆ dim8_lin()

LIB8STATIC uint8_t dim8_lin ( uint8_t x)

Linear version of the dimming function that halves for values < 128.

Definition at line 710 of file scale8.h.

◆ dim8_raw()

LIB8STATIC uint8_t dim8_raw ( uint8_t x)

Adjust a scaling value for dimming.

See also
scale8()

Definition at line 703 of file scale8.h.

◆ dim8_video()

LIB8STATIC uint8_t dim8_video ( uint8_t x)

Adjust a scaling value for dimming for video (value will never go below 1)

See also
scale8_video()

Definition at line 707 of file scale8.h.