FastLED 3.9.12
Loading...
Searching...
No Matches
CRGBPalette32 Class Reference

Detailed Description

RGB color palette with 32 discrete values.

Definition at line 1436 of file colorutils.h.

#include <colorutils.h>

Public Member Functions

 CRGBPalette32 ()
 Default constructor.
 
 CRGBPalette32 (const CRGB &c00, const CRGB &c01, const CRGB &c02, const CRGB &c03, const CRGB &c04, const CRGB &c05, const CRGB &c06, const CRGB &c07, const CRGB &c08, const CRGB &c09, const CRGB &c10, const CRGB &c11, const CRGB &c12, const CRGB &c13, const CRGB &c14, const CRGB &c15)
 Create palette from 16 CRGB values.
 
 CRGBPalette32 (const CRGBPalette32 &rhs)
 Copy constructor.
 
 CRGBPalette32 (const CRGB rhs[32])
 Create palette from array of CRGB colors.
 
CRGBPalette32operator= (const CRGBPalette32 &rhs)
 Copy constructor.
 
CRGBPalette32operator= (const CRGB rhs[32])
 Create palette from array of CRGB colors.
 
 CRGBPalette32 (const CHSVPalette32 &rhs)
 Create palette from CHSV palette.
 
 CRGBPalette32 (const CHSV rhs[32])
 Create palette from array of CHSV colors.
 
CRGBPalette32operator= (const CHSVPalette32 &rhs)
 Create palette from CHSV palette.
 
CRGBPalette32operator= (const CHSV rhs[32])
 Create palette from array of CHSV colors.
 
 CRGBPalette32 (const TProgmemRGBPalette32 &rhs)
 Create palette from palette stored in PROGMEM.
 
CRGBPalette32operator= (const TProgmemRGBPalette32 &rhs)
 Create palette from palette stored in PROGMEM.
 
bool operator== (const CRGBPalette32 &rhs) const
 Check if two palettes have the same color entries.
 
bool operator!= (const CRGBPalette32 &rhs) const
 Check if two palettes do not have the same color entries.
 
CRGBoperator[] (uint8_t x)
 Array access operator to index into the gradient entries.
 
const CRGBoperator[] (uint8_t x) const
 Array access operator to index into the gradient entries.
 
CRGBoperator[] (int x)
 Array access operator to index into the gradient entries.
 
const CRGBoperator[] (int x) const
 Array access operator to index into the gradient entries.
 
 operator CRGB * ()
 Get the underlying pointer to the CRGB entries making up the palette.
 
 CRGBPalette32 (const CHSV &c1)
 Create palette filled with one color.
 
 CRGBPalette32 (const CHSV &c1, const CHSV &c2)
 Create palette with a gradient from one color to another.
 
 CRGBPalette32 (const CHSV &c1, const CHSV &c2, const CHSV &c3)
 Create palette with three-color gradient.
 
 CRGBPalette32 (const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4)
 Create palette with four-color gradient.
 
 CRGBPalette32 (const CRGB &c1)
 Create palette filled with one color.
 
 CRGBPalette32 (const CRGB &c1, const CRGB &c2)
 Create palette with a gradient from one color to another.
 
 CRGBPalette32 (const CRGB &c1, const CRGB &c2, const CRGB &c3)
 Create palette with three-color gradient.
 
 CRGBPalette32 (const CRGB &c1, const CRGB &c2, const CRGB &c3, const CRGB &c4)
 Create palette with four-color gradient.
 
 CRGBPalette32 (const CRGBPalette16 &rhs16)
 Create upscaled palette from 16-entry palette.
 
CRGBPalette32operator= (const CRGBPalette16 &rhs16)
 Create upscaled palette from 16-entry palette.
 
 CRGBPalette32 (const TProgmemRGBPalette16 &rhs)
 Create palette from palette stored in PROGMEM.
 
CRGBPalette32operator= (const TProgmemRGBPalette16 &rhs)
 Create palette from palette stored in PROGMEM.
 
 CRGBPalette32 (TProgmemRGBGradientPalette_bytes progpal)
 Creates a palette from a gradient palette in PROGMEM.
 
CRGBPalette32operator= (TProgmemRGBGradientPalette_bytes progpal)
 Creates a palette from a gradient palette in PROGMEM.
 
CRGBPalette32loadDynamicGradientPalette (TDynamicRGBGradientPalette_bytes gpal)
 Creates a palette from a gradient palette in dynamic (heap) memory.
 

Public Attributes

CRGB entries [32]
 the color entries that make up the palette
 

Constructor & Destructor Documentation

◆ CRGBPalette32() [1/18]

CRGBPalette32::CRGBPalette32 ( )
inline

Default constructor.

Warning
Default values are UNITIALIZED!

Definition at line 1441 of file colorutils.h.

◆ CRGBPalette32() [2/18]

CRGBPalette32::CRGBPalette32 ( const CRGB & c00,
const CRGB & c01,
const CRGB & c02,
const CRGB & c03,
const CRGB & c04,
const CRGB & c05,
const CRGB & c06,
const CRGB & c07,
const CRGB & c08,
const CRGB & c09,
const CRGB & c10,
const CRGB & c11,
const CRGB & c12,
const CRGB & c13,
const CRGB & c14,
const CRGB & c15 )
inline

Create palette from 16 CRGB values.

Definition at line 1448 of file colorutils.h.

◆ CRGBPalette32() [3/18]

CRGBPalette32::CRGBPalette32 ( const CRGBPalette32 & rhs)
inline

Copy constructor.

Definition at line 1462 of file colorutils.h.

◆ CRGBPalette32() [4/18]

CRGBPalette32::CRGBPalette32 ( const CRGB rhs[32])
inline

Create palette from array of CRGB colors.

Definition at line 1467 of file colorutils.h.

◆ CRGBPalette32() [5/18]

CRGBPalette32::CRGBPalette32 ( const CHSVPalette32 & rhs)
inline

Create palette from CHSV palette.

Definition at line 1485 of file colorutils.h.

◆ CRGBPalette32() [6/18]

CRGBPalette32::CRGBPalette32 ( const CHSV rhs[32])
inline

Create palette from array of CHSV colors.

Definition at line 1492 of file colorutils.h.

◆ CRGBPalette32() [7/18]

CRGBPalette32::CRGBPalette32 ( const TProgmemRGBPalette32 & rhs)
inline

Create palette from palette stored in PROGMEM.

Definition at line 1516 of file colorutils.h.

◆ CRGBPalette32() [8/18]

CRGBPalette32::CRGBPalette32 ( const CHSV & c1)
inline

Create palette filled with one color.

Parameters
c1the color to fill the palette with

Definition at line 1579 of file colorutils.h.

◆ CRGBPalette32() [9/18]

CRGBPalette32::CRGBPalette32 ( const CHSV & c1,
const CHSV & c2 )
inline

Create palette with a gradient from one color to another.

Parameters
c1the starting color for the gradient
c2the end color for the gradient

Definition at line 1584 of file colorutils.h.

◆ CRGBPalette32() [10/18]

CRGBPalette32::CRGBPalette32 ( const CHSV & c1,
const CHSV & c2,
const CHSV & c3 )
inline

Create palette with three-color gradient.

Parameters
c1the starting color for the gradient
c2the middle color for the gradient
c3the end color for the gradient

Definition at line 1589 of file colorutils.h.

◆ CRGBPalette32() [11/18]

CRGBPalette32::CRGBPalette32 ( const CHSV & c1,
const CHSV & c2,
const CHSV & c3,
const CHSV & c4 )
inline

Create palette with four-color gradient.

Parameters
c1the starting color for the gradient
c2the first middle color for the gradient
c3the second middle color for the gradient
c4the end color for the gradient

Definition at line 1594 of file colorutils.h.

◆ CRGBPalette32() [12/18]

CRGBPalette32::CRGBPalette32 ( const CRGB & c1)
inline

Create palette filled with one color.

Parameters
c1the color to fill the palette with

Definition at line 1600 of file colorutils.h.

◆ CRGBPalette32() [13/18]

CRGBPalette32::CRGBPalette32 ( const CRGB & c1,
const CRGB & c2 )
inline

Create palette with a gradient from one color to another.

Parameters
c1the starting color for the gradient
c2the end color for the gradient

Definition at line 1605 of file colorutils.h.

◆ CRGBPalette32() [14/18]

CRGBPalette32::CRGBPalette32 ( const CRGB & c1,
const CRGB & c2,
const CRGB & c3 )
inline

Create palette with three-color gradient.

Parameters
c1the starting color for the gradient
c2the middle color for the gradient
c3the end color for the gradient

Definition at line 1610 of file colorutils.h.

◆ CRGBPalette32() [15/18]

CRGBPalette32::CRGBPalette32 ( const CRGB & c1,
const CRGB & c2,
const CRGB & c3,
const CRGB & c4 )
inline

Create palette with four-color gradient.

Parameters
c1the starting color for the gradient
c2the first middle color for the gradient
c3the second middle color for the gradient
c4the end color for the gradient

Definition at line 1615 of file colorutils.h.

◆ CRGBPalette32() [16/18]

CRGBPalette32::CRGBPalette32 ( const CRGBPalette16 & rhs16)
inline

Create upscaled palette from 16-entry palette.

Definition at line 1622 of file colorutils.h.

◆ CRGBPalette32() [17/18]

CRGBPalette32::CRGBPalette32 ( const TProgmemRGBPalette16 & rhs)
inline

Create palette from palette stored in PROGMEM.

Definition at line 1634 of file colorutils.h.

◆ CRGBPalette32() [18/18]

CRGBPalette32::CRGBPalette32 ( TProgmemRGBGradientPalette_bytes progpal)
inline

Creates a palette from a gradient palette in PROGMEM.

Gradient palettes are loaded into CRGBPalettes in such a way that, if possible, every color represented in the gradient palette is also represented in the CRGBPalette.

For example, consider a gradient palette that is all black except for a single, one-element-wide (1/256th!) spike of red in the middle:

0, 0,0,0
124, 0,0,0
125, 255,0,0 // one 1/256th-palette-wide red stripe
126, 0,0,0
255, 0,0,0

A naive conversion of this 256-element palette to a 16-element palette might accidentally completely eliminate the red spike, rendering the palette completely black.

However, the conversions provided here would attempt to include a the red stripe in the output, more-or-less as faithfully as possible. So in this case, the resulting CRGBPalette16 palette would have a red stripe in the middle which was 1/16th of a palette wide – the narrowest possible in a CRGBPalette16.

This means that the relative width of stripes in a CRGBPalette16 will be, by definition, different from the widths in the gradient palette. This code attempts to preserve "all the colors", rather than the exact stripe widths at the expense of dropping some colors.

Definition at line 1649 of file colorutils.h.

Member Function Documentation

◆ loadDynamicGradientPalette()

CRGBPalette32 & CRGBPalette32::loadDynamicGradientPalette ( TDynamicRGBGradientPalette_bytes gpal)
inline

Creates a palette from a gradient palette in dynamic (heap) memory.

Gradient palettes are loaded into CRGBPalettes in such a way that, if possible, every color represented in the gradient palette is also represented in the CRGBPalette.

For example, consider a gradient palette that is all black except for a single, one-element-wide (1/256th!) spike of red in the middle:

0, 0,0,0
124, 0,0,0
125, 255,0,0 // one 1/256th-palette-wide red stripe
126, 0,0,0
255, 0,0,0

A naive conversion of this 256-element palette to a 16-element palette might accidentally completely eliminate the red spike, rendering the palette completely black.

However, the conversions provided here would attempt to include a the red stripe in the output, more-or-less as faithfully as possible. So in this case, the resulting CRGBPalette16 palette would have a red stripe in the middle which was 1/16th of a palette wide – the narrowest possible in a CRGBPalette16.

This means that the relative width of stripes in a CRGBPalette16 will be, by definition, different from the widths in the gradient palette. This code attempts to preserve "all the colors", rather than the exact stripe widths at the expense of dropping some colors.

Definition at line 1697 of file colorutils.h.

◆ operator CRGB *()

CRGBPalette32::operator CRGB * ( )
inline

Get the underlying pointer to the CRGB entries making up the palette.

Definition at line 1573 of file colorutils.h.

◆ operator!=()

bool CRGBPalette32::operator!= ( const CRGBPalette32 & rhs) const
inline

Check if two palettes do not have the same color entries.

Definition at line 1545 of file colorutils.h.

◆ operator=() [1/8]

CRGBPalette32 & CRGBPalette32::operator= ( const CHSV rhs[32])
inline

Create palette from array of CHSV colors.

Definition at line 1507 of file colorutils.h.

◆ operator=() [2/8]

CRGBPalette32 & CRGBPalette32::operator= ( const CHSVPalette32 & rhs)
inline

Create palette from CHSV palette.

Definition at line 1499 of file colorutils.h.

◆ operator=() [3/8]

CRGBPalette32 & CRGBPalette32::operator= ( const CRGB rhs[32])
inline

Create palette from array of CRGB colors.

Definition at line 1478 of file colorutils.h.

◆ operator=() [4/8]

CRGBPalette32 & CRGBPalette32::operator= ( const CRGBPalette16 & rhs16)
inline

Create upscaled palette from 16-entry palette.

Definition at line 1627 of file colorutils.h.

◆ operator=() [5/8]

CRGBPalette32 & CRGBPalette32::operator= ( const CRGBPalette32 & rhs)
inline

Copy constructor.

Definition at line 1472 of file colorutils.h.

◆ operator=() [6/8]

CRGBPalette32 & CRGBPalette32::operator= ( const TProgmemRGBPalette16 & rhs)
inline

Create palette from palette stored in PROGMEM.

Definition at line 1640 of file colorutils.h.

◆ operator=() [7/8]

CRGBPalette32 & CRGBPalette32::operator= ( const TProgmemRGBPalette32 & rhs)
inline

Create palette from palette stored in PROGMEM.

Definition at line 1523 of file colorutils.h.

◆ operator=() [8/8]

CRGBPalette32 & CRGBPalette32::operator= ( TProgmemRGBGradientPalette_bytes progpal)
inline

Creates a palette from a gradient palette in PROGMEM.

Gradient palettes are loaded into CRGBPalettes in such a way that, if possible, every color represented in the gradient palette is also represented in the CRGBPalette.

For example, consider a gradient palette that is all black except for a single, one-element-wide (1/256th!) spike of red in the middle:

0, 0,0,0
124, 0,0,0
125, 255,0,0 // one 1/256th-palette-wide red stripe
126, 0,0,0
255, 0,0,0

A naive conversion of this 256-element palette to a 16-element palette might accidentally completely eliminate the red spike, rendering the palette completely black.

However, the conversions provided here would attempt to include a the red stripe in the output, more-or-less as faithfully as possible. So in this case, the resulting CRGBPalette16 palette would have a red stripe in the middle which was 1/16th of a palette wide – the narrowest possible in a CRGBPalette16.

This means that the relative width of stripes in a CRGBPalette16 will be, by definition, different from the widths in the gradient palette. This code attempts to preserve "all the colors", rather than the exact stripe widths at the expense of dropping some colors.

Definition at line 1654 of file colorutils.h.

◆ operator==()

bool CRGBPalette32::operator== ( const CRGBPalette32 & rhs) const
inline

Check if two palettes have the same color entries.

Definition at line 1532 of file colorutils.h.

◆ operator[]() [1/4]

CRGB & CRGBPalette32::operator[] ( int x)
inline

Array access operator to index into the gradient entries.

Parameters
xthe index to retrieve
Returns
reference to an entry in the palette's color array
Note
This does not perform any interpolation like ColorFromPalette(), it accesses the underlying entries that make up the gradient. Beware of bounds issues!

Definition at line 1562 of file colorutils.h.

◆ operator[]() [2/4]

const CRGB & CRGBPalette32::operator[] ( int x) const
inline

Array access operator to index into the gradient entries.

Parameters
xthe index to retrieve
Returns
reference to an entry in the palette's color array
Note
This does not perform any interpolation like ColorFromPalette(), it accesses the underlying entries that make up the gradient. Beware of bounds issues!

Definition at line 1567 of file colorutils.h.

◆ operator[]() [3/4]

CRGB & CRGBPalette32::operator[] ( uint8_t x)
inline

Array access operator to index into the gradient entries.

Parameters
xthe index to retrieve
Returns
reference to an entry in the palette's color array
Note
This does not perform any interpolation like ColorFromPalette(), it accesses the underlying entries that make up the gradient. Beware of bounds issues!

Definition at line 1551 of file colorutils.h.

◆ operator[]() [4/4]

const CRGB & CRGBPalette32::operator[] ( uint8_t x) const
inline

Array access operator to index into the gradient entries.

Parameters
xthe index to retrieve
Returns
reference to an entry in the palette's color array
Note
This does not perform any interpolation like ColorFromPalette(), it accesses the underlying entries that make up the gradient. Beware of bounds issues!

Definition at line 1556 of file colorutils.h.

Member Data Documentation

◆ entries

CRGB CRGBPalette32::entries[32]

the color entries that make up the palette

Definition at line 1438 of file colorutils.h.


The documentation for this class was generated from the following file: