FastLED 3.9.3
Loading...
Searching...
No Matches
Color Blending Functions

Detailed Description

Functions for blending colors together

Functions

CRGB blend (const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
 Computes a new color blended some fraction of the way between two other colors.
 
CHSV blend (const CHSV &p1, const CHSV &p2, fract8 amountOfP2, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Computes a new color blended some fraction of the way between two other colors.
 
CRGBblend (const CRGB *src1, const CRGB *src2, CRGB *dest, uint16_t count, fract8 amountOfsrc2)
 Computes a new blended array of colors, each some fraction of the way between corresponding elements of two source arrays of colors.
 
CHSVblend (const CHSV *src1, const CHSV *src2, CHSV *dest, uint16_t count, fract8 amountOfsrc2, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Computes a new blended array of colors, each some fraction of the way between corresponding elements of two source arrays of colors.
 
CRGBnblend (CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
 Destructively modifies one color, blending in a given fraction of an overlay color.
 
CHSVnblend (CHSV &existing, const CHSV &overlay, fract8 amountOfOverlay, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Destructively modifies one color, blending in a given fraction of an overlay color.
 
void nblend (CRGB *existing, CRGB *overlay, uint16_t count, fract8 amountOfOverlay)
 Destructively blends a given fraction of a color array into an existing color array.
 
void nblend (CHSV *existing, CHSV *overlay, uint16_t count, fract8 amountOfOverlay, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Destructively blends a given fraction of a color array into an existing color array.
 

Function Documentation

◆ blend() [1/4]

CHSV blend ( const CHSV & p1,
const CHSV & p2,
fract8 amountOfP2,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Computes a new color blended some fraction of the way between two other colors.

Parameters
p1the first color to blend
p2the second color to blend
amountOfP2the fraction of p2 to blend into p1
directionCodethe direction to travel around the color wheel

Definition at line 396 of file colorutils.cpp.

◆ blend() [2/4]

CHSV * blend ( const CHSV * src1,
const CHSV * src2,
CHSV * dest,
uint16_t count,
fract8 amountOfsrc2,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Computes a new blended array of colors, each some fraction of the way between corresponding elements of two source arrays of colors.

Useful for blending palettes.

Parameters
src1the first array of colors to blend
src2the second array of colors to blend
destthe destination array for the colors
countthe number of LEDs to blend
amountOfsrc2the fraction of src2 to blend into src1
directionCodethe direction to travel around the color wheel

Definition at line 403 of file colorutils.cpp.

◆ blend() [3/4]

CRGB blend ( const CRGB & p1,
const CRGB & p2,
fract8 amountOfP2 )

Computes a new color blended some fraction of the way between two other colors.

Parameters
p1the first color to blend
p2the second color to blend
amountOfP2the fraction of p2 to blend into p1

Definition at line 319 of file colorutils.cpp.

◆ blend() [4/4]

CRGB * blend ( const CRGB * src1,
const CRGB * src2,
CRGB * dest,
uint16_t count,
fract8 amountOfsrc2 )

Computes a new blended array of colors, each some fraction of the way between corresponding elements of two source arrays of colors.

Useful for blending palettes.

Parameters
src1the first array of colors to blend
src2the second array of colors to blend
destthe destination array for the colors
countthe number of LEDs to blend
amountOfsrc2the fraction of src2 to blend into src1

Definition at line 326 of file colorutils.cpp.

◆ nblend() [1/4]

CHSV & nblend ( CHSV & existing,
const CHSV & overlay,
fract8 amountOfOverlay,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Destructively modifies one color, blending in a given fraction of an overlay color.

Parameters
existingthe color to modify
overlaythe color to blend into existing
amountOfOverlaythe fraction of overlay to blend into existing
directionCodethe direction to travel around the color wheel

Definition at line 336 of file colorutils.cpp.

◆ nblend() [2/4]

void nblend ( CHSV * existing,
CHSV * overlay,
uint16_t count,
fract8 amountOfOverlay,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Destructively blends a given fraction of a color array into an existing color array.

Parameters
existingthe color array to modify
overlaythe color array to blend into existing
countthe number of colors to process
amountOfOverlaythe fraction of overlay to blend into existing
directionCodethe direction to travel around the color wheel

Definition at line 386 of file colorutils.cpp.

◆ nblend() [3/4]

CRGB & nblend ( CRGB & existing,
const CRGB & overlay,
fract8 amountOfOverlay )

Destructively modifies one color, blending in a given fraction of an overlay color.

Parameters
existingthe color to modify
overlaythe color to blend into existing
amountOfOverlaythe fraction of overlay to blend into existing

Definition at line 275 of file colorutils.cpp.

◆ nblend() [4/4]

void nblend ( CRGB * existing,
CRGB * overlay,
uint16_t count,
fract8 amountOfOverlay )

Destructively blends a given fraction of a color array into an existing color array.

Parameters
existingthe color array to modify
overlaythe color array to blend into existing
countthe number of colors to process
amountOfOverlaythe fraction of overlay to blend into existing

Definition at line 310 of file colorutils.cpp.