FastLED 3.9.15
Loading...
Searching...
No Matches
fl Namespace Reference

Detailed Description

Implements a simple red square effect for 2D LED grids.

Namespaces

namespace  anonymous_namespace{allocator.cpp}
 
namespace  anonymous_namespace{blur.cpp}
 
namespace  anonymous_namespace{five_bit_hd_gamma.cpp}
 
namespace  anonymous_namespace{frame_tracker.cpp}
 
namespace  anonymous_namespace{gradient.cpp}
 
namespace  anonymous_namespace{line_simplification.cpp}
 
namespace  anonymous_namespace{noise_woryley.cpp}
 
namespace  anonymous_namespace{pir.cpp}
 
namespace  anonymous_namespace{wave.cpp}
 
namespace  anonymous_namespace{xypath.cpp}
 
namespace  anonymous_namespace{xypath_renderer.cpp}
 
namespace  map_range_detail
 
namespace  string_functions
 
namespace  wave_detail
 
namespace  xypath_detail
 

Classes

struct  _DrawContext
 
struct  add_pointer
 
struct  add_pointer< T & >
 
struct  add_pointer< T && >
 
class  Animartrix
 
struct  AnimartrixEntry
 ################################################## Details with the implementation of Animartrix More...
 
class  ArchimedeanSpiralPath
 
class  array
 A fixed-size array implementation similar to std::array. More...
 
struct  ArrayDeleter
 
class  AudioSample
 
class  AudioSampleImpl
 
class  bitset_dynamic
 A dynamic bitset implementation that can be resized at runtime. More...
 
class  BitsetFixed
 A simple fixed-size Bitset implementation similar to std::Bitset. More...
 
class  BitsetInlined
 A Bitset implementation with inline storage that can grow if needed. More...
 
class  Blend2d
 
struct  Blend2dParams
 
class  ByteStream
 
class  ByteStreamMemory
 
class  CatmullRomParams
 
class  CatmullRomPath
 Catmull–Rom spline through arbitrary points. More...
 
class  CirclePath
 
class  CircularBuffer
 
struct  conditional
 
struct  conditional< false, T, F >
 
struct  contains_type
 
struct  contains_type< T >
 
struct  contains_type< T, U, Rest... >
 
class  Cylon
 An animation that moves a single LED back and forth (Larson Scanner effect) More...
 
struct  decay
 
struct  DefaultLess
 
class  DemoReel100
 
class  DigitalPin
 
class  DigitalPinImpl
 
struct  DrawItem
 
struct  Empty
 
struct  enable_if
 
struct  enable_if< true, T >
 
class  EngineEvents
 
struct  EqualTo
 
class  FakeStrStream
 
struct  FastHash
 
struct  FastHash< vec2< T > >
 
class  FastLEDANIMartRIX
 
class  FFT
 
struct  FFT_Args
 
struct  FFTBins
 
class  FFTContext
 
class  FFTImpl
 
class  FileHandle
 
class  FileSystem
 
class  Fire2012
 
class  FixedMap
 
class  FixedSet
 
class  FixedVector
 
class  Frame
 
class  FrameInterpolator
 
class  FrameTracker
 
class  FsImpl
 
class  function
 
class  function< R(Args...)>
 
class  FunctionList
 
class  FunctionList< void >
 
class  FunctionListBase
 
class  Fx
 
class  Fx1d
 
class  Fx2d
 
class  FxCompositor
 
class  FxEngine
 Manages and renders multiple visual effects (Fx) for LED strips. More...
 
class  FxLayer
 
class  GielisCurveParams
 
class  GielisCurvePath
 
class  Gradient
 
class  GradientInlined
 
class  Grid
 
struct  has_member_swap
 
struct  Hash
 
struct  Hash< FFT_Args >
 
struct  Hash< Ptr< T > >
 
struct  Hash< T * >
 
struct  Hash< vec2< T > >
 
class  HashMap
 
class  HashMapLru
 
class  HashSet
 
class  HeapVector
 
class  HeartPath
 
struct  InlinedMemoryBlock
 
class  InlinedVector
 
struct  is_array
 
struct  is_array< T[]>
 
struct  is_array< T[N]>
 
struct  is_base_of
 
struct  is_base_of_v_helper
 
struct  is_function
 
struct  is_function< Ret(Args...) const >
 
struct  is_function< Ret(Args...) const volatile >
 
struct  is_function< Ret(Args...) volatile >
 
struct  is_function< Ret(Args...)>
 
struct  is_integral
 
struct  is_integral< bool >
 
struct  is_integral< char >
 
struct  is_integral< const T >
 
struct  is_integral< int >
 
struct  is_integral< long >
 
struct  is_integral< long long >
 
struct  is_integral< short >
 
struct  is_integral< signed char >
 
struct  is_integral< T & >
 
struct  is_integral< unsigned char >
 
struct  is_integral< unsigned int >
 
struct  is_integral< unsigned long >
 
struct  is_integral< unsigned long long >
 
struct  is_integral< unsigned short >
 
struct  is_integral< volatile T >
 
struct  is_lvalue_reference
 
struct  is_lvalue_reference< T & >
 
struct  is_member_function_pointer
 
struct  is_member_function_pointer< Ret(C::*)(A...) const >
 
struct  is_member_function_pointer< Ret(C::*)(A...)>
 
struct  is_pod
 
struct  is_pod< bool >
 
struct  is_pod< char >
 
struct  is_pod< double >
 
struct  is_pod< float >
 
struct  is_pod< int >
 
struct  is_pod< long >
 
struct  is_pod< long double >
 
struct  is_pod< long long >
 
struct  is_pod< short >
 
struct  is_pod< signed char >
 
struct  is_pod< unsigned char >
 
struct  is_pod< unsigned int >
 
struct  is_pod< unsigned long >
 
struct  is_pod< unsigned long long >
 
struct  is_pod< unsigned short >
 
struct  is_pod_v_helper
 
struct  is_same
 
struct  is_same< T, T >
 
struct  is_same_v_helper
 
class  JsonDocument
 
class  LargeBlockAllocator
 
class  Leds
 
class  LedsXY
 
struct  less
 Binary function object that returns whether the first argument is less than the second. More...
 
struct  less< void >
 Specialization of less for void, allowing for transparent comparisons. More...
 
struct  line_xy
 
class  LinePath
 
class  LinePathParams
 
class  LineSimplifier
 
class  LineSimplifierExact
 
class  LUT
 
struct  Matrix3x3f
 
class  MatrixSlice
 
struct  max_align
 
struct  max_align< T, Rest... >
 
struct  max_align<>
 
struct  max_size
 
struct  max_size< T, Rest... >
 
struct  max_size<>
 
class  NoisePalette
 
class  NoiseWave
 
class  NullFileHandle
 
class  NullFileSystem
 
class  ObjectFLED
 
class  Optional
 
class  Pacifica
 
struct  Pair
 
struct  pair_xy
 
class  PhyllotaxisParams
 
class  PhyllotaxisPath
 
class  Pir
 
class  PirAdvanced
 
struct  Pixel
 
union  Pixel.__unnamed0__
 
struct  Pixel.__unnamed0__.__unnamed0__
 
class  Pixels
 
class  PixelStream
 
struct  PointerDeleter
 
class  PointPath
 
class  Pride2015
 
class  PriorityQueue
 
class  Ptr
 
class  PtrTraits
 
struct  rect
 
class  RectangularDrawBuffer
 
class  RedSquare
 
class  Referent
 
struct  remove_const
 
struct  remove_const< const T >
 
struct  remove_cv
 
struct  remove_cv< const T >
 
struct  remove_cv< const volatile T >
 
struct  remove_cv< volatile T >
 
struct  remove_extent
 
struct  remove_extent< T[]>
 
struct  remove_extent< T[N]>
 
struct  remove_reference
 
struct  remove_reference< T & >
 
struct  remove_reference< T && >
 
class  RosePath
 
class  RosePathParams
 
class  ScaleUp
 
class  scoped_array
 
class  scoped_ptr
 
class  ScreenMap
 
class  Singleton
 
class  Slice
 
class  SortedHeapMap
 
class  SortedHeapVector
 
class  SoundLevelMeter
 
class  Str
 
class  StringFormatter
 
class  StringHolder
 
class  StrN
 
class  StrStream
 
struct  StrStreamHelper
 
struct  StrStreamHelper< char >
 
struct  StrStreamHelper< int >
 
struct  StrStreamHelper< uint8_t >
 
struct  StrStreamHelper< unsigned int >
 
struct  swap_impl
 
struct  swap_impl< T, false >
 
struct  swap_impl< T, true >
 
class  ThreadLocalFake
 
class  Tile2x2_u8
 
class  TimeAlpha
 
class  TimeClampedTransition
 
class  TimeFunction
 
class  TimeRamp
 
class  TimeWarp
 
struct  Transform16
 
struct  TransformFloat
 
class  TransformFloatImpl
 
class  Transition
 
class  TwinkleFox
 
class  UIAudio
 
class  UIAudioImpl
 
class  UIButton
 
class  UIButtonImpl
 
class  UICheckbox
 
class  UICheckboxImpl
 
class  UIDescription
 
class  UIDescriptionImpl
 
class  UINumberField
 
class  UINumberFieldImpl
 
class  UISlider
 
class  UISliderImpl
 
class  UITitle
 
class  UITitleImpl
 
class  Variant
 
struct  vec2
 
struct  vec3
 
class  Video
 
class  VideoFxWrapper
 
class  WaveCrgbGradientMap
 
class  WaveCrgbMap
 
class  WaveCrgbMapDefault
 
class  WaveFx
 
struct  WaveFxArgs
 
class  WaveSimulation1D
 
class  WaveSimulation1D_Real
 
class  WaveSimulation2D
 
class  WaveSimulation2D_Real
 
class  WeakPtr
 
class  WeakReferent
 
class  XMap
 
struct  XYDrawComposited
 
struct  XYDrawGradient
 
class  XYMap
 
class  XYPath
 
class  XYPathFunction
 
class  XYPathGenerator
 
class  XYPathParams
 
class  XYPathRenderer
 
class  XYRasterU8Sparse
 

Typedefs

template<typename T>
using add_pointer_t = typename add_pointer<T>::type
 
using alpha16
 
template<uint32_t N = 256>
using bitset = BitsetInlined<N>
 
template<uint32_t N>
using bitset_fixed = BitsetFixed<N>
 
template<bool B, typename T, typename F>
using conditional_t = typename conditional<B, T, F>::type
 
typedef int64_t cycle_t
 8.8 fixed point (signed) value
 
template<typename T>
using decay_t = typename decay<T>::type
 
template<bool Condition, typename T = void>
using enable_if_t = typename enable_if<Condition, T>::type
 
template<typename T>
using equal_to = EqualTo<T>
 
template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = equal_to<Key>>
using hash_map = HashMap<Key, T, Hash, KeyEqual>
 
template<typename Key, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>>
using hash_set = HashSet<Key, Hash, KeyEqual>
 
template<typename Base, typename Derived>
using is_derived = enable_if_t<is_base_of<Base, Derived>::value>
 
typedef LUT< uint16_t > LUT16
 
typedef LUT< vec2< uint16_t > > LUTXY16
 
typedef LUT< vec2fLUTXYFLOAT
 
typedef LUT< vec3fLUTXYZFLOAT
 
template<typename T>
using optional = Optional<T>
 
template<typename Key, typename Value>
using pair = Pair<Key, Value>
 
using pair_xy_float = vec2<float>
 
using pair_xyz_float = vec3<float>
 
template<typename T>
using remove_cv_t = typename remove_cv<T>::type
 
template<typename T>
using remove_reference_t = typename remove_reference<T>::type
 
using string = fl::Str
 
template<typename T>
using ThreadLocal = ThreadLocalFake<T>
 
template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = equal_to<Key>>
using unordered_map = HashMap<Key, T, Hash, KeyEqual>
 
using vec2f = vec2<float>
 
using vec3f = vec3<float>
 
template<typename T>
using vector = HeapVector<T>
 
template<typename T, size_t INLINED_SIZE>
using vector_fixed = FixedVector<T, INLINED_SIZE>
 
template<typename T, size_t INLINED_SIZE = 64>
using vector_inlined = InlinedVector<T, INLINED_SIZE>
 
typedef uint16_t(* XFunction) (uint16_t x, uint16_t length)
 
typedef uint16_t(* XYFunction) (uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 
using XYRaster = XYRasterU8Sparse
 

Enumerations

enum  AnimartrixAnim {
  RGB_BLOBS5 = 0 , RGB_BLOBS4 , RGB_BLOBS3 , RGB_BLOBS2 ,
  RGB_BLOBS , POLAR_WAVES , SLOW_FADE , ZOOM2 ,
  ZOOM , HOT_BLOB , SPIRALUS2 , SPIRALUS ,
  YVES , SCALEDEMO1 , LAVA1 , CALEIDO3 ,
  CALEIDO2 , CALEIDO1 , DISTANCE_EXPERIMENT , CENTER_FIELD ,
  WAVES , CHASING_SPIRALS , ROTATING_BLOB , RINGS ,
  COMPLEX_KALEIDO , COMPLEX_KALEIDO_2 , COMPLEX_KALEIDO_3 , COMPLEX_KALEIDO_4 ,
  COMPLEX_KALEIDO_5 , COMPLEX_KALEIDO_6 , WATER , PARAMETRIC_WATER ,
  MODULE_EXPERIMENT1 , MODULE_EXPERIMENT2 , MODULE_EXPERIMENT3 , MODULE_EXPERIMENT4 ,
  MODULE_EXPERIMENT5 , MODULE_EXPERIMENT6 , MODULE_EXPERIMENT7 , MODULE_EXPERIMENT8 ,
  MODULE_EXPERIMENT9 , MODULE_EXPERIMENT10 , MODULE_EXPERIMENT_SM1 , MODULE_EXPERIMENT_SM2 ,
  MODULE_EXPERIMENT_SM3 , MODULE_EXPERIMENT_SM4 , MODULE_EXPERIMENT_SM5 , MODULE_EXPERIMENT_SM6 ,
  MODULE_EXPERIMENT_SM8 , MODULE_EXPERIMENT_SM9 , MODULE_EXPERIMENT_SM10 , NUM_ANIMATIONS
}
 
enum  DrawMode { DRAW_MODE_OVERWRITE , DRAW_MODE_BLEND_BY_MAX_BRIGHTNESS }
 
enum  FiveBitGammaCorrectionMode { kFiveBitGammaCorrectionMode_Null = 0 , kFiveBitGammaCorrectionMode_BitShift = 1 }
 
enum  InsertResult { kInserted = 0 , kExists = 1 , kMaxSize = 2 }
 
enum class  leddirection { FORWARD , BACKWARD , MAP }
 
enum  SuperSample { SUPER_SAMPLE_NONE = 1 , SUPER_SAMPLE_2X = 2 , SUPER_SAMPLE_4X = 4 , SUPER_SAMPLE_8X = 8 }
 
enum  TGradientDirectionCode { FORWARD_HUES , BACKWARD_HUES , SHORTEST_HUES , LONGEST_HUES }
 Hue direction for calculating fill gradients. More...
 
enum  U8EasingFunction { WAVE_U8_MODE_LINEAR , WAVE_U8_MODE_SQRT }
 

Functions

void __builtin_five_bit_hd_gamma_bitshift (CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
 
void AnimartrixLoop (Animartrix &self, uint32_t now)
 
CRGB applyGamma_video (const CRGB &orig, float gamma)
 
CRGB applyGamma_video (const CRGB &orig, float gammaR, float gammaG, float gammaB)
 
uint8_t applyGamma_video (uint8_t brightness, float gamma)
 
void bilinearExpand (const CRGB *input, CRGB *output, uint16_t inputWidth, uint16_t inputHeight, fl::XYMap xyMap)
 
void bilinearExpandArbitrary (const CRGB *input, CRGB *output, uint16_t inputWidth, uint16_t inputHeight, fl::XYMap xyMap)
 Performs bilinear interpolation for upscaling an image.
 
void bilinearExpandArbitraryFloat (const CRGB *input, CRGB *output, uint16_t inputWidth, uint16_t inputHeight, XYMap xyMap)
 
void bilinearExpandFloat (const CRGB *input, CRGB *output, uint8_t inputWidth, uint8_t inputHeight, XYMap xyMap)
 
void bilinearExpandPowerOf2 (const CRGB *input, CRGB *output, uint8_t inputWidth, uint8_t inputHeight, fl::XYMap xyMap)
 Performs bilinear interpolation for upscaling an image.
 
uint8_t bilinearInterpolate (uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, uint16_t dx, uint16_t dy)
 
uint8_t bilinearInterpolateFloat (uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, float dx, float dy)
 
uint8_t bilinearInterpolatePowerOf2 (uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, uint8_t dx, uint8_t dy)
 
CHSV blend (const CHSV &p1, const CHSV &p2, fract8 amountOfP2, TGradientDirectionCode directionCode)
 
CHSVblend (const CHSV *src1, const CHSV *src2, CHSV *dest, uint16_t count, fract8 amountOfsrc2, TGradientDirectionCode directionCode)
 
CRGB blend (const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
 
CRGBblend (const CRGB *src1, const CRGB *src2, CRGB *dest, uint16_t count, fract8 amountOfsrc2)
 
void blur1d (CRGB *leds, uint16_t numLeds, fract8 blur_amount)
 One-dimensional blur filter.
 
void blur2d (CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount) FASTLED_DEPRECATED("Use blur2d(...
 Legacy version of blur2d, which does not require an XYMap but instead implicitly binds to XY() function.
 
void blur2d (CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const fl::XYMap &xymap)
 Two-dimensional blur filter.
 
void blurColumns (CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const fl::XYMap &xymap)
 Perform a blur1d() on every column of a rectangular matrix.
 
void blurRows (CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const fl::XYMap &xymap)
 Perform a blur1d() on every row of a rectangular matrix.
 
template<typename T>
ceil (T value)
 
template<typename T>
FASTLED_FORCE_INLINEclamp (T value, T min, T max)
 
template<int N>
void clear (CRGB(&arr)[N])
 
void clear (Leds &leds)
 
CHSV ColorFromPalette (const CHSVPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CHSV ColorFromPalette (const CHSVPalette256 &pal, uint8_t index, uint8_t brightness, TBlendType)
 
CHSV ColorFromPalette (const CHSVPalette32 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPalette (const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPalette (const CRGBPalette256 &pal, uint8_t index, uint8_t brightness, TBlendType)
 
CRGB ColorFromPalette (const CRGBPalette32 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPalette (const TProgmemRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPalette (const TProgmemRGBPalette32 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPaletteExtended (const CRGBPalette16 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPaletteExtended (const CRGBPalette256 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
 
CRGB ColorFromPaletteExtended (const CRGBPalette32 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
 
static FASTLED_FORCE_INLINE int16_t cos16lut (uint16_t angle)
 
static FASTLED_FORCE_INLINE int32_t cos32 (uint32_t angle)
 
void downscale (const CRGB *src, const XYMap &srcXY, CRGB *dst, const XYMap &dstXY)
 
void downscaleArbitrary (const CRGB *src, const XYMap &srcXY, CRGB *dst, const XYMap &dstXY)
 
void downscaleHalf (const CRGB *src, const XYMap &srcXY, CRGB *dst, const XYMap &dstXY)
 
void downscaleHalf (const CRGB *src, uint16_t srcWidth, uint16_t srcHeight, CRGB *dst)
 
void drawSquare (void *, uint16_t, uint16_t, int, int, uint32_t, uint32_t)
 
void fade_raw (CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
 
void fade_video (CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
 
void fadeLightBy (CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
 
void fadeToBlackBy (CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
 
void fadeToColorBy (void *, uint16_t, uint32_t, uint8_t)
 
void fadeUsingColor (CRGB *leds, uint16_t numLeds, const CRGB &colormask)
 
static uint32_t fast_hash32 (uint32_t x) noexcept
 
const char * fastled_file_offset (const char *file)
 
 FASTLED_SMART_PTR (Animartrix)
 
 FASTLED_SMART_PTR (ArchimedeanSpiralPath)
 
 FASTLED_SMART_PTR (AudioSampleImpl)
 
 FASTLED_SMART_PTR (Blend2d)
 
 FASTLED_SMART_PTR (ByteStream)
 
 FASTLED_SMART_PTR (ByteStreamMemory)
 
 FASTLED_SMART_PTR (CatmullRomParams)
 
 FASTLED_SMART_PTR (CatmullRomPath)
 
 FASTLED_SMART_PTR (CirclePath)
 
 FASTLED_SMART_PTR (Cylon)
 
 FASTLED_SMART_PTR (DemoReel100)
 
 FASTLED_SMART_PTR (DigitalPinImpl)
 
 FASTLED_SMART_PTR (FileHandle)
 
 FASTLED_SMART_PTR (FileSystem)
 
 FASTLED_SMART_PTR (Fire2012)
 Simple one-dimensional fire animation function.
 
 FASTLED_SMART_PTR (Frame)
 
 FASTLED_SMART_PTR (FrameInterpolator)
 
 FASTLED_SMART_PTR (FsImpl)
 
 FASTLED_SMART_PTR (Fx)
 
 FASTLED_SMART_PTR (Fx2d)
 
 FASTLED_SMART_PTR (FxLayer)
 
 FASTLED_SMART_PTR (GielisCurvePath)
 
 FASTLED_SMART_PTR (HeartPath)
 
 FASTLED_SMART_PTR (LinePath)
 
 FASTLED_SMART_PTR (LinePathParams)
 
 FASTLED_SMART_PTR (NoisePalette)
 
 FASTLED_SMART_PTR (NoiseWave)
 
 FASTLED_SMART_PTR (Pacifica)
 
 FASTLED_SMART_PTR (PhyllotaxisPath)
 
 FASTLED_SMART_PTR (PixelStream)
 
 FASTLED_SMART_PTR (PointPath)
 
 FASTLED_SMART_PTR (Pride2015)
 
 FASTLED_SMART_PTR (RedSquare)
 
 FASTLED_SMART_PTR (RosePath)
 
 FASTLED_SMART_PTR (RosePathParams)
 
 FASTLED_SMART_PTR (ScaleUp)
 
 FASTLED_SMART_PTR (StringHolder)
 
 FASTLED_SMART_PTR (TimeFunction)
 
 FASTLED_SMART_PTR (TimeWarp)
 
 FASTLED_SMART_PTR (TransformFloatImpl)
 
 FASTLED_SMART_PTR (TwinkleFox)
 
 FASTLED_SMART_PTR (VideoFxWrapper)
 
 FASTLED_SMART_PTR (VideoImpl)
 
 FASTLED_SMART_PTR (WaveCrgbGradientMap)
 
 FASTLED_SMART_PTR (WaveCrgbMap)
 
 FASTLED_SMART_PTR (WaveCrgbMapDefault)
 
 FASTLED_SMART_PTR (WaveFx)
 
 FASTLED_SMART_PTR (XYPath)
 
 FASTLED_SMART_PTR (XYPathFunction)
 
 FASTLED_SMART_PTR (XYPathGenerator)
 
 FASTLED_SMART_PTR (XYPathRenderer)
 
 FASTLED_SMART_PTR_NO_FWD (LUT16)
 
 FASTLED_SMART_PTR_NO_FWD (LUTXY16)
 
 FASTLED_SMART_PTR_NO_FWD (LUTXYFLOAT)
 
 FASTLED_SMART_PTR_NO_FWD (LUTXYZFLOAT)
 
 FASTLED_UI_DEFINE_OPERATORS (UIButton)
 
 FASTLED_UI_DEFINE_OPERATORS (UICheckbox)
 
 FASTLED_UI_DEFINE_OPERATORS (UINumberField)
 
 FASTLED_UI_DEFINE_OPERATORS (UISlider)
 
template<typename T>
void fill_gradient (T *targetArray, uint16_t numLeds, const CHSV &c1, const CHSV &c2, const CHSV &c3, const CHSV &c4, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Fill a range of LEDs with a smooth HSV gradient between four HSV colors.
 
template<typename T>
void fill_gradient (T *targetArray, uint16_t numLeds, const CHSV &c1, const CHSV &c2, const CHSV &c3, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Fill a range of LEDs with a smooth HSV gradient between three HSV colors.
 
template<typename T>
void fill_gradient (T *targetArray, uint16_t numLeds, const CHSV &c1, const CHSV &c2, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Fill a range of LEDs with a smooth HSV gradient between two HSV colors.
 
template<typename T>
void fill_gradient (T *targetArray, uint16_t startpos, CHSV startcolor, uint16_t endpos, CHSV endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
 Fill a range of LEDs with a smooth HSV gradient between two HSV colors.
 
void fill_gradient_RGB (CRGB *leds, uint16_t numLeds, const CRGB &c1, const CRGB &c2)
 Fill a range of LEDs with a smooth RGB gradient between two RGB colors.
 
void fill_gradient_RGB (CRGB *leds, uint16_t numLeds, const CRGB &c1, const CRGB &c2, const CRGB &c3)
 Fill a range of LEDs with a smooth RGB gradient between three RGB colors.
 
void fill_gradient_RGB (CRGB *leds, uint16_t numLeds, const CRGB &c1, const CRGB &c2, const CRGB &c3, const CRGB &c4)
 Fill a range of LEDs with a smooth RGB gradient between four RGB colors.
 
void fill_gradient_RGB (CRGB *leds, uint16_t startpos, CRGB startcolor, uint16_t endpos, CRGB endcolor)
 Fill a range of LEDs with a smooth RGB gradient between two RGB colors.
 
void fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
 Fill a range of LEDs with a rainbow of colors.
 
void fill_rainbow (struct CRGB *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
 Fill a range of LEDs with a rainbow of colors.
 
void fill_rainbow_circular (struct CHSV *targetArray, int numToFill, uint8_t initialhue, bool reversed=false)
 Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the strip and the beginning.
 
void fill_rainbow_circular (struct CRGB *targetArray, int numToFill, uint8_t initialhue, bool reversed=false)
 Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the strip and the beginning.
 
void fill_solid (struct CHSV *targetArray, int numToFill, const struct CHSV &color)
 Fill a range of LEDs with a solid color.
 
void fill_solid (struct CRGB *targetArray, int numToFill, const struct CRGB &color)
 Fill a range of LEDs with a solid color.
 
uint8_t five_bit_bitshift (uint16_t r16, uint16_t g16, uint16_t b16, uint8_t brightness, CRGB *out, uint8_t *out_power_5bit)
 
FASTLED_FORCE_INLINE void five_bit_hd_gamma_bitshift (CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
 
void five_bit_hd_gamma_function (CRGB color, uint16_t *r16, uint16_t *g16, uint16_t *b16)
 
template<typename T>
fl_abs (T value)
 
template<typename T>
floor (T value)
 
template<typename T>
constexpr T && forward (typename remove_reference< T >::type &&t) noexcept
 
template<typename T>
constexpr T && forward (typename remove_reference< T >::type &t) noexcept
 
static uint32_t hash_pair (uint32_t a, uint32_t b, uint32_t seed=0) noexcept
 
CRGB HeatColor (uint8_t temperature)
 
void * LargeBlockAllocate (size_t size, bool zero)
 
void LargeBlockDeallocate (void *ptr)
 
uint8_t lsrX4 (uint8_t dividend)
 Helper function to divide a number by 16, aka four logical shift right (LSR)'s.
 
FsImplPtr make_sdcard_filesystem (int cs_pin)
 
template<typename T, typename U>
FASTLED_FORCE_INLINEmap_range (T value, T in_min, T in_max, U out_min, U out_max)
 
template<typename T, typename U>
FASTLED_FORCE_INLINEmap_range_clamped (T value, T in_min, T in_max, U out_min, U out_max)
 
template<typename T>
constexpr remove_reference< T >::type && move (T &&t) noexcept
 
static uint32_t MurmurHash3_x86_32 (const void *key, size_t len, uint32_t seed=0)
 
CRGBnapplyGamma_video (CRGB &rgb, float gamma)
 
CRGBnapplyGamma_video (CRGB &rgb, float gammaR, float gammaG, float gammaB)
 
void napplyGamma_video (CRGB *rgbarray, uint16_t count, float gamma)
 
void napplyGamma_video (CRGB *rgbarray, uint16_t count, float gammaR, float gammaG, float gammaB)
 
CHSVnblend (CHSV &existing, const CHSV &overlay, fract8 amountOfOverlay, TGradientDirectionCode directionCode)
 
void nblend (CHSV *existing, const CHSV *overlay, uint16_t count, fract8 amountOfOverlay, TGradientDirectionCode directionCode)
 
CRGBnblend (CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
 
void nblend (CRGB *existing, const CRGB *overlay, uint16_t count, fract8 amountOfOverlay)
 
void nblendPaletteTowardPalette (CRGBPalette16 &current, CRGBPalette16 &target, uint8_t maxChanges)
 
template<typename T, typename... Args>
Ptr< T > NewPtr (Args... args)
 
template<typename T, typename... Args>
Ptr< T > NewPtrNoTracking (Args... args)
 
template<typename T>
Ptr< T > NewPtrNoTracking (T &obj)
 
void nscale8 (CRGB *leds, uint16_t num_leds, uint8_t scale)
 
void nscale8_video (CRGB *leds, uint16_t num_leds, uint8_t scale)
 
template<typename T, size_t N>
bool operator!= (const array< T, N > &lhs, const array< T, N > &rhs)
 
template<typename T, size_t N>
bool operator== (const array< T, N > &lhs, const array< T, N > &rhs)
 
bool parseJson (const char *json, fl::JsonDocument *doc, Str *_error)
 
template<typename Iterator>
void pop_heap (Iterator first, Iterator last)
 
template<typename Iterator, typename Compare>
void pop_heap (Iterator first, Iterator last, Compare comp)
 
template<typename Iterator>
void push_heap (Iterator first, Iterator last)
 
template<typename Iterator, typename Compare>
void push_heap (Iterator first, Iterator last, Compare comp)
 
void SetLargeBlockAllocator (void *(*alloc)(size_t), void(*free)(void *))
 
template<typename Iterator, typename Compare>
void sift_down (Iterator first, Iterator last, Iterator start, Compare comp)
 
static FASTLED_FORCE_INLINE int16_t sin16lut (uint16_t angle)
 
static FASTLED_FORCE_INLINE int32_t sin32 (uint32_t angle)
 
template<typename T, size_t N>
void swap (array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 
template<typename T>
void swap (T &a, T &b)
 
template<typename T>
void swap_by_copy (T &a, T &b)
 
uint16_t time_alpha16 (uint32_t now, uint32_t start, uint32_t end)
 
uint8_t time_alpha8 (uint32_t now, uint32_t start, uint32_t end)
 
float time_alphaf (uint32_t now, uint32_t start, uint32_t end)
 
void toJson (const fl::JsonDocument &doc, Str *jsonBuffer)
 
template<typename GridVisitor>
void traverseGridSegment (const vec2f &start, const vec2f &end, GridVisitor &visitor)
 Traverse a grid segment by selecting the cells that are crossed.
 
template<typename GridVisitor>
void traverseGridSegment16 (const vec2f &start, const vec2f &end, GridVisitor &visitor)
 Traverse a grid segment using fixed-point 8.8 arithmetic.
 
template<typename GridVisitor>
void traverseGridSegment32 (const vec2f &start, const vec2f &end, GridVisitor &visitor)
 
template<typename GridVisitor>
void traverseGridSegmentFloat (const vec2f &start, const vec2f &end, GridVisitor &visitor)
 Traverse a grid segment using floating point arithmetic.
 
void UpscalePalette (const class CHSVPalette16 &srcpal16, class CHSVPalette256 &destpal256)
 
void UpscalePalette (const class CHSVPalette16 &srcpal16, class CHSVPalette32 &destpal32)
 
void UpscalePalette (const class CHSVPalette32 &srcpal32, class CHSVPalette256 &destpal256)
 
void UpscalePalette (const class CRGBPalette16 &srcpal16, class CRGBPalette256 &destpal256)
 
void UpscalePalette (const class CRGBPalette16 &srcpal16, class CRGBPalette32 &destpal32)
 
void UpscalePalette (const class CRGBPalette32 &srcpal32, class CRGBPalette256 &destpal256)
 
int32_t worley_noise_2d_q15 (int32_t x, int32_t y)
 
FASTLED_FORCE_INLINE uint16_t x_linear (uint16_t x, uint16_t length)
 
FASTLED_FORCE_INLINE uint16_t x_reverse (uint16_t x, uint16_t length)
 
uint16_t XY (uint8_t x, uint8_t y)
 
FASTLED_FORCE_INLINE uint16_t xy_line_by_line (uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 
FASTLED_FORCE_INLINE uint16_t xy_serpentine (uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 

Variables

const TProgmemRGBPalette16ActivePaletteList []
 
static const AnimartrixEntry ANIMATION_TABLE []
 
const TProgmemRGBPalette16 BlueWhite_p
 
const int16_t * cosArray = &sinLut[64]
 
const TProgmemRGBPalette16 FairyLight_p
 
static FFT gFlexFFT
 
const TProgmemRGBPalette16 Holly_p
 
const TProgmemRGBPalette16 Ice_p
 
void const fl::XYMap &xymap instead
 
const TProgmemRGBPalette16 RedGreenWhite_p
 
const TProgmemRGBPalette16 RedWhite_p
 
const TProgmemRGBPalette16 RetroC9_p
 
const int16_t * sinArray = &sinLut[0]
 
const int16_t sinLut []
 
const TProgmemRGBPalette16 Snow_p
 
Class Members
typedef T * type T *

◆ fl::add_pointer< T & >

struct fl::add_pointer< T & >
+ Inheritance diagram for fl::add_pointer< T & >:
+ Collaboration diagram for fl::add_pointer< T & >:
Class Members
typedef T * type
typedef T * type T *

◆ fl::add_pointer< T && >

struct fl::add_pointer< T && >
+ Inheritance diagram for fl::add_pointer< T && >:
+ Collaboration diagram for fl::add_pointer< T && >:
Class Members
typedef T * type
typedef T * type T *

◆ fl::AnimartrixEntry

struct fl::AnimartrixEntry
Class Members
AnimartrixAnim anim
void(FastLEDANIMartRIX::*)() func
const char * name

◆ fl::Blend2dParams

struct fl::Blend2dParams
Class Members
uint8_t blur_amount = 0
uint8_t blur_passes = 1

◆ fl::conditional

struct fl::conditional
+ Inheritance diagram for fl::conditional< B, T, F >:
Class Members
typedef T type T

◆ fl::conditional< false, T, F >

struct fl::conditional< false, T, F >
+ Inheritance diagram for fl::conditional< false, T, F >:
+ Collaboration diagram for fl::conditional< false, T, F >:
Class Members
typedef T type
typedef F type F

◆ fl::contains_type

struct fl::contains_type
+ Inheritance diagram for fl::contains_type< T, Types >:

◆ fl::Empty

struct fl::Empty

◆ fl::enable_if

struct fl::enable_if
+ Inheritance diagram for fl::enable_if< Condition, T >:

◆ fl::enable_if< true, T >

struct fl::enable_if< true, T >
+ Inheritance diagram for fl::enable_if< true, T >:
+ Collaboration diagram for fl::enable_if< true, T >:
Class Members
typedef T type T

◆ fl::function

class fl::function
+ Inheritance diagram for fl::function< typename >:

◆ fl::JsonDocument

class fl::JsonDocument

◆ fl::max_align

struct fl::max_align
+ Inheritance diagram for fl::max_align< Types >:

◆ fl::max_size

struct fl::max_size
+ Inheritance diagram for fl::max_size< Types >:

◆ fl::Pixel.__unnamed0__

union fl::Pixel.__unnamed0__
Class Members
struct Pixel.__unnamed0__.__unnamed0__ __unnamed__
uint8_t raw[3]

◆ fl::Pixel.__unnamed0__.__unnamed0__

struct fl::Pixel.__unnamed0__.__unnamed0__
Class Members
uint8_t blue
uint8_t green
uint8_t red

◆ fl::remove_const

struct fl::remove_const
+ Inheritance diagram for fl::remove_const< T >:
Class Members
typedef T type T

◆ fl::remove_const< const T >

struct fl::remove_const< const T >
+ Inheritance diagram for fl::remove_const< const T >:
+ Collaboration diagram for fl::remove_const< const T >:
Class Members
typedef T type
typedef T type T

◆ fl::remove_cv

struct fl::remove_cv
+ Inheritance diagram for fl::remove_cv< T >:
Class Members
typedef T type T

◆ fl::remove_cv< const T >

struct fl::remove_cv< const T >
+ Inheritance diagram for fl::remove_cv< const T >:
+ Collaboration diagram for fl::remove_cv< const T >:
Class Members
typedef T type
typedef T type T

◆ fl::remove_cv< const volatile T >

struct fl::remove_cv< const volatile T >
+ Inheritance diagram for fl::remove_cv< const volatile T >:
+ Collaboration diagram for fl::remove_cv< const volatile T >:
Class Members
typedef const volatile T type
typedef T type T

◆ fl::remove_cv< volatile T >

struct fl::remove_cv< volatile T >
+ Inheritance diagram for fl::remove_cv< volatile T >:
+ Collaboration diagram for fl::remove_cv< volatile T >:
Class Members
typedef T type
typedef T type T

◆ fl::remove_extent

struct fl::remove_extent
+ Inheritance diagram for fl::remove_extent< T >:
Class Members
typedef T type T

◆ fl::remove_extent< T[]>

struct fl::remove_extent< T[]>
+ Inheritance diagram for fl::remove_extent< T[]>:
+ Collaboration diagram for fl::remove_extent< T[]>:
Class Members
typedef T type
typedef T type T

◆ fl::remove_extent< T[N]>

struct fl::remove_extent< T[N]>
+ Inheritance diagram for fl::remove_extent< T[N]>:
+ Collaboration diagram for fl::remove_extent< T[N]>:
Class Members
typedef T type
typedef T type T

◆ fl::remove_reference

struct fl::remove_reference
+ Inheritance diagram for fl::remove_reference< T >:
Class Members
typedef T type T

◆ fl::remove_reference< T & >

struct fl::remove_reference< T & >
+ Inheritance diagram for fl::remove_reference< T & >:
+ Collaboration diagram for fl::remove_reference< T & >:
Class Members
typedef T type
typedef T type T

◆ fl::remove_reference< T && >

struct fl::remove_reference< T && >
+ Inheritance diagram for fl::remove_reference< T && >:
+ Collaboration diagram for fl::remove_reference< T && >:
Class Members
typedef T type
typedef T type T

◆ fl::swap_impl

struct fl::swap_impl
+ Inheritance diagram for fl::swap_impl< T, bool >:

Typedef Documentation

◆ add_pointer_t

template<typename T>
using fl::add_pointer_t = typename add_pointer<T>::type

Definition at line 161 of file type_traits.h.

◆ alpha16

using fl::alpha16
Initial value:
uint16_t

Definition at line 21 of file transform.h.

◆ bitset

template<uint32_t N = 256>
using fl::bitset = BitsetInlined<N>

Definition at line 15 of file bitset.h.

◆ bitset_fixed

template<uint32_t N>
using fl::bitset_fixed = BitsetFixed<N>

Definition at line 18 of file bitset.h.

◆ conditional_t

template<bool B, typename T, typename F>
using fl::conditional_t = typename conditional<B, T, F>::type

Definition at line 96 of file type_traits.h.

◆ cycle_t

typedef int64_t fl::cycle_t

8.8 fixed point (signed) value

Definition at line 11 of file types.h.

◆ decay_t

template<typename T>
using fl::decay_t = typename decay<T>::type

Definition at line 233 of file type_traits.h.

◆ enable_if_t

template<bool Condition, typename T = void>
using fl::enable_if_t = typename enable_if<Condition, T>::type

Definition at line 29 of file type_traits.h.

◆ equal_to

template<typename T>
using fl::equal_to = EqualTo<T>

Definition at line 587 of file hash_map.h.

◆ hash_map

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = equal_to<Key>>
using fl::hash_map = HashMap<Key, T, Hash, KeyEqual>

Definition at line 591 of file hash_map.h.

◆ hash_set

template<typename Key, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>>
using fl::hash_set = HashSet<Key, Hash, KeyEqual>

Definition at line 30 of file hash_set.h.

◆ is_derived

template<typename Base, typename Derived>
using fl::is_derived = enable_if_t<is_base_of<Base, Derived>::value>

Definition at line 385 of file type_traits.h.

◆ LUT16

typedef LUT<uint16_t> fl::LUT16

Definition at line 23 of file lut.h.

◆ LUTXY16

typedef LUT<vec2<uint16_t> > fl::LUTXY16

Definition at line 24 of file lut.h.

◆ LUTXYFLOAT

typedef LUT<vec2f> fl::LUTXYFLOAT

Definition at line 25 of file lut.h.

◆ LUTXYZFLOAT

typedef LUT<vec3f> fl::LUTXYZFLOAT

Definition at line 26 of file lut.h.

◆ optional

template<typename T>
using fl::optional = Optional<T>

Definition at line 10 of file optional.h.

◆ pair

template<typename Key, typename Value>
using fl::pair = Pair<Key, Value>

Definition at line 13 of file pair.h.

◆ pair_xy_float

using fl::pair_xy_float = vec2<float>

Definition at line 308 of file geometry.h.

◆ pair_xyz_float

using fl::pair_xyz_float = vec3<float>

Definition at line 304 of file geometry.h.

◆ remove_cv_t

template<typename T>
using fl::remove_cv_t = typename remove_cv<T>::type

Definition at line 218 of file type_traits.h.

◆ remove_reference_t

template<typename T>
using fl::remove_reference_t = typename remove_reference<T>::type

Definition at line 84 of file type_traits.h.

◆ string

using fl::string = fl::Str

Definition at line 25 of file str.h.

◆ ThreadLocal

template<typename T>
using fl::ThreadLocal = ThreadLocalFake<T>

Definition at line 14 of file thread_local.h.

◆ unordered_map

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = equal_to<Key>>
using fl::unordered_map = HashMap<Key, T, Hash, KeyEqual>

Definition at line 595 of file hash_map.h.

◆ vec2f

using fl::vec2f = vec2<float>

Definition at line 301 of file geometry.h.

◆ vec3f

using fl::vec3f = vec3<float>

Definition at line 156 of file geometry.h.

◆ vector

template<typename T>
using fl::vector = HeapVector<T>

Definition at line 1028 of file vector.h.

◆ vector_fixed

template<typename T, size_t INLINED_SIZE>
using fl::vector_fixed = FixedVector<T, INLINED_SIZE>

Definition at line 1031 of file vector.h.

◆ vector_inlined

template<typename T, size_t INLINED_SIZE = 64>
using fl::vector_inlined = InlinedVector<T, INLINED_SIZE>

Definition at line 1034 of file vector.h.

◆ XFunction

typedef uint16_t(* fl::XFunction) (uint16_t x, uint16_t length)

Definition at line 24 of file xmap.h.

◆ XYFunction

typedef uint16_t(* fl::XYFunction) (uint16_t x, uint16_t y, uint16_t width, uint16_t height)

Definition at line 34 of file xymap.h.

◆ XYRaster

using fl::XYRaster = XYRasterU8Sparse

Definition at line 8 of file raster.h.

Enumeration Type Documentation

◆ AnimartrixAnim

enum fl::AnimartrixAnim
Enumerator
RGB_BLOBS5 
RGB_BLOBS4 
RGB_BLOBS3 
RGB_BLOBS2 
RGB_BLOBS 
POLAR_WAVES 
SLOW_FADE 
ZOOM2 
ZOOM 
HOT_BLOB 
SPIRALUS2 
SPIRALUS 
YVES 
SCALEDEMO1 
LAVA1 
CALEIDO3 
CALEIDO2 
CALEIDO1 
DISTANCE_EXPERIMENT 
CENTER_FIELD 
WAVES 
CHASING_SPIRALS 
ROTATING_BLOB 
RINGS 
COMPLEX_KALEIDO 
COMPLEX_KALEIDO_2 
COMPLEX_KALEIDO_3 
COMPLEX_KALEIDO_4 
COMPLEX_KALEIDO_5 
COMPLEX_KALEIDO_6 
WATER 
PARAMETRIC_WATER 
MODULE_EXPERIMENT1 
MODULE_EXPERIMENT2 
MODULE_EXPERIMENT3 
MODULE_EXPERIMENT4 
MODULE_EXPERIMENT5 
MODULE_EXPERIMENT6 
MODULE_EXPERIMENT7 
MODULE_EXPERIMENT8 
MODULE_EXPERIMENT9 
MODULE_EXPERIMENT10 
MODULE_EXPERIMENT_SM1 
MODULE_EXPERIMENT_SM2 
MODULE_EXPERIMENT_SM3 
MODULE_EXPERIMENT_SM4 
MODULE_EXPERIMENT_SM5 
MODULE_EXPERIMENT_SM6 
MODULE_EXPERIMENT_SM8 
MODULE_EXPERIMENT_SM9 
MODULE_EXPERIMENT_SM10 
NUM_ANIMATIONS 

Definition at line 25 of file animartrix.hpp.

25 {
26 RGB_BLOBS5 = 0,
33 ZOOM2,
34 ZOOM,
38 YVES,
40 LAVA1,
46 WAVES,
49 RINGS,
56 WATER,
78};
@ COMPLEX_KALEIDO
@ MODULE_EXPERIMENT_SM6
@ ZOOM2
@ CALEIDO2
@ ZOOM
@ CHASING_SPIRALS
@ MODULE_EXPERIMENT10
@ WATER
@ MODULE_EXPERIMENT_SM3
@ MODULE_EXPERIMENT6
@ MODULE_EXPERIMENT3
@ CENTER_FIELD
@ RGB_BLOBS4
@ DISTANCE_EXPERIMENT
@ POLAR_WAVES
@ PARAMETRIC_WATER
@ MODULE_EXPERIMENT_SM8
@ COMPLEX_KALEIDO_4
@ MODULE_EXPERIMENT7
@ SPIRALUS
@ MODULE_EXPERIMENT_SM9
@ WAVES
@ COMPLEX_KALEIDO_5
@ COMPLEX_KALEIDO_2
@ MODULE_EXPERIMENT8
@ NUM_ANIMATIONS
@ ROTATING_BLOB
@ MODULE_EXPERIMENT_SM1
@ MODULE_EXPERIMENT_SM4
@ SLOW_FADE
@ RGB_BLOBS
@ MODULE_EXPERIMENT_SM5
@ LAVA1
@ MODULE_EXPERIMENT9
@ COMPLEX_KALEIDO_6
@ MODULE_EXPERIMENT1
@ YVES
@ SCALEDEMO1
@ RGB_BLOBS2
@ MODULE_EXPERIMENT_SM10
@ MODULE_EXPERIMENT4
@ MODULE_EXPERIMENT5
@ HOT_BLOB
@ MODULE_EXPERIMENT2
@ RINGS
@ RGB_BLOBS5
@ COMPLEX_KALEIDO_3
@ CALEIDO3
@ CALEIDO1
@ RGB_BLOBS3
@ MODULE_EXPERIMENT_SM2
@ SPIRALUS2

◆ DrawMode

enum fl::DrawMode
Enumerator
DRAW_MODE_OVERWRITE 
DRAW_MODE_BLEND_BY_MAX_BRIGHTNESS 

Definition at line 5 of file draw_mode.h.

◆ FiveBitGammaCorrectionMode

enum fl::FiveBitGammaCorrectionMode
Enumerator
kFiveBitGammaCorrectionMode_Null 
kFiveBitGammaCorrectionMode_BitShift 

Definition at line 14 of file five_bit_hd_gamma.h.

◆ InsertResult

enum fl::InsertResult
Enumerator
kInserted 
kExists 
kMaxSize 

Definition at line 10 of file insert_result.h.

10 {
11 kInserted = 0,
12 kExists = 1,
13 kMaxSize = 2,
14};
@ kMaxSize
@ kExists
@ kInserted

◆ leddirection

enum class fl::leddirection
strong
Enumerator
FORWARD 
BACKWARD 
MAP 

Definition at line 139 of file ___pixeltypes.h.

◆ SuperSample

enum fl::SuperSample
Enumerator
SUPER_SAMPLE_NONE 
SUPER_SAMPLE_2X 
SUPER_SAMPLE_4X 
SUPER_SAMPLE_8X 

Definition at line 4 of file supersample.h.

4 {
5 SUPER_SAMPLE_NONE = 1, // 1x supersampling (no supersampling)
6 SUPER_SAMPLE_2X = 2, // 2x supersampling
7 SUPER_SAMPLE_4X = 4, // 4x supersampling
8 SUPER_SAMPLE_8X = 8 // 8x supersampling
9};
@ SUPER_SAMPLE_8X
Definition supersample.h:8
@ SUPER_SAMPLE_2X
Definition supersample.h:6
@ SUPER_SAMPLE_4X
Definition supersample.h:7
@ SUPER_SAMPLE_NONE
Definition supersample.h:5

◆ TGradientDirectionCode

enum fl::TGradientDirectionCode

Hue direction for calculating fill gradients.

Since "hue" is a value around a color wheel, there are always two directions to sweep from one hue to another.

Enumerator
FORWARD_HUES 

Hue always goes clockwise around the color wheel.

BACKWARD_HUES 

Hue always goes counter-clockwise around the color wheel.

SHORTEST_HUES 

Hue goes whichever way is shortest.

LONGEST_HUES 

Hue goes whichever way is longest.

Definition at line 33 of file colorutils_misc.h.

33 {
TGradientDirectionCode
Hue direction for calculating fill gradients.
@ SHORTEST_HUES
Hue goes whichever way is shortest.
@ LONGEST_HUES
Hue goes whichever way is longest.
@ FORWARD_HUES
Hue always goes clockwise around the color wheel.
@ BACKWARD_HUES
Hue always goes counter-clockwise around the color wheel.

◆ U8EasingFunction

enum fl::U8EasingFunction
Enumerator
WAVE_U8_MODE_LINEAR 
WAVE_U8_MODE_SQRT 

Definition at line 32 of file wave_simulation.h.

Function Documentation

◆ __builtin_five_bit_hd_gamma_bitshift()

void fl::__builtin_five_bit_hd_gamma_bitshift ( CRGB colors,
CRGB colors_scale,
uint8_t global_brightness,
CRGB * out_colors,
uint8_t * out_power_5bit )

Definition at line 128 of file five_bit_hd_gamma.cpp.

131 {
132
133 if (global_brightness == 0) {
134 *out_colors = CRGB(0, 0, 0);
135 *out_power_5bit = 0;
136 return;
137 }
138
139 // Step 1: Gamma Correction
140 uint16_t r16, g16, b16;
141 five_bit_hd_gamma_function(colors, &r16, &g16, &b16);
142
143 // Step 2: Color correction step comes after gamma correction. These values
144 // are assumed to be be relatively close to 255.
145 if (colors_scale.r != 0xff) {
146 r16 = scale16by8(r16, colors_scale.r);
147 }
148 if (colors_scale.g != 0xff) {
149 g16 = scale16by8(g16, colors_scale.g);
150 }
151 if (colors_scale.b != 0xff) {
152 b16 = scale16by8(b16, colors_scale.b);
153 }
154
155 five_bit_bitshift(r16, g16, b16, global_brightness, out_colors,
156 out_power_5bit);
157}
LIB8STATIC_ALWAYS_INLINE uint16_t scale16by8(uint16_t i, fract8 scale)
Scale a 16-bit unsigned value by an 8-bit value, which is treated as the numerator of a fraction whos...
Definition scale8.h:474
uint8_t five_bit_bitshift(uint16_t r16, uint16_t g16, uint16_t b16, uint8_t brightness, CRGB *out, uint8_t *out_power_5bit)
void five_bit_hd_gamma_function(CRGB color, uint16_t *r16, uint16_t *g16, uint16_t *b16)
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55

References five_bit_bitshift(), five_bit_hd_gamma_function(), and scale16by8().

Referenced by five_bit_hd_gamma_bitshift().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AnimartrixLoop()

void fl::AnimartrixLoop ( Animartrix & self,
uint32_t now )

Definition at line 155 of file animartrix.hpp.

155 {
156 if (self.prev_animation != self.current_animation) {
157 if (self.impl) {
158 // Re-initialize object.
159 self.impl->init(self.getWidth(), self.getHeight());
160 }
162 }
163 if (!self.impl) {
164 self.impl.reset(new FastLEDANIMartRIX(&self));
165 }
166 self.impl->setTime(now);
167 self.impl->loop();
168}
AnimartrixAnim current_animation
AnimartrixAnim prev_animation
fl::scoped_ptr< FastLEDANIMartRIX > impl
uint16_t getHeight() const
Definition fx2d.h:24
uint16_t getWidth() const
Definition fx2d.h:25

◆ applyGamma_video() [1/3]

CRGB fl::applyGamma_video ( const CRGB & orig,
float gamma )

Definition at line 1068 of file colorutils.cpp.

1068 {
1069 CRGB adj;
1070 adj.r = applyGamma_video(orig.r, gamma);
1071 adj.g = applyGamma_video(orig.g, gamma);
1072 adj.b = applyGamma_video(orig.b, gamma);
1073 return adj;
1074}
uint8_t applyGamma_video(uint8_t brightness, float gamma)

References applyGamma_video().

+ Here is the call graph for this function:

◆ applyGamma_video() [2/3]

CRGB fl::applyGamma_video ( const CRGB & orig,
float gammaR,
float gammaG,
float gammaB )

Definition at line 1076 of file colorutils.cpp.

1077 {
1078 CRGB adj;
1079 adj.r = applyGamma_video(orig.r, gammaR);
1080 adj.g = applyGamma_video(orig.g, gammaG);
1081 adj.b = applyGamma_video(orig.b, gammaB);
1082 return adj;
1083}

References applyGamma_video().

+ Here is the call graph for this function:

◆ applyGamma_video() [3/3]

uint8_t fl::applyGamma_video ( uint8_t brightness,
float gamma )

Definition at line 1056 of file colorutils.cpp.

1056 {
1057 float orig;
1058 float adj;
1059 orig = (float)(brightness) / (255.0);
1060 adj = pow(orig, gamma) * (255.0);
1061 uint8_t result = (uint8_t)(adj);
1062 if ((brightness > 0) && (result == 0)) {
1063 result = 1; // never gamma-adjust a positive number down to zero
1064 }
1065 return result;
1066}
UISlider brightness("Brightness", 255, 0, 255, 1)

References brightness.

Referenced by applyGamma_video(), applyGamma_video(), napplyGamma_video(), napplyGamma_video(), napplyGamma_video(), and napplyGamma_video().

+ Here is the caller graph for this function:

◆ bilinearExpand()

void fl::bilinearExpand ( const CRGB * input,
CRGB * output,
uint16_t inputWidth,
uint16_t inputHeight,
fl::XYMap xyMap )
inline

Definition at line 37 of file bilinear_expansion.h.

38 {
39 uint16_t outputWidth = xyMap.getWidth();
40 uint16_t outputHeight = xyMap.getHeight();
41 const bool wontFit =
42 (outputWidth != xyMap.getWidth() || outputHeight != xyMap.getHeight());
43 // if the input dimensions are not a power of 2 then we can't use the
44 // optimized version.
45 if (wontFit || (inputWidth & (inputWidth - 1)) ||
46 (inputHeight & (inputHeight - 1))) {
47 bilinearExpandArbitrary(input, output, inputWidth, inputHeight, xyMap);
48 } else {
49 bilinearExpandPowerOf2(input, output, inputWidth, inputHeight, xyMap);
50 }
51}
XYMap xyMap(WIDTH, HEIGHT, false)
void bilinearExpandArbitrary(const CRGB *input, CRGB *output, uint16_t inputWidth, uint16_t inputHeight, XYMap xyMap)
Performs bilinear interpolation for upscaling an image.
void bilinearExpandPowerOf2(const CRGB *input, CRGB *output, uint8_t inputWidth, uint8_t inputHeight, XYMap xyMap)
Performs bilinear interpolation for upscaling an image.

References bilinearExpandArbitrary(), bilinearExpandPowerOf2(), and xyMap.

Referenced by fl::ScaleUp::expand(), and CRGB::upscale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bilinearExpandArbitrary()

void fl::bilinearExpandArbitrary ( const CRGB * input,
CRGB * output,
uint16_t inputWidth,
uint16_t inputHeight,
fl::XYMap xyMap )

Performs bilinear interpolation for upscaling an image.

Parameters
outputThe output grid to write into the interpolated values.
inputThe input grid to read from.
inputWidthThe width of the input grid.
inputHeightThe height of the input grid.
xyMapThe XYMap to use to determine where to write the pixel. If the pixel is mapped outside of the range then it is clipped.

Definition at line 20 of file bilinear_expansion.cpp.

22 {
23 uint16_t n = xyMap.getTotal();
24 uint16_t outputWidth = xyMap.getWidth();
25 uint16_t outputHeight = xyMap.getHeight();
26 const uint16_t scale_factor = 256; // Using 8 bits for the fractional part
27
28 for (uint16_t y = 0; y < outputHeight; y++) {
29 for (uint16_t x = 0; x < outputWidth; x++) {
30 // Calculate the corresponding position in the input grid
31 uint32_t fx = ((uint32_t)x * (inputWidth - 1) * scale_factor) /
32 (outputWidth - 1);
33 uint32_t fy = ((uint32_t)y * (inputHeight - 1) * scale_factor) /
34 (outputHeight - 1);
35
36 uint16_t ix = fx / scale_factor; // Integer part of x
37 uint16_t iy = fy / scale_factor; // Integer part of y
38 uint16_t dx = fx % scale_factor; // Fractional part of x
39 uint16_t dy = fy % scale_factor; // Fractional part of y
40
41 uint16_t ix1 = (ix + 1 < inputWidth) ? ix + 1 : ix;
42 uint16_t iy1 = (iy + 1 < inputHeight) ? iy + 1 : iy;
43
44 uint16_t i00 = iy * inputWidth + ix;
45 uint16_t i10 = iy * inputWidth + ix1;
46 uint16_t i01 = iy1 * inputWidth + ix;
47 uint16_t i11 = iy1 * inputWidth + ix1;
48
49 CRGB c00 = input[i00];
50 CRGB c10 = input[i10];
51 CRGB c01 = input[i01];
52 CRGB c11 = input[i11];
53
54 CRGB result;
55 result.r = bilinearInterpolate(c00.r, c10.r, c01.r, c11.r, dx, dy);
56 result.g = bilinearInterpolate(c00.g, c10.g, c01.g, c11.g, dx, dy);
57 result.b = bilinearInterpolate(c00.b, c10.b, c01.b, c11.b, dx, dy);
58
59 uint16_t idx = xyMap.mapToIndex(x, y);
60 if (idx < n) {
61 output[idx] = result;
62 }
63 }
64 }
65}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
uint8_t bilinearInterpolate(uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, uint16_t dx, uint16_t dy)

References bilinearInterpolate(), x, xyMap, and y.

Referenced by bilinearExpand(), and fl::ScaleUp::expand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bilinearExpandArbitraryFloat()

void fl::bilinearExpandArbitraryFloat ( const CRGB * input,
CRGB * output,
uint16_t inputWidth,
uint16_t inputHeight,
XYMap xyMap )

Definition at line 182 of file bilinear_expansion.cpp.

184 {
185 uint16_t n = xyMap.getTotal();
186 uint16_t outputWidth = xyMap.getWidth();
187 uint16_t outputHeight = xyMap.getHeight();
188
189 for (uint16_t y = 0; y < outputHeight; y++) {
190 for (uint16_t x = 0; x < outputWidth; x++) {
191 // Map output pixel to input grid position
192 float fx =
193 static_cast<float>(x) * (inputWidth - 1) / (outputWidth - 1);
194 float fy =
195 static_cast<float>(y) * (inputHeight - 1) / (outputHeight - 1);
196
197 uint16_t ix = static_cast<uint16_t>(fx);
198 uint16_t iy = static_cast<uint16_t>(fy);
199 float dx = fx - ix;
200 float dy = fy - iy;
201
202 uint16_t ix1 = (ix + 1 < inputWidth) ? ix + 1 : ix;
203 uint16_t iy1 = (iy + 1 < inputHeight) ? iy + 1 : iy;
204
205 uint16_t i00 = iy * inputWidth + ix;
206 uint16_t i10 = iy * inputWidth + ix1;
207 uint16_t i01 = iy1 * inputWidth + ix;
208 uint16_t i11 = iy1 * inputWidth + ix1;
209
210 CRGB c00 = input[i00];
211 CRGB c10 = input[i10];
212 CRGB c01 = input[i01];
213 CRGB c11 = input[i11];
214
215 CRGB result;
216 result.r =
217 bilinearInterpolateFloat(c00.r, c10.r, c01.r, c11.r, dx, dy);
218 result.g =
219 bilinearInterpolateFloat(c00.g, c10.g, c01.g, c11.g, dx, dy);
220 result.b =
221 bilinearInterpolateFloat(c00.b, c10.b, c01.b, c11.b, dx, dy);
222
223 uint16_t idx = xyMap.mapToIndex(x, y);
224 if (idx < n) {
225 output[idx] = result;
226 }
227 }
228 }
229}
uint8_t bilinearInterpolateFloat(uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, float dx, float dy)

References bilinearInterpolateFloat(), x, xyMap, and y.

+ Here is the call graph for this function:

◆ bilinearExpandFloat()

void fl::bilinearExpandFloat ( const CRGB * input,
CRGB * output,
uint8_t inputWidth,
uint8_t inputHeight,
XYMap xyMap )

Definition at line 232 of file bilinear_expansion.cpp.

233 {
234 uint8_t outputWidth = xyMap.getWidth();
235 uint8_t outputHeight = xyMap.getHeight();
236 if (outputWidth != xyMap.getWidth() || outputHeight != xyMap.getHeight()) {
237 // xyMap has width and height that do not fit in a uint8_t.
238 return;
239 }
240 uint16_t n = xyMap.getTotal();
241
242 for (uint8_t y = 0; y < outputHeight; y++) {
243 for (uint8_t x = 0; x < outputWidth; x++) {
244 // Map output pixel to input grid position
245 float fx =
246 static_cast<float>(x) * (inputWidth - 1) / (outputWidth - 1);
247 float fy =
248 static_cast<float>(y) * (inputHeight - 1) / (outputHeight - 1);
249
250 uint8_t ix = static_cast<uint8_t>(fx);
251 uint8_t iy = static_cast<uint8_t>(fy);
252 float dx = fx - ix;
253 float dy = fy - iy;
254
255 uint8_t ix1 = (ix + 1 < inputWidth) ? ix + 1 : ix;
256 uint8_t iy1 = (iy + 1 < inputHeight) ? iy + 1 : iy;
257
258 uint16_t i00 = iy * inputWidth + ix;
259 uint16_t i10 = iy * inputWidth + ix1;
260 uint16_t i01 = iy1 * inputWidth + ix;
261 uint16_t i11 = iy1 * inputWidth + ix1;
262
263 CRGB c00 = input[i00];
264 CRGB c10 = input[i10];
265 CRGB c01 = input[i01];
266 CRGB c11 = input[i11];
267
268 CRGB result;
269 result.r =
270 bilinearInterpolateFloat(c00.r, c10.r, c01.r, c11.r, dx, dy);
271 result.g =
272 bilinearInterpolateFloat(c00.g, c10.g, c01.g, c11.g, dx, dy);
273 result.b =
274 bilinearInterpolateFloat(c00.b, c10.b, c01.b, c11.b, dx, dy);
275
276 uint16_t idx = xyMap.mapToIndex(x, y);
277 if (idx < n) {
278 output[idx] = result;
279 }
280 }
281 }
282}

References bilinearInterpolateFloat(), x, xyMap, and y.

Referenced by fl::ScaleUp::expand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bilinearExpandPowerOf2()

void fl::bilinearExpandPowerOf2 ( const CRGB * input,
CRGB * output,
uint8_t inputWidth,
uint8_t inputHeight,
fl::XYMap xyMap )

Performs bilinear interpolation for upscaling an image.

Parameters
outputThe output grid to write into the interpolated values.
inputThe input grid to read from.
inputWidthThe width of the input grid.
inputHeightThe height of the input grid.
xyMapThe XYMap to use to determine where to write the pixel. If the pixel is mapped outside of the range then it is clipped.

Definition at line 85 of file bilinear_expansion.cpp.

86 {
87 uint8_t width = xyMap.getWidth();
88 uint8_t height = xyMap.getHeight();
89 if (width != xyMap.getWidth() || height != xyMap.getHeight()) {
90 // xyMap has width and height that do not fit in an uint16_t.
91 return;
92 }
93 uint16_t n = xyMap.getTotal();
94
95 for (uint8_t y = 0; y < height; y++) {
96 for (uint8_t x = 0; x < width; x++) {
97 // Use 8-bit fixed-point arithmetic with 8 fractional bits
98 // (scale factor of 256)
99 uint16_t fx = ((uint16_t)x * (inputWidth - 1) * 256) / (width - 1);
100 uint16_t fy =
101 ((uint16_t)y * (inputHeight - 1) * 256) / (height - 1);
102
103 uint8_t ix = fx >> 8; // Integer part
104 uint8_t iy = fy >> 8;
105 uint8_t dx = fx & 0xFF; // Fractional part
106 uint8_t dy = fy & 0xFF;
107
108 uint8_t ix1 = (ix + 1 < inputWidth) ? ix + 1 : ix;
109 uint8_t iy1 = (iy + 1 < inputHeight) ? iy + 1 : iy;
110
111 uint16_t i00 = iy * inputWidth + ix;
112 uint16_t i10 = iy * inputWidth + ix1;
113 uint16_t i01 = iy1 * inputWidth + ix;
114 uint16_t i11 = iy1 * inputWidth + ix1;
115
116 CRGB c00 = input[i00];
117 CRGB c10 = input[i10];
118 CRGB c01 = input[i01];
119 CRGB c11 = input[i11];
120
121 CRGB result;
122 result.r =
123 bilinearInterpolatePowerOf2(c00.r, c10.r, c01.r, c11.r, dx, dy);
124 result.g =
125 bilinearInterpolatePowerOf2(c00.g, c10.g, c01.g, c11.g, dx, dy);
126 result.b =
127 bilinearInterpolatePowerOf2(c00.b, c10.b, c01.b, c11.b, dx, dy);
128
129 uint16_t idx = xyMap.mapToIndex(x, y);
130 if (idx < n) {
131 output[idx] = result;
132 }
133 }
134 }
135}
uint8_t bilinearInterpolatePowerOf2(uint8_t v00, uint8_t v10, uint8_t v01, uint8_t v11, uint8_t dx, uint8_t dy)

References bilinearInterpolatePowerOf2(), x, xyMap, and y.

Referenced by bilinearExpand(), and fl::ScaleUp::expand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bilinearInterpolate()

uint8_t fl::bilinearInterpolate ( uint8_t v00,
uint8_t v10,
uint8_t v01,
uint8_t v11,
uint16_t dx,
uint16_t dy )

Definition at line 66 of file bilinear_expansion.cpp.

67 {
68 uint16_t dx_inv = 256 - dx;
69 uint16_t dy_inv = 256 - dy;
70
71 uint32_t w00 = (uint32_t)dx_inv * dy_inv;
72 uint32_t w10 = (uint32_t)dx * dy_inv;
73 uint32_t w01 = (uint32_t)dx_inv * dy;
74 uint32_t w11 = (uint32_t)dx * dy;
75
76 uint32_t sum = v00 * w00 + v10 * w10 + v01 * w01 + v11 * w11;
77
78 // Normalize the result by dividing by 65536 (shift right by 16 bits),
79 // with rounding
80 uint8_t result = (uint8_t)((sum + 32768) >> 16);
81
82 return result;
83}

Referenced by bilinearExpandArbitrary().

+ Here is the caller graph for this function:

◆ bilinearInterpolateFloat()

uint8_t fl::bilinearInterpolateFloat ( uint8_t v00,
uint8_t v10,
uint8_t v01,
uint8_t v11,
float dx,
float dy )

Definition at line 161 of file bilinear_expansion.cpp.

162 {
163 float dx_inv = 1.0f - dx;
164 float dy_inv = 1.0f - dy;
165
166 // Calculate the weights for each corner
167 float w00 = dx_inv * dy_inv;
168 float w10 = dx * dy_inv;
169 float w01 = dx_inv * dy;
170 float w11 = dx * dy;
171
172 // Compute the weighted sum
173 float sum = v00 * w00 + v10 * w10 + v01 * w01 + v11 * w11;
174
175 // Clamp the result to [0, 255] and round
176 uint8_t result = static_cast<uint8_t>(sum + 0.5f);
177
178 return result;
179}

Referenced by bilinearExpandArbitraryFloat(), and bilinearExpandFloat().

+ Here is the caller graph for this function:

◆ bilinearInterpolatePowerOf2()

uint8_t fl::bilinearInterpolatePowerOf2 ( uint8_t v00,
uint8_t v10,
uint8_t v01,
uint8_t v11,
uint8_t dx,
uint8_t dy )

Definition at line 137 of file bilinear_expansion.cpp.

138 {
139 uint16_t dx_inv = 256 - dx; // 0 to 256
140 uint16_t dy_inv = 256 - dy; // 0 to 256
141
142 // Scale down weights to fit into uint16_t
143 uint16_t w00 = (dx_inv * dy_inv) >> 8; // Max value 256
144 uint16_t w10 = (dx * dy_inv) >> 8;
145 uint16_t w01 = (dx_inv * dy) >> 8;
146 uint16_t w11 = (dx * dy) >> 8;
147
148 // Sum of weights should be approximately 256
149 uint16_t weight_sum = w00 + w10 + w01 + w11;
150
151 // Compute the weighted sum of pixel values
152 uint16_t sum = v00 * w00 + v10 * w10 + v01 * w01 + v11 * w11;
153
154 // Normalize the result
155 uint8_t result = (sum + (weight_sum >> 1)) / weight_sum;
156
157 return result;
158}

Referenced by bilinearExpandPowerOf2().

+ Here is the caller graph for this function:

◆ blend() [1/4]

CHSV fl::blend ( const CHSV & p1,
const CHSV & p2,
fract8 amountOfP2,
TGradientDirectionCode directionCode )

Definition at line 132 of file colorutils.cpp.

133 {
134 CHSV nu(p1);
135 nblend(nu, p2, amountOfP2, directionCode);
136 return nu;
137}
CRGB & nblend(CRGB &existing, const CRGB &overlay, fract8 amountOfOverlay)
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References nblend().

+ Here is the call graph for this function:

◆ blend() [2/4]

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

Definition at line 139 of file colorutils.cpp.

140 {
141 for (uint16_t i = 0; i < count; ++i) {
142 dest[i] = blend(src1[i], src2[i], amountOfsrc2, directionCode);
143 }
144 return dest;
145}
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)

References blend().

+ Here is the call graph for this function:

◆ blend() [3/4]

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

Definition at line 60 of file colorutils.cpp.

60 {
61 CRGB nu(p1);
62 nblend(nu, p2, amountOfP2);
63 return nu;
64}

References nblend().

Referenced by blend(), blend(), ColorFromPalette(), ColorFromPalette(), ColorFromPalette(), ColorFromPalette(), ColorFromPalette(), ColorFromPalette(), ColorFromPaletteExtended(), ColorFromPaletteExtended(), ColorFromPaletteExtended(), fl::TwinkleFox::drawTwinkleFox(), fl::LUT< uint16_t >::interp16(), fl::LUT< uint16_t >::interp8(), and MyColorFromPaletteExtended().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blend() [4/4]

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

Definition at line 66 of file colorutils.cpp.

67 {
68 for (uint16_t i = 0; i < count; ++i) {
69 dest[i] = blend(src1[i], src2[i], amountOfsrc2);
70 }
71 return dest;
72}

References blend().

+ Here is the call graph for this function:

◆ blur1d()

void fl::blur1d ( CRGB * leds,
uint16_t numLeds,
fract8 blur_amount )

One-dimensional blur filter.

Spreads light to 2 line neighbors.

Total light is NOT entirely conserved, so many repeated calls to 'blur' will also result in the light fading, eventually all the way to black; this is by design so that it can be used to (slowly) clear the LEDs to black.

Parameters
ledsa pointer to the LED array to blur
numLedsthe number of LEDs to blur
blur_amountthe amount of blur to apply

Definition at line 54 of file blur.cpp.

54 {
55 uint8_t keep = 255 - blur_amount;
56 uint8_t seep = blur_amount >> 1;
57 CRGB carryover = CRGB::Black;
58 for (uint16_t i = 0; i < numLeds; ++i) {
59 CRGB cur = leds[i];
60 CRGB part = cur;
61 part.nscale8(seep);
62 cur.nscale8(keep);
63 cur += carryover;
64 if (i)
65 leds[i - 1] += part;
66 leds[i] = cur;
67 carryover = part;
68 }
69}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
CRGB & nscale8(uint8_t scaledown)
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp:88
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:504

References CRGB::Black, leds, and CRGB::nscale8().

+ Here is the call graph for this function:

◆ blur2d() [1/2]

void fl::blur2d ( CRGB * leds,
uint8_t width,
uint8_t height,
fract8 blur_amount )

Legacy version of blur2d, which does not require an XYMap but instead implicitly binds to XY() function.

If you are hitting a linker error here, then use blur2d(..., const fl::XYMap& xymap) instead.

Definition at line 77 of file blur.cpp.

77 {
78 XYMap xy =
79 XYMap::constructWithUserFunction(width, height, xy_legacy_wrapper);
80 blur2d(leds, width, height, blur_amount, xy);
81}
unsigned int xy(unsigned int x, unsigned int y)
static XYMap constructWithUserFunction(uint16_t width, uint16_t height, XYFunction xyFunction, uint16_t offset=0)
Definition xymap.cpp:28
void blur2d(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const XYMap &xymap)
Two-dimensional blur filter.
Definition blur.cpp:71

References blur2d(), fl::XYMap::constructWithUserFunction(), leds, and xy().

+ Here is the call graph for this function:

◆ blur2d() [2/2]

void fl::blur2d ( CRGB * leds,
uint8_t width,
uint8_t height,
fract8 blur_amount,
const fl::XYMap & xymap )

Two-dimensional blur filter.

Spreads light to 8 XY neighbors.

Total light is NOT entirely conserved, so many repeated calls to 'blur' will also result in the light fading, eventually all the way to black; this is by design so that it can be used to (slowly) clear the LEDs to black.

Parameters
ledsa pointer to the LED array to blur
widththe width of the matrix
heightthe height of the matrix
blur_amountthe amount of blur to apply

Definition at line 71 of file blur.cpp.

72 {
73 blurRows(leds, width, height, blur_amount, xymap);
74 blurColumns(leds, width, height, blur_amount, xymap);
75}
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
void blurColumns(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const XYMap &xyMap)
Perform a blur1d() on every column of a rectangular matrix.
Definition blur.cpp:111
void blurRows(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const XYMap &xyMap)
Perform a blur1d() on every row of a rectangular matrix.
Definition blur.cpp:83

References blurColumns(), blurRows(), leds, and xymap.

Referenced by blur2d(), fl::Blend2d::draw(), and loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blurColumns()

void fl::blurColumns ( CRGB * leds,
uint8_t width,
uint8_t height,
fract8 blur_amount,
const fl::XYMap & xymap )

Perform a blur1d() on every column of a rectangular matrix.

See also
blur1d()
Parameters
ledsa pointer to the LED array to blur
widththe width of the matrix
heightthe height of the matrix
blur_amountthe amount of blur to apply

Definition at line 111 of file blur.cpp.

112 {
113 // blur columns
114 uint8_t keep = 255 - blur_amount;
115 uint8_t seep = blur_amount >> 1;
116 for (uint8_t col = 0; col < width; ++col) {
117 CRGB carryover = CRGB::Black;
118 for (uint8_t i = 0; i < height; ++i) {
119 CRGB cur = leds[xyMap.mapToIndex(col, i)];
120 CRGB part = cur;
121 part.nscale8(seep);
122 cur.nscale8(keep);
123 cur += carryover;
124 if (i)
125 leds[xyMap.mapToIndex(col, i - 1)] += part;
126 leds[xyMap.mapToIndex(col, i)] = cur;
127 carryover = part;
128 }
129 }
130}

References CRGB::Black, leds, CRGB::nscale8(), and xyMap.

Referenced by blur2d().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blurRows()

void fl::blurRows ( CRGB * leds,
uint8_t width,
uint8_t height,
fract8 blur_amount,
const fl::XYMap & xymap )

Perform a blur1d() on every row of a rectangular matrix.

See also
blur1d()
Parameters
ledsa pointer to the LED array to blur
widththe width of the matrix
heightthe height of the matrix
blur_amountthe amount of blur to apply

Definition at line 83 of file blur.cpp.

84 {
85
86 /* for( uint8_t row = 0; row < height; row++) {
87 CRGB* rowbase = leds + (row * width);
88 blur1d( rowbase, width, blur_amount);
89 }
90 */
91 // blur rows same as columns, for irregular matrix
92 uint8_t keep = 255 - blur_amount;
93 uint8_t seep = blur_amount >> 1;
94 for (uint8_t row = 0; row < height; row++) {
95 CRGB carryover = CRGB::Black;
96 for (uint8_t i = 0; i < width; i++) {
97 CRGB cur = leds[xyMap.mapToIndex(i, row)];
98 CRGB part = cur;
99 part.nscale8(seep);
100 cur.nscale8(keep);
101 cur += carryover;
102 if (i)
103 leds[xyMap.mapToIndex(i - 1, row)] += part;
104 leds[xyMap.mapToIndex(i, row)] = cur;
105 carryover = part;
106 }
107 }
108}

References CRGB::Black, leds, CRGB::nscale8(), and xyMap.

Referenced by blur2d().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ceil()

template<typename T>
T fl::ceil ( T value)
inline

Definition at line 18 of file math.h.

18 {
19 if (value <= 0) {
20 return static_cast<T>(static_cast<int>(value));
21 }
22 return static_cast<T>(::ceil(static_cast<float>(value)));
23}
T ceil(T value)
Definition math.h:18

References ceil().

Referenced by ceil().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clamp()

template<typename T>
FASTLED_FORCE_INLINE T fl::clamp ( T value,
T min,
T max )

Definition at line 10 of file clamp.h.

10 {
11 if (value < min) {
12 return min;
13 }
14 if (value > max) {
15 return max;
16 }
17 return value;
18}

References FASTLED_FORCE_INLINE.

Referenced by fl::XYPath::calculateSteps(), fl::wave_detail::float_to_fixed(), fl::MatrixSlice< T >::getLocalCoord(), loop(), map_range_clamped(), fl::XYMap::mapToIndex(), fl::WaveSimulation1D::setf(), fl::WaveSimulation2D::setf(), fl::HashMap< Key, T, Hash, KeyEqual >::setLoadFactor(), and showGenerative().

+ Here is the caller graph for this function:

◆ clear() [1/2]

template<int N>
void fl::clear ( CRGB(&) arr[N])
inline

Definition at line 8 of file clear.h.

8 {
9 for (int i = 0; i < N; ++i) {
10 arr[i] = CRGB::Black;
11 }
12}

References CRGB::Black.

Referenced by clearLeds(), loop(), and showGenerative().

+ Here is the caller graph for this function:

◆ clear() [2/2]

void fl::clear ( Leds & leds)
inline

Definition at line 14 of file clear.h.

14{ leds.fill(CRGB::Black); }

References CRGB::Black, and leds.

◆ ColorFromPalette() [1/8]

CHSV fl::ColorFromPalette ( const CHSVPalette16 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 771 of file colorutils.cpp.

772 {
773 if (blendType == LINEARBLEND_NOWRAP) {
774 index = map8(index, 0, 239); // Blend range is affected by lo4 blend of
775 // values, remap to avoid wrapping
776 }
777
778 // hi4 = index >> 4;
779 uint8_t hi4 = lsrX4(index);
780 uint8_t lo4 = index & 0x0F;
781
782 // CRGB rgb1 = pal[ hi4];
783 const CHSV *entry = &(pal[0]) + hi4;
784
785 uint8_t hue1 = entry->hue;
786 uint8_t sat1 = entry->sat;
787 uint8_t val1 = entry->val;
788
789 uint8_t blend = lo4 && (blendType != NOBLEND);
790
791 if (blend) {
792
793 if (hi4 == 15) {
794 entry = &(pal[0]);
795 } else {
796 ++entry;
797 }
798
799 uint8_t f2 = lo4 << 4;
800 uint8_t f1 = 255 - f2;
801
802 uint8_t hue2 = entry->hue;
803 uint8_t sat2 = entry->sat;
804 uint8_t val2 = entry->val;
805
806 // Now some special casing for blending to or from
807 // either black or white. Black and white don't have
808 // proper 'hue' of their own, so when ramping from
809 // something else to/from black/white, we set the 'hue'
810 // of the black/white color to be the same as the hue
811 // of the other color, so that you get the expected
812 // brightness or saturation ramp, with hue staying
813 // constant:
814
815 // If we are starting from white (sat=0)
816 // or black (val=0), adopt the target hue.
817 if (sat1 == 0 || val1 == 0) {
818 hue1 = hue2;
819 }
820
821 // If we are ending at white (sat=0)
822 // or black (val=0), adopt the starting hue.
823 if (sat2 == 0 || val2 == 0) {
824 hue2 = hue1;
825 }
826
827 sat1 = scale8_LEAVING_R1_DIRTY(sat1, f1);
828 val1 = scale8_LEAVING_R1_DIRTY(val1, f1);
829
830 sat2 = scale8_LEAVING_R1_DIRTY(sat2, f2);
831 val2 = scale8_LEAVING_R1_DIRTY(val2, f2);
832
833 // cleanup_R1();
834
835 // These sums can't overflow, so no qadd8 needed.
836 sat1 += sat2;
837 val1 += val2;
838
839 uint8_t deltaHue = (uint8_t)(hue2 - hue1);
840 if (deltaHue & 0x80) {
841 // go backwards
842 hue1 -= scale8(256 - deltaHue, f2);
843 } else {
844 // go forwards
845 hue1 += scale8(deltaHue, f2);
846 }
847
848 cleanup_R1();
849 }
850
851 if (brightness != 255) {
852 val1 = scale8_video(val1, brightness);
853 }
854
855 return CHSV(hue1, sat1, val1);
856}
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
LIB8STATIC uint8_t map8(uint8_t in, uint8_t rangeStart, uint8_t rangeEnd)
Map from one full-range 8-bit value into a narrower range of 8-bit values, possibly a range of hues.
Definition lib8tion.h:541
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
Definition scale8.h:339
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8() does not clean up the R1 register on AVR.
Definition scale8.h:176
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
Definition scale8.h:123
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Definition scale8.h:40
uint8_t lsrX4(uint8_t dividend)
Helper function to divide a number by 16, aka four logical shift right (LSR)'s.

References blend(), brightness, cleanup_R1(), lsrX4(), map8(), scale8(), scale8_LEAVING_R1_DIRTY(), and scale8_video().

+ Here is the call graph for this function:

◆ ColorFromPalette() [2/8]

CHSV fl::ColorFromPalette ( const CHSVPalette256 & pal,
uint8_t index,
uint8_t brightness,
TBlendType  )

Definition at line 951 of file colorutils.cpp.

952 {
953 CHSV hsv = *(&(pal[0]) + index);
954
955 if (brightness != 255) {
956 hsv.value = scale8_video(hsv.value, brightness);
957 }
958
959 return hsv;
960}

References brightness, and scale8_video().

+ Here is the call graph for this function:

◆ ColorFromPalette() [3/8]

CHSV fl::ColorFromPalette ( const CHSVPalette32 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 858 of file colorutils.cpp.

859 {
860 if (blendType == LINEARBLEND_NOWRAP) {
861 index = map8(index, 0, 247); // Blend range is affected by lo3 blend of
862 // values, remap to avoid wrapping
863 }
864
865 uint8_t hi5 = index;
866#if defined(__AVR__)
867 hi5 /= 2;
868 hi5 /= 2;
869 hi5 /= 2;
870#else
871 hi5 >>= 3;
872#endif
873 uint8_t lo3 = index & 0x07;
874
875 uint8_t hi5XsizeofCHSV = hi5 * sizeof(CHSV);
876 const CHSV *entry = (CHSV *)((uint8_t *)(&(pal[0])) + hi5XsizeofCHSV);
877
878 uint8_t hue1 = entry->hue;
879 uint8_t sat1 = entry->sat;
880 uint8_t val1 = entry->val;
881
882 uint8_t blend = lo3 && (blendType != NOBLEND);
883
884 if (blend) {
885
886 if (hi5 == 31) {
887 entry = &(pal[0]);
888 } else {
889 ++entry;
890 }
891
892 uint8_t f2 = lo3 << 5;
893 uint8_t f1 = 255 - f2;
894
895 uint8_t hue2 = entry->hue;
896 uint8_t sat2 = entry->sat;
897 uint8_t val2 = entry->val;
898
899 // Now some special casing for blending to or from
900 // either black or white. Black and white don't have
901 // proper 'hue' of their own, so when ramping from
902 // something else to/from black/white, we set the 'hue'
903 // of the black/white color to be the same as the hue
904 // of the other color, so that you get the expected
905 // brightness or saturation ramp, with hue staying
906 // constant:
907
908 // If we are starting from white (sat=0)
909 // or black (val=0), adopt the target hue.
910 if (sat1 == 0 || val1 == 0) {
911 hue1 = hue2;
912 }
913
914 // If we are ending at white (sat=0)
915 // or black (val=0), adopt the starting hue.
916 if (sat2 == 0 || val2 == 0) {
917 hue2 = hue1;
918 }
919
920 sat1 = scale8_LEAVING_R1_DIRTY(sat1, f1);
921 val1 = scale8_LEAVING_R1_DIRTY(val1, f1);
922
923 sat2 = scale8_LEAVING_R1_DIRTY(sat2, f2);
924 val2 = scale8_LEAVING_R1_DIRTY(val2, f2);
925
926 // cleanup_R1();
927
928 // These sums can't overflow, so no qadd8 needed.
929 sat1 += sat2;
930 val1 += val2;
931
932 uint8_t deltaHue = (uint8_t)(hue2 - hue1);
933 if (deltaHue & 0x80) {
934 // go backwards
935 hue1 -= scale8(256 - deltaHue, f2);
936 } else {
937 // go forwards
938 hue1 += scale8(deltaHue, f2);
939 }
940
941 cleanup_R1();
942 }
943
944 if (brightness != 255) {
945 val1 = scale8_video(val1, brightness);
946 }
947
948 return CHSV(hue1, sat1, val1);
949}

References blend(), brightness, cleanup_R1(), map8(), scale8(), scale8_LEAVING_R1_DIRTY(), and scale8_video().

+ Here is the call graph for this function:

◆ ColorFromPalette() [4/8]

CRGB fl::ColorFromPalette ( const CRGBPalette16 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 299 of file colorutils.cpp.

300 {
301 if (blendType == LINEARBLEND_NOWRAP) {
302 index = map8(index, 0, 239); // Blend range is affected by lo4 blend of
303 // values, remap to avoid wrapping
304 }
305
306 // hi4 = index >> 4;
307 uint8_t hi4 = lsrX4(index);
308 uint8_t lo4 = index & 0x0F;
309
310 // const CRGB* entry = &(pal[0]) + hi4;
311 // since hi4 is always 0..15, hi4 * sizeof(CRGB) can be a single-byte value,
312 // instead of the two byte 'int' that avr-gcc defaults to.
313 // So, we multiply hi4 X sizeof(CRGB), giving hi4XsizeofCRGB;
314 uint8_t hi4XsizeofCRGB = hi4 * sizeof(CRGB);
315 // We then add that to a base array pointer.
316 const CRGB *entry = (CRGB *)((uint8_t *)(&(pal[0])) + hi4XsizeofCRGB);
317
318 uint8_t blend = lo4 && (blendType != NOBLEND);
319
320 uint8_t red1 = entry->red;
321 uint8_t green1 = entry->green;
322 uint8_t blue1 = entry->blue;
323
324 if (blend) {
325
326 if (hi4 == 15) {
327 entry = &(pal[0]);
328 } else {
329 ++entry;
330 }
331
332 uint8_t f2 = lo4 << 4;
333 uint8_t f1 = 255 - f2;
334
335 // rgb1.nscale8(f1);
336 uint8_t red2 = entry->red;
337 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
338 red2 = scale8_LEAVING_R1_DIRTY(red2, f2);
339 red1 += red2;
340
341 uint8_t green2 = entry->green;
342 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
343 green2 = scale8_LEAVING_R1_DIRTY(green2, f2);
344 green1 += green2;
345
346 uint8_t blue2 = entry->blue;
347 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
348 blue2 = scale8_LEAVING_R1_DIRTY(blue2, f2);
349 blue1 += blue2;
350
351 cleanup_R1();
352 }
353
354 if (brightness != 255) {
355 if (brightness) {
356 ++brightness; // adjust for rounding
357 // Now, since brightness is nonzero, we don't need the full
358 // scale8_video logic; we can just to scale8 and then add one
359 // (unless scale8 fixed) to all nonzero inputs.
360 if (red1) {
362#if !(FASTLED_SCALE8_FIXED == 1)
363 ++red1;
364#endif
365 }
366 if (green1) {
367 green1 = scale8_LEAVING_R1_DIRTY(green1, brightness);
368#if !(FASTLED_SCALE8_FIXED == 1)
369 ++green1;
370#endif
371 }
372 if (blue1) {
373 blue1 = scale8_LEAVING_R1_DIRTY(blue1, brightness);
374#if !(FASTLED_SCALE8_FIXED == 1)
375 ++blue1;
376#endif
377 }
378 cleanup_R1();
379 } else {
380 red1 = 0;
381 green1 = 0;
382 blue1 = 0;
383 }
384 }
385
386 return CRGB(red1, green1, blue1);
387}

References blend(), brightness, cleanup_R1(), lsrX4(), map8(), and scale8_LEAVING_R1_DIRTY().

Referenced by fl::DemoReel100::bpm(), fl::TwinkleFox::computeOneTwinkle(), fl::Fire2012::draw(), Fire2023(), loop(), fl::NoisePalette::mapNoiseToLEDsUsingPalette(), fl::Pacifica::pacifica_one_layer(), UpscalePalette(), UpscalePalette(), UpscalePalette(), and UpscalePalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorFromPalette() [5/8]

CRGB fl::ColorFromPalette ( const CRGBPalette256 & pal,
uint8_t index,
uint8_t brightness,
TBlendType  )

Definition at line 704 of file colorutils.cpp.

705 {
706 const CRGB *entry = &(pal[0]) + index;
707
708 uint8_t red = entry->red;
709 uint8_t green = entry->green;
710 uint8_t blue = entry->blue;
711
712 if (brightness != 255) {
713 ++brightness; // adjust for rounding
717 cleanup_R1();
718 }
719
720 return CRGB(red, green, blue);
721}
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8_video() does not clean up the R1 register on AVR.
Definition scale8.h:268

References brightness, cleanup_R1(), and scale8_video_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPalette() [6/8]

CRGB fl::ColorFromPalette ( const CRGBPalette32 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 520 of file colorutils.cpp.

521 {
522 if (blendType == LINEARBLEND_NOWRAP) {
523 index = map8(index, 0, 247); // Blend range is affected by lo3 blend of
524 // values, remap to avoid wrapping
525 }
526
527 uint8_t hi5 = index;
528#if defined(__AVR__)
529 hi5 /= 2;
530 hi5 /= 2;
531 hi5 /= 2;
532#else
533 hi5 >>= 3;
534#endif
535 uint8_t lo3 = index & 0x07;
536
537 // const CRGB* entry = &(pal[0]) + hi5;
538 // since hi5 is always 0..31, hi4 * sizeof(CRGB) can be a single-byte value,
539 // instead of the two byte 'int' that avr-gcc defaults to.
540 // So, we multiply hi5 X sizeof(CRGB), giving hi5XsizeofCRGB;
541 uint8_t hi5XsizeofCRGB = hi5 * sizeof(CRGB);
542 // We then add that to a base array pointer.
543 const CRGB *entry = (CRGB *)((uint8_t *)(&(pal[0])) + hi5XsizeofCRGB);
544
545 uint8_t red1 = entry->red;
546 uint8_t green1 = entry->green;
547 uint8_t blue1 = entry->blue;
548
549 uint8_t blend = lo3 && (blendType != NOBLEND);
550
551 if (blend) {
552
553 if (hi5 == 31) {
554 entry = &(pal[0]);
555 } else {
556 ++entry;
557 }
558
559 uint8_t f2 = lo3 << 5;
560 uint8_t f1 = 255 - f2;
561
562 uint8_t red2 = entry->red;
563 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
564 red2 = scale8_LEAVING_R1_DIRTY(red2, f2);
565 red1 += red2;
566
567 uint8_t green2 = entry->green;
568 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
569 green2 = scale8_LEAVING_R1_DIRTY(green2, f2);
570 green1 += green2;
571
572 uint8_t blue2 = entry->blue;
573 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
574 blue2 = scale8_LEAVING_R1_DIRTY(blue2, f2);
575 blue1 += blue2;
576
577 cleanup_R1();
578 }
579
580 if (brightness != 255) {
581 if (brightness) {
582 ++brightness; // adjust for rounding
583 // Now, since brightness is nonzero, we don't need the full
584 // scale8_video logic; we can just to scale8 and then add one
585 // (unless scale8 fixed) to all nonzero inputs.
586 if (red1) {
588#if !(FASTLED_SCALE8_FIXED == 1)
589 ++red1;
590#endif
591 }
592 if (green1) {
593 green1 = scale8_LEAVING_R1_DIRTY(green1, brightness);
594#if !(FASTLED_SCALE8_FIXED == 1)
595 ++green1;
596#endif
597 }
598 if (blue1) {
599 blue1 = scale8_LEAVING_R1_DIRTY(blue1, brightness);
600#if !(FASTLED_SCALE8_FIXED == 1)
601 ++blue1;
602#endif
603 }
604 cleanup_R1();
605 } else {
606 red1 = 0;
607 green1 = 0;
608 blue1 = 0;
609 }
610 }
611
612 return CRGB(red1, green1, blue1);
613}

References blend(), brightness, cleanup_R1(), map8(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPalette() [7/8]

CRGB fl::ColorFromPalette ( const TProgmemRGBPalette16 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 437 of file colorutils.cpp.

438 {
439 if (blendType == LINEARBLEND_NOWRAP) {
440 index = map8(index, 0, 239); // Blend range is affected by lo4 blend of
441 // values, remap to avoid wrapping
442 }
443
444 // hi4 = index >> 4;
445 uint8_t hi4 = lsrX4(index);
446 uint8_t lo4 = index & 0x0F;
447
448 CRGB entry(FL_PGM_READ_DWORD_NEAR(&(pal[0]) + hi4));
449
450 uint8_t red1 = entry.red;
451 uint8_t green1 = entry.green;
452 uint8_t blue1 = entry.blue;
453
454 uint8_t blend = lo4 && (blendType != NOBLEND);
455
456 if (blend) {
457
458 if (hi4 == 15) {
459 entry = FL_PGM_READ_DWORD_NEAR(&(pal[0]));
460 } else {
461 entry = FL_PGM_READ_DWORD_NEAR(&(pal[1]) + hi4);
462 }
463
464 uint8_t f2 = lo4 << 4;
465 uint8_t f1 = 255 - f2;
466
467 uint8_t red2 = entry.red;
468 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
469 red2 = scale8_LEAVING_R1_DIRTY(red2, f2);
470 red1 += red2;
471
472 uint8_t green2 = entry.green;
473 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
474 green2 = scale8_LEAVING_R1_DIRTY(green2, f2);
475 green1 += green2;
476
477 uint8_t blue2 = entry.blue;
478 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
479 blue2 = scale8_LEAVING_R1_DIRTY(blue2, f2);
480 blue1 += blue2;
481
482 cleanup_R1();
483 }
484
485 if (brightness != 255) {
486 if (brightness) {
487 ++brightness; // adjust for rounding
488 // Now, since brightness is nonzero, we don't need the full
489 // scale8_video logic; we can just to scale8 and then add one
490 // (unless scale8 fixed) to all nonzero inputs.
491 if (red1) {
493#if !(FASTLED_SCALE8_FIXED == 1)
494 ++red1;
495#endif
496 }
497 if (green1) {
498 green1 = scale8_LEAVING_R1_DIRTY(green1, brightness);
499#if !(FASTLED_SCALE8_FIXED == 1)
500 ++green1;
501#endif
502 }
503 if (blue1) {
504 blue1 = scale8_LEAVING_R1_DIRTY(blue1, brightness);
505#if !(FASTLED_SCALE8_FIXED == 1)
506 ++blue1;
507#endif
508 }
509 cleanup_R1();
510 } else {
511 red1 = 0;
512 green1 = 0;
513 blue1 = 0;
514 }
515 }
516
517 return CRGB(red1, green1, blue1);
518}
#define FL_PGM_READ_DWORD_NEAR(x)
Read a double word (32-bit) from PROGMEM memory.

References blend(), brightness, cleanup_R1(), FL_PGM_READ_DWORD_NEAR, lsrX4(), map8(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPalette() [8/8]

CRGB fl::ColorFromPalette ( const TProgmemRGBPalette32 & pal,
uint8_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 615 of file colorutils.cpp.

616 {
617 if (blendType == LINEARBLEND_NOWRAP) {
618 index = map8(index, 0, 247); // Blend range is affected by lo3 blend of
619 // values, remap to avoid wrapping
620 }
621
622 uint8_t hi5 = index;
623#if defined(__AVR__)
624 hi5 /= 2;
625 hi5 /= 2;
626 hi5 /= 2;
627#else
628 hi5 >>= 3;
629#endif
630 uint8_t lo3 = index & 0x07;
631
632 CRGB entry(FL_PGM_READ_DWORD_NEAR(&(pal[0]) + hi5));
633
634 uint8_t red1 = entry.red;
635 uint8_t green1 = entry.green;
636 uint8_t blue1 = entry.blue;
637
638 uint8_t blend = lo3 && (blendType != NOBLEND);
639
640 if (blend) {
641
642 if (hi5 == 31) {
643 entry = FL_PGM_READ_DWORD_NEAR(&(pal[0]));
644 } else {
645 entry = FL_PGM_READ_DWORD_NEAR(&(pal[1]) + hi5);
646 }
647
648 uint8_t f2 = lo3 << 5;
649 uint8_t f1 = 255 - f2;
650
651 uint8_t red2 = entry.red;
652 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
653 red2 = scale8_LEAVING_R1_DIRTY(red2, f2);
654 red1 += red2;
655
656 uint8_t green2 = entry.green;
657 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
658 green2 = scale8_LEAVING_R1_DIRTY(green2, f2);
659 green1 += green2;
660
661 uint8_t blue2 = entry.blue;
662 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
663 blue2 = scale8_LEAVING_R1_DIRTY(blue2, f2);
664 blue1 += blue2;
665
666 cleanup_R1();
667 }
668
669 if (brightness != 255) {
670 if (brightness) {
671 ++brightness; // adjust for rounding
672 // Now, since brightness is nonzero, we don't need the full
673 // scale8_video logic; we can just to scale8 and then add one
674 // (unless scale8 fixed) to all nonzero inputs.
675 if (red1) {
677#if !(FASTLED_SCALE8_FIXED == 1)
678 ++red1;
679#endif
680 }
681 if (green1) {
682 green1 = scale8_LEAVING_R1_DIRTY(green1, brightness);
683#if !(FASTLED_SCALE8_FIXED == 1)
684 ++green1;
685#endif
686 }
687 if (blue1) {
688 blue1 = scale8_LEAVING_R1_DIRTY(blue1, brightness);
689#if !(FASTLED_SCALE8_FIXED == 1)
690 ++blue1;
691#endif
692 }
693 cleanup_R1();
694 } else {
695 red1 = 0;
696 green1 = 0;
697 blue1 = 0;
698 }
699 }
700
701 return CRGB(red1, green1, blue1);
702}

References blend(), brightness, cleanup_R1(), FL_PGM_READ_DWORD_NEAR, map8(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPaletteExtended() [1/3]

CRGB fl::ColorFromPaletteExtended ( const CRGBPalette16 & pal,
uint16_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 389 of file colorutils.cpp.

390 {
391 // Extract the four most significant bits of the index as a palette index.
392 uint8_t index_4bit = index >> 12;
393 // Calculate the 8-bit offset from the palette index.
394 uint8_t offset = (uint8_t)(index >> 4);
395 // Get the palette entry from the 4-bit index
396 const CRGB *entry = &(pal[0]) + index_4bit;
397 uint8_t red1 = entry->red;
398 uint8_t green1 = entry->green;
399 uint8_t blue1 = entry->blue;
400
401 uint8_t blend = offset && (blendType != NOBLEND);
402 if (blend) {
403 if (index_4bit == 15) {
404 entry = &(pal[0]);
405 } else {
406 entry++;
407 }
408
409 // Calculate the scaling factor and scaled values for the lower palette
410 // value.
411 uint8_t f1 = 255 - offset;
412 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
413 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
414 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
415
416 // Calculate the scaled values for the neighbouring palette value.
417 uint8_t red2 = entry->red;
418 uint8_t green2 = entry->green;
419 uint8_t blue2 = entry->blue;
420 red2 = scale8_LEAVING_R1_DIRTY(red2, offset);
421 green2 = scale8_LEAVING_R1_DIRTY(green2, offset);
422 blue2 = scale8_LEAVING_R1_DIRTY(blue2, offset);
423 cleanup_R1();
424
425 // These sums can't overflow, so no qadd8 needed.
426 red1 += red2;
427 green1 += green2;
428 blue1 += blue2;
429 }
430 if (brightness != 255) {
431 // nscale8x3_video(red1, green1, blue1, brightness);
432 nscale8x3(red1, green1, blue1, brightness);
433 }
434 return CRGB(red1, green1, blue1);
435}
UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
LIB8STATIC void nscale8x3(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose de...
Definition scale8.h:363

References blend(), brightness, cleanup_R1(), nscale8x3(), offset(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPaletteExtended() [2/3]

CRGB fl::ColorFromPaletteExtended ( const CRGBPalette256 & pal,
uint16_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 723 of file colorutils.cpp.

724 {
725 // Extract the eight most significant bits of the index as a palette index.
726 uint8_t index_8bit = index >> 8;
727 // Calculate the 8-bit offset from the palette index.
728 uint8_t offset = index & 0xff;
729 // Get the palette entry from the 8-bit index
730 const CRGB *entry = &(pal[0]) + index_8bit;
731 uint8_t red1 = entry->red;
732 uint8_t green1 = entry->green;
733 uint8_t blue1 = entry->blue;
734
735 uint8_t blend = offset && (blendType != NOBLEND);
736 if (blend) {
737 if (index_8bit == 255) {
738 entry = &(pal[0]);
739 } else {
740 entry++;
741 }
742
743 // Calculate the scaling factor and scaled values for the lower palette
744 // value.
745 uint8_t f1 = 255 - offset;
746 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
747 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
748 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
749
750 // Calculate the scaled values for the neighbouring palette value.
751 uint8_t red2 = entry->red;
752 uint8_t green2 = entry->green;
753 uint8_t blue2 = entry->blue;
754 red2 = scale8_LEAVING_R1_DIRTY(red2, offset);
755 green2 = scale8_LEAVING_R1_DIRTY(green2, offset);
756 blue2 = scale8_LEAVING_R1_DIRTY(blue2, offset);
757 cleanup_R1();
758
759 // These sums can't overflow, so no qadd8 needed.
760 red1 += red2;
761 green1 += green2;
762 blue1 += blue2;
763 }
764 if (brightness != 255) {
765 // nscale8x3_video(red1, green1, blue1, brightness);
766 nscale8x3(red1, green1, blue1, brightness);
767 }
768 return CRGB(red1, green1, blue1);
769}

References blend(), brightness, cleanup_R1(), nscale8x3(), offset(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ ColorFromPaletteExtended() [3/3]

CRGB fl::ColorFromPaletteExtended ( const CRGBPalette32 & pal,
uint16_t index,
uint8_t brightness,
TBlendType blendType )

Definition at line 252 of file colorutils.cpp.

253 {
254 // Extract the five most significant bits of the index as a palette index.
255 uint8_t index_5bit = (index >> 11);
256 // Calculate the 8-bit offset from the palette index.
257 uint8_t offset = (uint8_t)(index >> 3);
258 // Get the palette entry from the 5-bit index
259 const CRGB *entry = &(pal[0]) + index_5bit;
260 uint8_t red1 = entry->red;
261 uint8_t green1 = entry->green;
262 uint8_t blue1 = entry->blue;
263
264 uint8_t blend = offset && (blendType != NOBLEND);
265 if (blend) {
266 if (index_5bit == 31) {
267 entry = &(pal[0]);
268 } else {
269 entry++;
270 }
271
272 // Calculate the scaling factor and scaled values for the lower palette
273 // value.
274 uint8_t f1 = 255 - offset;
275 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
276 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
277 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
278
279 // Calculate the scaled values for the neighbouring palette value.
280 uint8_t red2 = entry->red;
281 uint8_t green2 = entry->green;
282 uint8_t blue2 = entry->blue;
283 red2 = scale8_LEAVING_R1_DIRTY(red2, offset);
284 green2 = scale8_LEAVING_R1_DIRTY(green2, offset);
285 blue2 = scale8_LEAVING_R1_DIRTY(blue2, offset);
286 cleanup_R1();
287
288 // These sums can't overflow, so no qadd8 needed.
289 red1 += red2;
290 green1 += green2;
291 blue1 += blue2;
292 }
293 if (brightness != 255) {
294 nscale8x3_video(red1, green1, blue1, brightness);
295 }
296 return CRGB(red1, green1, blue1);
297}
LIB8STATIC void nscale8x3_video(uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale)
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose de...
Definition scale8.h:397

References blend(), brightness, cleanup_R1(), nscale8x3_video(), offset(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ cos16lut()

static FASTLED_FORCE_INLINE int16_t fl::cos16lut ( uint16_t angle)
static

Definition at line 63 of file sin32.h.

63 {
64 uint8_t angle256 = angle / 256;
65 int32_t subAngle = angle % 256;
66 return (cosArray[angle256] * (256 - subAngle) +
67 cosArray[angle256 + 1] * subAngle) /
68 256;
69}
const int16_t * cosArray
Definition sin32.cpp:47

References cosArray, and FASTLED_FORCE_INLINE.

◆ cos32()

static FASTLED_FORCE_INLINE int32_t fl::cos32 ( uint32_t angle)
static

Definition at line 44 of file sin32.h.

44 {
45 uint8_t angle256 = angle / 65536;
46 int32_t subAngle = angle % 65536;
47 return cosArray[angle256] * (65536 - subAngle) +
48 cosArray[angle256 + 1] * subAngle;
49}

References cosArray, and FASTLED_FORCE_INLINE.

◆ downscale()

void fl::downscale ( const CRGB * src,
const XYMap & srcXY,
CRGB * dst,
const XYMap & dstXY )

Definition at line 153 of file downscale.cpp.

154 {
155 uint16_t srcWidth = srcXY.getWidth();
156 uint16_t srcHeight = srcXY.getHeight();
157 uint16_t dstWidth = dstXY.getWidth();
158 uint16_t dstHeight = dstXY.getHeight();
159
160 FASTLED_ASSERT(dstWidth <= srcWidth,
161 "Destination width must be <= source width");
162 FASTLED_ASSERT(dstHeight <= srcHeight,
163 "Destination height must be <= source height");
164 const bool destination_is_half_of_source =
165 (dstWidth * 2 == srcWidth) && (dstHeight * 2 == srcHeight);
166 // Attempt to use the downscaleHalf function if the destination is half the
167 // size of the source.
168 if (destination_is_half_of_source) {
169 const bool both_rectangles = (srcXY.getType() == XYMap::kLineByLine) &&
170 (dstXY.getType() == XYMap::kLineByLine);
171 if (both_rectangles) {
172 // If both source and destination are rectangular, we can use the
173 // optimized version
174 downscaleHalf(src, srcWidth, srcHeight, dst);
175 } else {
176 // Otherwise, we need to use the mapped version
177 downscaleHalf(src, srcXY, dst, dstXY);
178 }
179 return;
180 }
181
182 downscaleArbitrary(src, srcXY, dst, dstXY);
183}
XyMapType getType() const
Definition xymap.cpp:130
uint16_t getWidth() const
Definition xymap.cpp:124
@ kLineByLine
Definition xymap.h:45
uint16_t getHeight() const
Definition xymap.cpp:126
void downscaleArbitrary(const CRGB *src, const XYMap &srcXY, CRGB *dst, const XYMap &dstXY)
Definition downscale.cpp:81
void downscaleHalf(const CRGB *src, uint16_t srcWidth, uint16_t srcHeight, CRGB *dst)
Definition downscale.cpp:17

References downscaleArbitrary(), downscaleHalf(), fl::XYMap::getHeight(), fl::XYMap::getType(), fl::XYMap::getWidth(), and fl::XYMap::kLineByLine.

Referenced by CRGB::downscale(), and loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downscaleArbitrary()

void fl::downscaleArbitrary ( const CRGB * src,
const XYMap & srcXY,
CRGB * dst,
const XYMap & dstXY )

Definition at line 81 of file downscale.cpp.

82 {
83 const uint16_t srcWidth = srcXY.getWidth();
84 const uint16_t srcHeight = srcXY.getHeight();
85 const uint16_t dstWidth = dstXY.getWidth();
86 const uint16_t dstHeight = dstXY.getHeight();
87
88 const uint32_t FP_ONE = 256; // Q8.8 fixed-point multiplier
89
90 FASTLED_ASSERT(dstWidth <= srcWidth,
91 "Destination width must be <= source width");
92 FASTLED_ASSERT(dstHeight <= srcHeight,
93 "Destination height must be <= source height");
94
95 for (uint16_t dy = 0; dy < dstHeight; ++dy) {
96 // Fractional boundaries in Q8.8
97 uint32_t dstY0 = (dy * srcHeight * FP_ONE) / dstHeight;
98 uint32_t dstY1 = ((dy + 1) * srcHeight * FP_ONE) / dstHeight;
99
100 for (uint16_t dx = 0; dx < dstWidth; ++dx) {
101 uint32_t dstX0 = (dx * srcWidth * FP_ONE) / dstWidth;
102 uint32_t dstX1 = ((dx + 1) * srcWidth * FP_ONE) / dstWidth;
103
104 uint64_t rSum = 0, gSum = 0, bSum = 0;
105 uint32_t totalWeight = 0;
106
107 // Find covered source pixels
108 uint16_t srcY_start = dstY0 / FP_ONE;
109 uint16_t srcY_end = (dstY1 + FP_ONE - 1) / FP_ONE; // ceil
110
111 uint16_t srcX_start = dstX0 / FP_ONE;
112 uint16_t srcX_end = (dstX1 + FP_ONE - 1) / FP_ONE; // ceil
113
114 for (uint16_t sy = srcY_start; sy < srcY_end; ++sy) {
115 // Calculate vertical overlap in Q8.8
116 uint32_t sy0 = sy * FP_ONE;
117 uint32_t sy1 = (sy + 1) * FP_ONE;
118 uint32_t y_overlap = MIN(dstY1, sy1) - MAX(dstY0, sy0);
119 if (y_overlap == 0)
120 continue;
121
122 for (uint16_t sx = srcX_start; sx < srcX_end; ++sx) {
123 uint32_t sx0 = sx * FP_ONE;
124 uint32_t sx1 = (sx + 1) * FP_ONE;
125 uint32_t x_overlap = MIN(dstX1, sx1) - MAX(dstX0, sx0);
126 if (x_overlap == 0)
127 continue;
128
129 uint32_t weight = (x_overlap * y_overlap + (FP_ONE >> 1)) >>
130 8; // Q8.8 * Q8.8 → Q16.16 → Q8.8
131
132 const CRGB &p = src[srcXY.mapToIndex(sx, sy)];
133 rSum += p.r * weight;
134 gSum += p.g * weight;
135 bSum += p.b * weight;
136 totalWeight += weight;
137 }
138 }
139
140 // Final division, rounding
141 uint8_t r =
142 totalWeight ? (rSum + (totalWeight >> 1)) / totalWeight : 0;
143 uint8_t g =
144 totalWeight ? (gSum + (totalWeight >> 1)) / totalWeight : 0;
145 uint8_t b =
146 totalWeight ? (bSum + (totalWeight >> 1)) / totalWeight : 0;
147
148 dst[dstXY.mapToIndex(dx, dy)] = CRGB(r, g, b);
149 }
150 }
151}
uint16_t mapToIndex(const uint16_t &x, const uint16_t &y) const
Definition xymap.cpp:97
#define MIN(a, b)
Definition math_macros.h:15
#define MAX(a, b)
Definition math_macros.h:11
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
Definition noise.cpp:30

References fl::XYMap::getHeight(), fl::XYMap::getWidth(), fl::XYMap::mapToIndex(), MAX, MIN, and p.

Referenced by downscale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downscaleHalf() [1/2]

void fl::downscaleHalf ( const CRGB * src,
const XYMap & srcXY,
CRGB * dst,
const XYMap & dstXY )

Definition at line 46 of file downscale.cpp.

47 {
48 uint16_t dstWidth = dstXY.getWidth();
49 uint16_t dstHeight = dstXY.getHeight();
50
51 FASTLED_ASSERT(srcXY.getWidth() == dstXY.getWidth() * 2,
52 "Source width must be double the destination width");
53 FASTLED_ASSERT(srcXY.getHeight() == dstXY.getHeight() * 2,
54 "Source height must be double the destination height");
55
56 for (uint16_t y = 0; y < dstHeight; ++y) {
57 for (uint16_t x = 0; x < dstWidth; ++x) {
58 // Map to top-left of the 2x2 block in source
59 uint16_t srcX = x * 2;
60 uint16_t srcY = y * 2;
61
62 // Fetch 2x2 block
63 const CRGB &p00 = src[srcXY.mapToIndex(srcX, srcY)];
64 const CRGB &p10 = src[srcXY.mapToIndex(srcX + 1, srcY)];
65 const CRGB &p01 = src[srcXY.mapToIndex(srcX, srcY + 1)];
66 const CRGB &p11 = src[srcXY.mapToIndex(srcX + 1, srcY + 1)];
67
68 // Average each color channel
69 uint16_t r =
70 (p00.r + p10.r + p01.r + p11.r + 2) / 4; // +2 for rounding
71 uint16_t g = (p00.g + p10.g + p01.g + p11.g + 2) / 4;
72 uint16_t b = (p00.b + p10.b + p01.b + p11.b + 2) / 4;
73
74 // Store result
75 dst[dstXY.mapToIndex(x, y)] =
76 CRGB((uint8_t)r, (uint8_t)g, (uint8_t)b);
77 }
78 }
79}

References fl::XYMap::getHeight(), fl::XYMap::getWidth(), fl::XYMap::mapToIndex(), x, and y.

+ Here is the call graph for this function:

◆ downscaleHalf() [2/2]

void fl::downscaleHalf ( const CRGB * src,
uint16_t srcWidth,
uint16_t srcHeight,
CRGB * dst )

Definition at line 17 of file downscale.cpp.

18 {
19 uint16_t dstWidth = srcWidth / 2;
20 uint16_t dstHeight = srcHeight / 2;
21
22 for (uint16_t y = 0; y < dstHeight; ++y) {
23 for (uint16_t x = 0; x < dstWidth; ++x) {
24 // Map to top-left of the 2x2 block in source
25 uint16_t srcX = x * 2;
26 uint16_t srcY = y * 2;
27
28 // Fetch 2x2 block
29 const CRGB &p00 = src[(srcY)*srcWidth + (srcX)];
30 const CRGB &p10 = src[(srcY)*srcWidth + (srcX + 1)];
31 const CRGB &p01 = src[(srcY + 1) * srcWidth + (srcX)];
32 const CRGB &p11 = src[(srcY + 1) * srcWidth + (srcX + 1)];
33
34 // Average each color channel
35 uint16_t r =
36 (p00.r + p10.r + p01.r + p11.r + 2) / 4; // +2 for rounding
37 uint16_t g = (p00.g + p10.g + p01.g + p11.g + 2) / 4;
38 uint16_t b = (p00.b + p10.b + p01.b + p11.b + 2) / 4;
39
40 // Store result
41 dst[y * dstWidth + x] = CRGB((uint8_t)r, (uint8_t)g, (uint8_t)b);
42 }
43 }
44}

References x, and y.

Referenced by downscale(), and loop().

+ Here is the caller graph for this function:

◆ drawSquare()

void fl::drawSquare ( void * ,
uint16_t ,
uint16_t ,
int ,
int ,
uint32_t ,
uint32_t  )

◆ fade_raw()

void fl::fade_raw ( CRGB * leds,
uint16_t num_leds,
uint8_t fadeBy )

Definition at line 165 of file colorutils.cpp.

165 {
166 nscale8(leds, num_leds, 255 - fadeBy);
167}
void nscale8(CRGB *leds, uint16_t num_leds, uint8_t scale)

References leds, and nscale8().

+ Here is the call graph for this function:

◆ fade_video()

void fl::fade_video ( CRGB * leds,
uint16_t num_leds,
uint8_t fadeBy )

Definition at line 153 of file colorutils.cpp.

153 {
154 nscale8_video(leds, num_leds, 255 - fadeBy);
155}
void nscale8_video(CRGB *leds, uint16_t num_leds, uint8_t scale)

References leds, and nscale8_video().

+ Here is the call graph for this function:

◆ fadeLightBy()

void fl::fadeLightBy ( CRGB * leds,
uint16_t num_leds,
uint8_t fadeBy )

Definition at line 157 of file colorutils.cpp.

157 {
158 nscale8_video(leds, num_leds, 255 - fadeBy);
159}

References leds, and nscale8_video().

+ Here is the call graph for this function:

◆ fadeToBlackBy()

void fl::fadeToBlackBy ( CRGB * leds,
uint16_t num_leds,
uint8_t fadeBy )

Definition at line 161 of file colorutils.cpp.

161 {
162 nscale8(leds, num_leds, 255 - fadeBy);
163}

References leds, and nscale8().

Referenced by fl::DemoReel100::confetti(), fl::DemoReel100::juggle(), and fl::DemoReel100::sinelon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fadeToColorBy()

void fl::fadeToColorBy ( void * ,
uint16_t ,
uint32_t ,
uint8_t  )

◆ fadeUsingColor()

void fl::fadeUsingColor ( CRGB * leds,
uint16_t numLeds,
const CRGB & colormask )

Definition at line 175 of file colorutils.cpp.

175 {
176 uint8_t fr, fg, fb;
177 fr = colormask.r;
178 fg = colormask.g;
179 fb = colormask.b;
180
181 for (uint16_t i = 0; i < numLeds; ++i) {
182 leds[i].r = scale8_LEAVING_R1_DIRTY(leds[i].r, fr);
183 leds[i].g = scale8_LEAVING_R1_DIRTY(leds[i].g, fg);
184 leds[i].b = scale8(leds[i].b, fb);
185 }
186}

References leds, scale8(), and scale8_LEAVING_R1_DIRTY().

+ Here is the call graph for this function:

◆ fast_hash32()

static uint32_t fl::fast_hash32 ( uint32_t x)
inlinestaticnoexcept

Definition at line 76 of file hash.h.

76 {
77 x = (x ^ 61u) ^ (x >> 16);
78 x = x + (x << 3);
79 x = x ^ (x >> 4);
80 x = x * 0x27d4eb2dU;
81 x = x ^ (x >> 15);
82 return x;
83}

References x.

Referenced by hash_pair(), fl::FastHash< Key >::operator()(), fl::FastHash< vec2< T > >::operator()(), and fl::Hash< T * >::operator()().

+ Here is the caller graph for this function:

◆ fastled_file_offset()

const char * fl::fastled_file_offset ( const char * file)
inline

Definition at line 8 of file dbg.h.

8 {
9 const char *p = file;
10 const char *last_slash = nullptr;
11
12 while (*p) {
13 if (p[0] == 's' && p[1] == 'r' && p[2] == 'c' && p[3] == '/') {
14 return p; // Skip past "src/"
15 }
16 if (*p == '/') { // fallback to using last slash
17 last_slash = p;
18 }
19 p++;
20 }
21 // If "src/" not found but we found at least one slash, return after the
22 // last slash
23 if (last_slash) {
24 return last_slash + 1;
25 }
26 return file; // If no slashes found at all, return original path
27}

References p.

◆ FASTLED_SMART_PTR() [1/51]

fl::FASTLED_SMART_PTR ( Animartrix )

◆ FASTLED_SMART_PTR() [2/51]

fl::FASTLED_SMART_PTR ( ArchimedeanSpiralPath )

◆ FASTLED_SMART_PTR() [3/51]

fl::FASTLED_SMART_PTR ( AudioSampleImpl )

◆ FASTLED_SMART_PTR() [4/51]

fl::FASTLED_SMART_PTR ( Blend2d )

◆ FASTLED_SMART_PTR() [5/51]

fl::FASTLED_SMART_PTR ( ByteStream )

◆ FASTLED_SMART_PTR() [6/51]

fl::FASTLED_SMART_PTR ( ByteStreamMemory )

◆ FASTLED_SMART_PTR() [7/51]

fl::FASTLED_SMART_PTR ( CatmullRomParams )

◆ FASTLED_SMART_PTR() [8/51]

fl::FASTLED_SMART_PTR ( CatmullRomPath )

◆ FASTLED_SMART_PTR() [9/51]

fl::FASTLED_SMART_PTR ( CirclePath )

◆ FASTLED_SMART_PTR() [10/51]

fl::FASTLED_SMART_PTR ( Cylon )

◆ FASTLED_SMART_PTR() [11/51]

fl::FASTLED_SMART_PTR ( DemoReel100 )

◆ FASTLED_SMART_PTR() [12/51]

fl::FASTLED_SMART_PTR ( DigitalPinImpl )

◆ FASTLED_SMART_PTR() [13/51]

fl::FASTLED_SMART_PTR ( FileHandle )

◆ FASTLED_SMART_PTR() [14/51]

fl::FASTLED_SMART_PTR ( FileSystem )

◆ FASTLED_SMART_PTR() [15/51]

fl::FASTLED_SMART_PTR ( Fire2012 )

Simple one-dimensional fire animation function.

◆ FASTLED_SMART_PTR() [16/51]

fl::FASTLED_SMART_PTR ( Frame )

◆ FASTLED_SMART_PTR() [17/51]

fl::FASTLED_SMART_PTR ( FrameInterpolator )

◆ FASTLED_SMART_PTR() [18/51]

fl::FASTLED_SMART_PTR ( FsImpl )

◆ FASTLED_SMART_PTR() [19/51]

fl::FASTLED_SMART_PTR ( Fx )

◆ FASTLED_SMART_PTR() [20/51]

fl::FASTLED_SMART_PTR ( Fx2d )

◆ FASTLED_SMART_PTR() [21/51]

fl::FASTLED_SMART_PTR ( FxLayer )

◆ FASTLED_SMART_PTR() [22/51]

fl::FASTLED_SMART_PTR ( GielisCurvePath )

◆ FASTLED_SMART_PTR() [23/51]

fl::FASTLED_SMART_PTR ( HeartPath )

◆ FASTLED_SMART_PTR() [24/51]

fl::FASTLED_SMART_PTR ( LinePath )

◆ FASTLED_SMART_PTR() [25/51]

fl::FASTLED_SMART_PTR ( LinePathParams )

◆ FASTLED_SMART_PTR() [26/51]

fl::FASTLED_SMART_PTR ( NoisePalette )

◆ FASTLED_SMART_PTR() [27/51]

fl::FASTLED_SMART_PTR ( NoiseWave )

◆ FASTLED_SMART_PTR() [28/51]

fl::FASTLED_SMART_PTR ( Pacifica )

◆ FASTLED_SMART_PTR() [29/51]

fl::FASTLED_SMART_PTR ( PhyllotaxisPath )

◆ FASTLED_SMART_PTR() [30/51]

fl::FASTLED_SMART_PTR ( PixelStream )

◆ FASTLED_SMART_PTR() [31/51]

fl::FASTLED_SMART_PTR ( PointPath )

◆ FASTLED_SMART_PTR() [32/51]

fl::FASTLED_SMART_PTR ( Pride2015 )

◆ FASTLED_SMART_PTR() [33/51]

fl::FASTLED_SMART_PTR ( RedSquare )

◆ FASTLED_SMART_PTR() [34/51]

fl::FASTLED_SMART_PTR ( RosePath )

◆ FASTLED_SMART_PTR() [35/51]

fl::FASTLED_SMART_PTR ( RosePathParams )

◆ FASTLED_SMART_PTR() [36/51]

fl::FASTLED_SMART_PTR ( ScaleUp )

◆ FASTLED_SMART_PTR() [37/51]

fl::FASTLED_SMART_PTR ( StringHolder )

◆ FASTLED_SMART_PTR() [38/51]

fl::FASTLED_SMART_PTR ( TimeFunction )

◆ FASTLED_SMART_PTR() [39/51]

fl::FASTLED_SMART_PTR ( TimeWarp )

◆ FASTLED_SMART_PTR() [40/51]

fl::FASTLED_SMART_PTR ( TransformFloatImpl )

◆ FASTLED_SMART_PTR() [41/51]

fl::FASTLED_SMART_PTR ( TwinkleFox )

◆ FASTLED_SMART_PTR() [42/51]

fl::FASTLED_SMART_PTR ( VideoFxWrapper )

◆ FASTLED_SMART_PTR() [43/51]

fl::FASTLED_SMART_PTR ( VideoImpl )

◆ FASTLED_SMART_PTR() [44/51]

fl::FASTLED_SMART_PTR ( WaveCrgbGradientMap )

◆ FASTLED_SMART_PTR() [45/51]

fl::FASTLED_SMART_PTR ( WaveCrgbMap )

◆ FASTLED_SMART_PTR() [46/51]

fl::FASTLED_SMART_PTR ( WaveCrgbMapDefault )

◆ FASTLED_SMART_PTR() [47/51]

fl::FASTLED_SMART_PTR ( WaveFx )

◆ FASTLED_SMART_PTR() [48/51]

fl::FASTLED_SMART_PTR ( XYPath )

◆ FASTLED_SMART_PTR() [49/51]

fl::FASTLED_SMART_PTR ( XYPathFunction )

◆ FASTLED_SMART_PTR() [50/51]

fl::FASTLED_SMART_PTR ( XYPathGenerator )

◆ FASTLED_SMART_PTR() [51/51]

fl::FASTLED_SMART_PTR ( XYPathRenderer )

◆ FASTLED_SMART_PTR_NO_FWD() [1/4]

fl::FASTLED_SMART_PTR_NO_FWD ( LUT16 )

◆ FASTLED_SMART_PTR_NO_FWD() [2/4]

fl::FASTLED_SMART_PTR_NO_FWD ( LUTXY16 )

◆ FASTLED_SMART_PTR_NO_FWD() [3/4]

fl::FASTLED_SMART_PTR_NO_FWD ( LUTXYFLOAT )

◆ FASTLED_SMART_PTR_NO_FWD() [4/4]

fl::FASTLED_SMART_PTR_NO_FWD ( LUTXYZFLOAT )

◆ FASTLED_UI_DEFINE_OPERATORS() [1/4]

fl::FASTLED_UI_DEFINE_OPERATORS ( UIButton )

◆ FASTLED_UI_DEFINE_OPERATORS() [2/4]

fl::FASTLED_UI_DEFINE_OPERATORS ( UICheckbox )

◆ FASTLED_UI_DEFINE_OPERATORS() [3/4]

fl::FASTLED_UI_DEFINE_OPERATORS ( UINumberField )

◆ FASTLED_UI_DEFINE_OPERATORS() [4/4]

fl::FASTLED_UI_DEFINE_OPERATORS ( UISlider )

◆ fill_gradient() [1/4]

template<typename T>
void fl::fill_gradient ( T * targetArray,
uint16_t numLeds,
const CHSV & c1,
const CHSV & c2,
const CHSV & c3,
const CHSV & c4,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Fill a range of LEDs with a smooth HSV gradient between four HSV colors.

See also
fill_gradient()
Parameters
targetArraya pointer to the color array to fill
numLedsthe number of LEDs to fill
c1the starting color in the gradient
c2the first middle color for the gradient
c3the second middle color for the gradient
c4the end color for the gradient
directionCodethe direction to travel around the color wheel

Definition at line 223 of file fill.h.

225 {
226 uint16_t onethird = (numLeds / 3);
227 uint16_t twothirds = ((numLeds * 2) / 3);
228 uint16_t last = numLeds - 1;
229 fill_gradient(targetArray, 0, c1, onethird, c2, directionCode);
230 fill_gradient(targetArray, onethird, c2, twothirds, c3, directionCode);
231 fill_gradient(targetArray, twothirds, c3, last, c4, directionCode);
232}
void fill_gradient(T *targetArray, uint16_t startpos, CHSV startcolor, uint16_t endpos, CHSV endcolor, TGradientDirectionCode directionCode=SHORTEST_HUES)
Fill a range of LEDs with a smooth HSV gradient between two HSV colors.
Definition fill.h:77

References fill_gradient(), and SHORTEST_HUES.

+ Here is the call graph for this function:

◆ fill_gradient() [2/4]

template<typename T>
void fl::fill_gradient ( T * targetArray,
uint16_t numLeds,
const CHSV & c1,
const CHSV & c2,
const CHSV & c3,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Fill a range of LEDs with a smooth HSV gradient between three HSV colors.

See also
fill_gradient()
Parameters
targetArraya pointer to the color array to fill
numLedsthe number of LEDs to fill
c1the starting color in the gradient
c2the middle color for the gradient
c3the end color for the gradient
directionCodethe direction to travel around the color wheel

Definition at line 204 of file fill.h.

206 {
207 uint16_t half = (numLeds / 2);
208 uint16_t last = numLeds - 1;
209 fill_gradient(targetArray, 0, c1, half, c2, directionCode);
210 fill_gradient(targetArray, half, c2, last, c3, directionCode);
211}

References fill_gradient(), and SHORTEST_HUES.

+ Here is the call graph for this function:

◆ fill_gradient() [3/4]

template<typename T>
void fl::fill_gradient ( T * targetArray,
uint16_t numLeds,
const CHSV & c1,
const CHSV & c2,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Fill a range of LEDs with a smooth HSV gradient between two HSV colors.

See also
fill_gradient()
Parameters
targetArraya pointer to the color array to fill
numLedsthe number of LEDs to fill
c1the starting color in the gradient
c2the end color for the gradient
directionCodethe direction to travel around the color wheel

Definition at line 188 of file fill.h.

190 {
191 uint16_t last = numLeds - 1;
192 fill_gradient(targetArray, 0, c1, last, c2, directionCode);
193}

References fill_gradient(), and SHORTEST_HUES.

+ Here is the call graph for this function:

◆ fill_gradient() [4/4]

template<typename T>
void fl::fill_gradient ( T * targetArray,
uint16_t startpos,
CHSV startcolor,
uint16_t endpos,
CHSV endcolor,
TGradientDirectionCode directionCode = SHORTEST_HUES )

Fill a range of LEDs with a smooth HSV gradient between two HSV colors.

This function can write the gradient colors either:

  1. Into an array of CRGBs (e.g., an leds[] array, or a CRGB palette)
  2. Into an array of CHSVs (e.g. a CHSV palette).

In the case of writing into a CRGB array, the gradient is computed in HSV space, and then HSV values are converted to RGB as they're written into the CRGB array.

Parameters
targetArraya pointer to the color array to fill
startposthe starting position in the array
startcolorthe starting color for the gradient
endposthe ending position in the array
endcolorthe end color for the gradient
directionCodethe direction to travel around the color wheel

Definition at line 77 of file fill.h.

79 {
80 // if the points are in the wrong order, straighten them
81 if (endpos < startpos) {
82 uint16_t t = endpos;
83 CHSV tc = endcolor;
84 endcolor = startcolor;
85 endpos = startpos;
86 startpos = t;
87 startcolor = tc;
88 }
89
90 // If we're fading toward black (val=0) or white (sat=0),
91 // then set the endhue to the starthue.
92 // This lets us ramp smoothly to black or white, regardless
93 // of what 'hue' was set in the endcolor (since it doesn't matter)
94 if (endcolor.value == 0 || endcolor.saturation == 0) {
95 endcolor.hue = startcolor.hue;
96 }
97
98 // Similarly, if we're fading in from black (val=0) or white (sat=0)
99 // then set the starthue to the endhue.
100 // This lets us ramp smoothly up from black or white, regardless
101 // of what 'hue' was set in the startcolor (since it doesn't matter)
102 if (startcolor.value == 0 || startcolor.saturation == 0) {
103 startcolor.hue = endcolor.hue;
104 }
105
106 saccum87 huedistance87;
107 saccum87 satdistance87;
108 saccum87 valdistance87;
109
110 satdistance87 = (endcolor.sat - startcolor.sat) << 7;
111 valdistance87 = (endcolor.val - startcolor.val) << 7;
112
113 uint8_t huedelta8 = endcolor.hue - startcolor.hue;
114
115 if (directionCode == SHORTEST_HUES) {
116 directionCode = FORWARD_HUES;
117 if (huedelta8 > 127) {
118 directionCode = BACKWARD_HUES;
119 }
120 }
121
122 if (directionCode == LONGEST_HUES) {
123 directionCode = FORWARD_HUES;
124 if (huedelta8 < 128) {
125 directionCode = BACKWARD_HUES;
126 }
127 }
128
129 if (directionCode == FORWARD_HUES) {
130 huedistance87 = huedelta8 << 7;
131 } else /* directionCode == BACKWARD_HUES */
132 {
133 huedistance87 = (uint8_t)(256 - huedelta8) << 7;
134 huedistance87 = -huedistance87;
135 }
136
137 uint16_t pixeldistance = endpos - startpos;
138 int16_t divisor = pixeldistance ? pixeldistance : 1;
139
140#if FASTLED_USE_32_BIT_GRADIENT_FILL
141 // Use higher precision 32 bit math for new micros.
142 int32_t huedelta823 = (huedistance87 * 65536) / divisor;
143 int32_t satdelta823 = (satdistance87 * 65536) / divisor;
144 int32_t valdelta823 = (valdistance87 * 65536) / divisor;
145
146 huedelta823 *= 2;
147 satdelta823 *= 2;
148 valdelta823 *= 2;
149 uint32_t hue824 = static_cast<uint32_t>(startcolor.hue) << 24;
150 uint32_t sat824 = static_cast<uint32_t>(startcolor.sat) << 24;
151 uint32_t val824 = static_cast<uint32_t>(startcolor.val) << 24;
152 for (uint16_t i = startpos; i <= endpos; ++i) {
153 targetArray[i] = CHSV(hue824 >> 24, sat824 >> 24, val824 >> 24);
154 hue824 += huedelta823;
155 sat824 += satdelta823;
156 val824 += valdelta823;
157 }
158#else
159 // Use 8-bit math for older micros.
160 saccum87 huedelta87 = huedistance87 / divisor;
161 saccum87 satdelta87 = satdistance87 / divisor;
162 saccum87 valdelta87 = valdistance87 / divisor;
163
164 huedelta87 *= 2;
165 satdelta87 *= 2;
166 valdelta87 *= 2;
167
168 accum88 hue88 = startcolor.hue << 8;
169 accum88 sat88 = startcolor.sat << 8;
170 accum88 val88 = startcolor.val << 8;
171 for (uint16_t i = startpos; i <= endpos; ++i) {
172 targetArray[i] = CHSV(hue88 >> 8, sat88 >> 8, val88 >> 8);
173 hue88 += huedelta87;
174 sat88 += satdelta87;
175 val88 += valdelta87;
176 }
177#endif // defined(__AVR__)
178}
#define saccum87
ANSI: signed short _Accum.
Definition fill.h:9
uint16_t accum88
ANSI: unsigned short _Accum. 8 bits int, 8 bits fraction.
Definition types.h:58

References BACKWARD_HUES, FORWARD_HUES, LONGEST_HUES, saccum87, and SHORTEST_HUES.

Referenced by fill_gradient(), fill_gradient(), and fill_gradient().

+ Here is the caller graph for this function:

◆ fill_gradient_RGB() [1/4]

void fl::fill_gradient_RGB ( CRGB * leds,
uint16_t numLeds,
const CRGB & c1,
const CRGB & c2 )

Fill a range of LEDs with a smooth RGB gradient between two RGB colors.

See also
fill_gradient_RGB()
Parameters
ledsa pointer to the LED array to fill
numLedsthe number of LEDs to fill
c1the starting color in the gradient
c2the end color for the gradient

Definition at line 149 of file fill.cpp.

150 {
151 uint16_t last = numLeds - 1;
152 fill_gradient_RGB(leds, 0, c1, last, c2);
153}
void fill_gradient_RGB(CRGB *leds, uint16_t startpos, CRGB startcolor, uint16_t endpos, CRGB endcolor)
Fill a range of LEDs with a smooth RGB gradient between two RGB colors.
Definition fill.cpp:107

References fill_gradient_RGB(), and leds.

+ Here is the call graph for this function:

◆ fill_gradient_RGB() [2/4]

void fl::fill_gradient_RGB ( CRGB * leds,
uint16_t numLeds,
const CRGB & c1,
const CRGB & c2,
const CRGB & c3 )

Fill a range of LEDs with a smooth RGB gradient between three RGB colors.

See also
fill_gradient_RGB()
Parameters
ledsa pointer to the LED array to fill
numLedsthe number of LEDs to fill
c1the starting color in the gradient
c2the middle color for the gradient
c3the end color for the gradient

Definition at line 155 of file fill.cpp.

156 {
157 uint16_t half = (numLeds / 2);
158 uint16_t last = numLeds - 1;
159 fill_gradient_RGB(leds, 0, c1, half, c2);
160 fill_gradient_RGB(leds, half, c2, last, c3);
161}

References fill_gradient_RGB(), and leds.

+ Here is the call graph for this function:

◆ fill_gradient_RGB() [3/4]

void fl::fill_gradient_RGB ( CRGB * leds,
uint16_t numLeds,
const CRGB & c1,
const CRGB & c2,
const CRGB & c3,
const CRGB & c4 )

Fill a range of LEDs with a smooth RGB gradient between four RGB colors.

See also
fill_gradient_RGB()
Parameters
ledsa pointer to the LED array to fill
numLedsthe number of LEDs to fill
c1the starting color in 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 163 of file fill.cpp.

164 {
165 uint16_t onethird = (numLeds / 3);
166 uint16_t twothirds = ((numLeds * 2) / 3);
167 uint16_t last = numLeds - 1;
168 fill_gradient_RGB(leds, 0, c1, onethird, c2);
169 fill_gradient_RGB(leds, onethird, c2, twothirds, c3);
170 fill_gradient_RGB(leds, twothirds, c3, last, c4);
171}

References fill_gradient_RGB(), and leds.

+ Here is the call graph for this function:

◆ fill_gradient_RGB() [4/4]

void fl::fill_gradient_RGB ( CRGB * leds,
uint16_t startpos,
CRGB startcolor,
uint16_t endpos,
CRGB endcolor )

Fill a range of LEDs with a smooth RGB gradient between two RGB colors.

Unlike HSV, there is no "color wheel" in RGB space, and therefore there's only one "direction" for the gradient to go. This means there's no TGradientDirectionCode parameter for direction.

Parameters
ledsa pointer to the LED array to fill
startposthe starting position in the array
startcolorthe starting color for the gradient
endposthe ending position in the array
endcolorthe end color for the gradient

Definition at line 107 of file fill.cpp.

108 {
109 // if the points are in the wrong order, straighten them
110 if (endpos < startpos) {
111 uint16_t t = endpos;
112 CRGB tc = endcolor;
113 endcolor = startcolor;
114 endpos = startpos;
115 startpos = t;
116 startcolor = tc;
117 }
118
119 saccum87 rdistance87;
120 saccum87 gdistance87;
121 saccum87 bdistance87;
122
123 rdistance87 = (endcolor.r - startcolor.r) << 7;
124 gdistance87 = (endcolor.g - startcolor.g) << 7;
125 bdistance87 = (endcolor.b - startcolor.b) << 7;
126
127 uint16_t pixeldistance = endpos - startpos;
128 int16_t divisor = pixeldistance ? pixeldistance : 1;
129
130 saccum87 rdelta87 = rdistance87 / divisor;
131 saccum87 gdelta87 = gdistance87 / divisor;
132 saccum87 bdelta87 = bdistance87 / divisor;
133
134 rdelta87 *= 2;
135 gdelta87 *= 2;
136 bdelta87 *= 2;
137
138 accum88 r88 = startcolor.r << 8;
139 accum88 g88 = startcolor.g << 8;
140 accum88 b88 = startcolor.b << 8;
141 for (uint16_t i = startpos; i <= endpos; ++i) {
142 leds[i] = CRGB(r88 >> 8, g88 >> 8, b88 >> 8);
143 r88 += rdelta87;
144 g88 += gdelta87;
145 b88 += bdelta87;
146 }
147}

References leds, and saccum87.

Referenced by fill_gradient_RGB(), fill_gradient_RGB(), and fill_gradient_RGB().

+ Here is the caller graph for this function:

◆ fill_rainbow() [1/2]

void fl::fill_rainbow ( struct CHSV * targetArray,
int numToFill,
uint8_t initialhue,
uint8_t deltahue = 5 )

Fill a range of LEDs with a rainbow of colors.

The colors making up the rainbow are at full saturation and full value (brightness).

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
initialhuethe starting hue for the rainbow
deltahuehow many hue values to advance for each LED

Definition at line 41 of file fill.cpp.

42 {
43 CHSV hsv;
44 hsv.hue = initialhue;
45 hsv.val = 255;
46 hsv.sat = 240;
47 for (int i = 0; i < numToFill; ++i) {
48 targetArray[i] = hsv;
49 hsv.hue += deltahue;
50 }
51}

◆ fill_rainbow() [2/2]

void fl::fill_rainbow ( struct CRGB * targetArray,
int numToFill,
uint8_t initialhue,
uint8_t deltahue = 5 )

Fill a range of LEDs with a rainbow of colors.

The colors making up the rainbow are at full saturation and full value (brightness).

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
initialhuethe starting hue for the rainbow
deltahuehow many hue values to advance for each LED

Definition at line 29 of file fill.cpp.

30 {
31 CHSV hsv;
32 hsv.hue = initialhue;
33 hsv.val = 255;
34 hsv.sat = 240;
35 for (int i = 0; i < numToFill; ++i) {
36 targetArray[i] = hsv;
37 hsv.hue += deltahue;
38 }
39}

Referenced by fl::DemoReel100::rainbow().

+ Here is the caller graph for this function:

◆ fill_rainbow_circular() [1/2]

void fl::fill_rainbow_circular ( struct CHSV * targetArray,
int numToFill,
uint8_t initialhue,
bool reversed = false )

Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the strip and the beginning.

The colors making up the rainbow are at full saturation and full value (brightness).

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
initialhuethe starting hue for the rainbow
reversedwhether to progress through the rainbow hues backwards

Definition at line 80 of file fill.cpp.

81 {
82 if (numToFill == 0)
83 return; // avoiding div/0
84
85 CHSV hsv;
86 hsv.hue = initialhue;
87 hsv.val = 255;
88 hsv.sat = 240;
89
90 const uint16_t hueChange =
91 65535 / (uint16_t)numToFill; // hue change for each LED, * 256 for
92 // precision (256 * 256 - 1)
93 uint16_t hueOffset = 0; // offset for hue value, with precision (*256)
94
95 for (int i = 0; i < numToFill; ++i) {
96 targetArray[i] = hsv;
97 if (reversed)
98 hueOffset -= hueChange;
99 else
100 hueOffset += hueChange;
101 hsv.hue = initialhue +
102 (uint8_t)(hueOffset >>
103 8); // assign new hue with precise offset (as 8-bit)
104 }
105}

◆ fill_rainbow_circular() [2/2]

void fl::fill_rainbow_circular ( struct CRGB * targetArray,
int numToFill,
uint8_t initialhue,
bool reversed = false )

Fill a range of LEDs with a rainbow of colors, so that the hues are continuous between the end of the strip and the beginning.

The colors making up the rainbow are at full saturation and full value (brightness).

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
initialhuethe starting hue for the rainbow
reversedwhether to progress through the rainbow hues backwards

Definition at line 53 of file fill.cpp.

54 {
55 if (numToFill == 0)
56 return; // avoiding div/0
57
58 CHSV hsv;
59 hsv.hue = initialhue;
60 hsv.val = 255;
61 hsv.sat = 240;
62
63 const uint16_t hueChange =
64 65535 / (uint16_t)numToFill; // hue change for each LED, * 256 for
65 // precision (256 * 256 - 1)
66 uint16_t hueOffset = 0; // offset for hue value, with precision (*256)
67
68 for (int i = 0; i < numToFill; ++i) {
69 targetArray[i] = hsv;
70 if (reversed)
71 hueOffset -= hueChange;
72 else
73 hueOffset += hueChange;
74 hsv.hue = initialhue +
75 (uint8_t)(hueOffset >>
76 8); // assign new hue with precise offset (as 8-bit)
77 }
78}

◆ fill_solid() [1/2]

void fl::fill_solid ( struct CHSV * targetArray,
int numToFill,
const struct CHSV & color )

Fill a range of LEDs with a solid color.

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
colorthe color to fill with

Definition at line 16 of file fill.cpp.

17 {
18 for (int i = 0; i < numToFill; ++i) {
19 targetArray[i] = color;
20 }
21}

◆ fill_solid() [2/2]

void fl::fill_solid ( struct CRGB * targetArray,
int numToFill,
const struct CRGB & color )

Fill a range of LEDs with a solid color.

Parameters
targetArraya pointer to the LED array to fill
numToFillthe number of LEDs to fill in the array
colorthe color to fill with

Definition at line 9 of file fill.cpp.

10 {
11 for (int i = 0; i < numToFill; ++i) {
12 targetArray[i] = color;
13 }
14}

Referenced by fl::Pacifica::draw(), and fl::NoisePalette::SetupBlackAndWhiteStripedPalette().

+ Here is the caller graph for this function:

◆ five_bit_bitshift()

uint8_t fl::five_bit_bitshift ( uint16_t r16,
uint16_t g16,
uint16_t b16,
uint8_t brightness,
CRGB * out,
uint8_t * out_power_5bit )

Definition at line 72 of file five_bit_hd_gamma.cpp.

74 {
75 if (brightness == 0) {
76 *out = CRGB(0, 0, 0);
77 *out_power_5bit = 0;
78 return 0;
79 }
80 if (r16 == 0 && g16 == 0 && b16 == 0) {
81 *out = CRGB(0, 0, 0);
82 *out_power_5bit = (brightness <= 31) ? brightness : 31;
83 return brightness;
84 }
85
86 // Note: One day someone smarter than me will come along and invent a closed
87 // form solution for this. However, the numerical method works extremely
88 // well and has been optimized to avoid division performance penalties as
89 // much as possible.
90
91 // Step 1: Initialize brightness
92 static const uint8_t kStartBrightness = 0b00010000;
93 uint8_t v5 = kStartBrightness;
94 // Step 2: Boost brightness by swapping power with the driver brightness.
96
97 // Step 3: Boost brightness of the color channels by swapping power with the
98 // driver brightness.
99 uint16_t max_component = max3(r16, g16, b16);
100 // five_bit_color_bitshift(&r16, &g16, &b16, &v5);
101 uint8_t shifts = brightness_bitshifter16(&v5, &max_component, 4, 2);
102 if (shifts) {
103 r16 = r16 << shifts;
104 g16 = g16 << shifts;
105 b16 = b16 << shifts;
106 }
107
108 // Step 4: scale by final brightness factor.
109 if (brightness != 0xff) {
110 r16 = scale16by8(r16, brightness);
111 g16 = scale16by8(g16, brightness);
112 b16 = scale16by8(b16, brightness);
113 }
114
115 // brighten hardware brightness by turning on low order bits
116 if (v5 > 1) {
117 // since v5 is a power of two, subtracting one will invert the leading
118 // bit and invert all the bits below it. Example: 0b00010000 -1 =
119 // 0b00001111 So 0b00010000 | 0b00001111 = 0b00011111
120 v5 = v5 | (v5 - 1);
121 }
122 // Step 5: Convert back to 8-bit and output.
123 *out = CRGB(map16_to_8(r16), map16_to_8(g16), map16_to_8(b16));
124 *out_power_5bit = v5;
125 return brightness;
126}
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_ALWAYS_INLINE uint8_t map16_to_8(uint16_t x)
Definition intmap.h:31

References brightness, brightness_bitshifter16(), brightness_bitshifter8(), map16_to_8(), and scale16by8().

Referenced by __builtin_five_bit_hd_gamma_bitshift().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ five_bit_hd_gamma_bitshift()

void fl::five_bit_hd_gamma_bitshift ( CRGB colors,
CRGB colors_scale,
uint8_t global_brightness,
CRGB * out_colors,
uint8_t * out_power_5bit )

Definition at line 55 of file five_bit_hd_gamma.h.

59 {
61 colors, colors_scale, global_brightness, out_colors, out_power_5bit);
62}
void __builtin_five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)

References __builtin_five_bit_hd_gamma_bitshift(), and FASTLED_FORCE_INLINE.

Referenced by PixelController< RGB_ORDER, LANES, MASK >::loadAndScale_APA102_HD().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ five_bit_hd_gamma_function()

void fl::five_bit_hd_gamma_function ( CRGB color,
uint16_t * r16,
uint16_t * g16,
uint16_t * b16 )

Definition at line 27 of file five_bit_hd_gamma.cpp.

28 {
29 uint16_t _r16 = map8_to_16(color.r);
30 uint16_t _g16 = map8_to_16(color.g);
31 uint16_t _b16 = map8_to_16(color.b);
32 *r16 = scale16by8(_r16, color.r);
33 *g16 = scale16by8(_g16, color.g);
34 *b16 = scale16by8(_b16, color.b);
35}
LIB8STATIC_ALWAYS_INLINE uint16_t map8_to_16(uint8_t x)
Definition intmap.h:25

References map8_to_16(), and scale16by8().

Referenced by __builtin_five_bit_hd_gamma_bitshift().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fl_abs()

template<typename T>
T fl::fl_abs ( T value)
inline

Definition at line 5 of file math_macros.h.

5 {
6 return value < 0 ? -value : value;
7}

◆ floor()

template<typename T>
T fl::floor ( T value)
inline

Definition at line 11 of file math.h.

11 {
12 if (value >= 0) {
13 return static_cast<T>(static_cast<int>(value));
14 }
15 return static_cast<T>(::floor(static_cast<float>(value)));
16}
T floor(T value)
Definition math.h:11

References floor().

Referenced by floor(), and traverseGridSegmentFloat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward() [1/2]

template<typename T>
T && fl::forward ( typename remove_reference< T >::type && t)
constexprnoexcept

Definition at line 195 of file type_traits.h.

195 {
196 static_assert(!is_lvalue_reference<T>::value,
197 "Cannot forward an rvalue as an lvalue");
198 return static_cast<T &&>(t);
199}
static constexpr bool value

References fl::is_lvalue_reference< T >::value.

◆ forward() [2/2]

template<typename T>
T && fl::forward ( typename remove_reference< T >::type & t)
constexprnoexcept

Definition at line 189 of file type_traits.h.

189 {
190 return static_cast<T &&>(t);
191}

Referenced by fl::Variant< const CRGBPalette16 *, const CRGBPalette32 *, const CRGBPalette256 *, GradientFunction >::construct(), fl::Variant< const CRGBPalette16 *, const CRGBPalette32 *, const CRGBPalette256 *, GradientFunction >::emplace(), and fl::less< void >::operator()().

+ Here is the caller graph for this function:

◆ hash_pair()

static uint32_t fl::hash_pair ( uint32_t a,
uint32_t b,
uint32_t seed = 0 )
inlinestaticnoexcept

Definition at line 86 of file hash.h.

87 {
88 // mix in 'a', then mix in 'b'
89 uint32_t h = fast_hash32(seed ^ a);
90 return fast_hash32(h ^ b);
91}
static uint32_t fast_hash32(uint32_t x) noexcept
Definition hash.h:76

References fast_hash32().

Referenced by fl::FastHash< vec2< T > >::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HeatColor()

CRGB fl::HeatColor ( uint8_t temperature)

Definition at line 199 of file colorutils.cpp.

199 {
200 CRGB heatcolor;
201
202 // Scale 'heat' down from 0-255 to 0-191,
203 // which can then be easily divided into three
204 // equal 'thirds' of 64 units each.
205 uint8_t t192 = scale8_video(temperature, 191);
206
207 // calculate a value that ramps up from
208 // zero to 255 in each 'third' of the scale.
209 uint8_t heatramp = t192 & 0x3F; // 0..63
210 heatramp <<= 2; // scale up to 0..252
211
212 // now figure out which third of the spectrum we're in:
213 if (t192 & 0x80) {
214 // we're in the hottest third
215 heatcolor.r = 255; // full red
216 heatcolor.g = 255; // full green
217 heatcolor.b = heatramp; // ramp up blue
218
219 } else if (t192 & 0x40) {
220 // we're in the middle third
221 heatcolor.r = 255; // full red
222 heatcolor.g = heatramp; // ramp up green
223 heatcolor.b = 0; // no blue
224
225 } else {
226 // we're in the coolest third
227 heatcolor.r = heatramp; // ramp up red
228 heatcolor.g = 0; // no green
229 heatcolor.b = 0; // no blue
230 }
231
232 return heatcolor;
233}

References scale8_video().

+ Here is the call graph for this function:

◆ LargeBlockAllocate()

void * fl::LargeBlockAllocate ( size_t size,
bool zero )

Definition at line 41 of file allocator.cpp.

41 {
42 void *ptr = Alloc(size);
43 if (zero) {
44 memset(ptr, 0, size);
45 }
46 return ptr;
47}

Referenced by fl::Frame::Frame(), and fl::LargeBlockAllocator< T >::Alloc().

+ Here is the caller graph for this function:

◆ LargeBlockDeallocate()

void fl::LargeBlockDeallocate ( void * ptr)

Definition at line 49 of file allocator.cpp.

49{ Free(ptr); }

Referenced by fl::Frame::~Frame(), and fl::LargeBlockAllocator< T >::Free().

+ Here is the caller graph for this function:

◆ lsrX4()

uint8_t fl::lsrX4 ( uint8_t dividend)
inline

Helper function to divide a number by 16, aka four logical shift right (LSR)'s.

On avr-gcc, "u8 >> 4" generates a loop, which is big, and slow. merely forcing it to be four /=2's causes avr-gcc to emit a SWAP instruction followed by an AND 0x0F, which is faster, and smaller.

Definition at line 240 of file colorutils.cpp.

240 {
241#if defined(__AVR__)
242 dividend /= 2;
243 dividend /= 2;
244 dividend /= 2;
245 dividend /= 2;
246#else
247 dividend >>= 4;
248#endif
249 return dividend;
250}

Referenced by ColorFromPalette(), ColorFromPalette(), and ColorFromPalette().

+ Here is the caller graph for this function:

◆ make_sdcard_filesystem()

FsImplPtr fl::make_sdcard_filesystem ( int cs_pin)

Definition at line 188 of file file_system.cpp.

188 {
189 FASTLED_UNUSED(cs_pin);
190 FsImplPtr out = FsImplPtr::TakeOwnership(new NullFileSystem());
191 return out;
192}
#define FASTLED_UNUSED(x)
Definition unused.h:3

References FASTLED_UNUSED.

Referenced by fl::FileSystem::beginSd().

+ Here is the caller graph for this function:

◆ map_range()

template<typename T, typename U>
FASTLED_FORCE_INLINE U fl::map_range ( T value,
T in_min,
T in_max,
U out_min,
U out_max )

Definition at line 26 of file map_range.h.

27 {
28 // Not fully tested with all unsigned types, so watch out if you use this
29 // with uint16_t and you value < in_min.
30 using namespace map_range_detail;
31 if (equals(value, in_min)) {
32 return out_min;
33 }
34 if (equals(value, in_max)) {
35 return out_max;
36 }
37 return map_range_math<T, U>::map(value, in_min, in_max, out_min, out_max);
38}

References FASTLED_FORCE_INLINE.

Referenced by loop(), anonymous_namespace{xypaths.cpp}::make_path(), fl::map_range_detail::map_range_math< uint8_t, uint8_t >::map(), map_range_clamped(), fl::XYPathRenderer::rasterize(), and fl::HashMap< Key, T, Hash, KeyEqual >::setLoadFactor().

+ Here is the caller graph for this function:

◆ map_range_clamped()

template<typename T, typename U>
FASTLED_FORCE_INLINE U fl::map_range_clamped ( T value,
T in_min,
T in_max,
U out_min,
U out_max )

Definition at line 41 of file map_range.h.

42 {
43 // Not fully tested with all unsigned types, so watch out if you use this
44 // with uint16_t and you value < in_min.
45 using namespace map_range_detail;
46 value = clamp(value, in_min, in_max);
47 return map_range<T, U>(value, in_min, in_max, out_min, out_max);
48}
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
FASTLED_FORCE_INLINE U map_range(T value, T in_min, T in_max, U out_min, U out_max)
Definition map_range.h:26

References clamp(), FASTLED_FORCE_INLINE, and map_range().

+ Here is the call graph for this function:

◆ move()

template<typename T>
remove_reference< T >::type && fl::move ( T && t)
constexprnoexcept

Definition at line 174 of file type_traits.h.

174 {
175 return static_cast<typename remove_reference<T>::type &&>(t);
176}

Referenced by fl::BitsetInlined< N >::BitsetInlined(), fl::Variant< const CRGBPalette16 *, const CRGBPalette32 *, const CRGBPalette256 *, GradientFunction >::Variant(), fl::Variant< const CRGBPalette16 *, const CRGBPalette32 *, const CRGBPalette256 *, GradientFunction >::move_fn(), fl::BitsetInlined< N >::operator=(), and fl::Variant< const CRGBPalette16 *, const CRGBPalette32 *, const CRGBPalette256 *, GradientFunction >::operator=().

+ Here is the caller graph for this function:

◆ MurmurHash3_x86_32()

static uint32_t fl::MurmurHash3_x86_32 ( const void * key,
size_t len,
uint32_t seed = 0 )
inlinestatic

Definition at line 18 of file hash.h.

19 {
20#pragma GCC diagnostic push
21#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
22
23 const uint8_t *data = static_cast<const uint8_t *>(key);
24 const int nblocks = int(len / 4);
25
26 uint32_t h1 = seed;
27 const uint32_t c1 = 0xcc9e2d51;
28 const uint32_t c2 = 0x1b873593;
29
30 // body
31 const uint32_t *blocks = reinterpret_cast<const uint32_t *>(data);
32 for (int i = 0; i < nblocks; ++i) {
33 uint32_t k1 = blocks[i];
34 k1 *= c1;
35 k1 = (k1 << 15) | (k1 >> 17);
36 k1 *= c2;
37
38 h1 ^= k1;
39 h1 = (h1 << 13) | (h1 >> 19);
40 h1 = h1 * 5 + 0xe6546b64;
41 }
42
43 // tail
44 const uint8_t *tail = data + (nblocks * 4);
45 uint32_t k1 = 0;
46 switch (len & 3) {
47 case 3:
48 k1 ^= uint32_t(tail[2]) << 16;
49 case 2:
50 k1 ^= uint32_t(tail[1]) << 8;
51 case 1:
52 k1 ^= uint32_t(tail[0]);
53 k1 *= c1;
54 k1 = (k1 << 15) | (k1 >> 17);
55 k1 *= c2;
56 h1 ^= k1;
57 }
58
59 // finalization
60 h1 ^= uint32_t(len);
61 // fmix32
62 h1 ^= h1 >> 16;
63 h1 *= 0x85ebca6b;
64 h1 ^= h1 >> 13;
65 h1 *= 0xc2b2ae35;
66 h1 ^= h1 >> 16;
67
68 return h1;
69
70#pragma GCC diagnostic pop
71}

Referenced by fl::FastHash< vec2< T > >::operator()(), fl::Hash< FFT_Args >::operator()(), fl::Hash< Key >::operator()(), and fl::Hash< vec2< T > >::operator()().

+ Here is the caller graph for this function:

◆ napplyGamma_video() [1/4]

CRGB & fl::napplyGamma_video ( CRGB & rgb,
float gamma )

Definition at line 1085 of file colorutils.cpp.

1085 {
1086 rgb = applyGamma_video(rgb, gamma);
1087 return rgb;
1088}

References applyGamma_video().

+ Here is the call graph for this function:

◆ napplyGamma_video() [2/4]

CRGB & fl::napplyGamma_video ( CRGB & rgb,
float gammaR,
float gammaG,
float gammaB )

Definition at line 1090 of file colorutils.cpp.

1090 {
1091 rgb = applyGamma_video(rgb, gammaR, gammaG, gammaB);
1092 return rgb;
1093}

References applyGamma_video().

+ Here is the call graph for this function:

◆ napplyGamma_video() [3/4]

void fl::napplyGamma_video ( CRGB * rgbarray,
uint16_t count,
float gamma )

Definition at line 1095 of file colorutils.cpp.

1095 {
1096 for (uint16_t i = 0; i < count; ++i) {
1097 rgbarray[i] = applyGamma_video(rgbarray[i], gamma);
1098 }
1099}

References applyGamma_video().

+ Here is the call graph for this function:

◆ napplyGamma_video() [4/4]

void fl::napplyGamma_video ( CRGB * rgbarray,
uint16_t count,
float gammaR,
float gammaG,
float gammaB )

Definition at line 1101 of file colorutils.cpp.

1102 {
1103 for (uint16_t i = 0; i < count; ++i) {
1104 rgbarray[i] = applyGamma_video(rgbarray[i], gammaR, gammaG, gammaB);
1105 }
1106}

References applyGamma_video().

+ Here is the call graph for this function:

◆ nblend() [1/4]

CHSV & fl::nblend ( CHSV & existing,
const CHSV & overlay,
fract8 amountOfOverlay,
TGradientDirectionCode directionCode )

Definition at line 74 of file colorutils.cpp.

75 {
76 if (amountOfOverlay == 0) {
77 return existing;
78 }
79
80 if (amountOfOverlay == 255) {
81 existing = overlay;
82 return existing;
83 }
84
85 fract8 amountOfKeep = 255 - amountOfOverlay;
86
87 uint8_t huedelta8 = overlay.hue - existing.hue;
88
89 if (directionCode == SHORTEST_HUES) {
90 directionCode = FORWARD_HUES;
91 if (huedelta8 > 127) {
92 directionCode = BACKWARD_HUES;
93 }
94 }
95
96 if (directionCode == LONGEST_HUES) {
97 directionCode = FORWARD_HUES;
98 if (huedelta8 < 128) {
99 directionCode = BACKWARD_HUES;
100 }
101 }
102
103 if (directionCode == FORWARD_HUES) {
104 existing.hue = existing.hue + scale8(huedelta8, amountOfOverlay);
105 } else /* directionCode == BACKWARD_HUES */
106 {
107 huedelta8 = -huedelta8;
108 existing.hue = existing.hue - scale8(huedelta8, amountOfOverlay);
109 }
110
111 existing.sat = scale8_LEAVING_R1_DIRTY(existing.sat, amountOfKeep) +
112 scale8_LEAVING_R1_DIRTY(overlay.sat, amountOfOverlay);
113 existing.val = scale8_LEAVING_R1_DIRTY(existing.val, amountOfKeep) +
114 scale8_LEAVING_R1_DIRTY(overlay.val, amountOfOverlay);
115
116 cleanup_R1();
117
118 return existing;
119}
uint8_t fract8
ANSI: unsigned short _Fract.
Definition types.h:36

References BACKWARD_HUES, cleanup_R1(), FORWARD_HUES, LONGEST_HUES, scale8(), scale8_LEAVING_R1_DIRTY(), and SHORTEST_HUES.

+ Here is the call graph for this function:

◆ nblend() [2/4]

void fl::nblend ( CHSV * existing,
const CHSV * overlay,
uint16_t count,
fract8 amountOfOverlay,
TGradientDirectionCode directionCode )

Definition at line 121 of file colorutils.cpp.

122 {
123 if (existing == overlay)
124 return;
125 for (uint16_t i = count; i; --i) {
126 nblend(*existing, *overlay, amountOfOverlay, directionCode);
127 ++existing;
128 ++overlay;
129 }
130}

References nblend().

+ Here is the call graph for this function:

◆ nblend() [3/4]

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

Definition at line 19 of file colorutils.cpp.

19 {
20 if (amountOfOverlay == 0) {
21 return existing;
22 }
23
24 if (amountOfOverlay == 255) {
25 existing = overlay;
26 return existing;
27 }
28
29#if 0
30 // Old blend method which unfortunately had some rounding errors
31 fract8 amountOfKeep = 255 - amountOfOverlay;
32
33 existing.red = scale8_LEAVING_R1_DIRTY( existing.red, amountOfKeep)
34 + scale8_LEAVING_R1_DIRTY( overlay.red, amountOfOverlay);
35 existing.green = scale8_LEAVING_R1_DIRTY( existing.green, amountOfKeep)
36 + scale8_LEAVING_R1_DIRTY( overlay.green, amountOfOverlay);
37 existing.blue = scale8_LEAVING_R1_DIRTY( existing.blue, amountOfKeep)
38 + scale8_LEAVING_R1_DIRTY( overlay.blue, amountOfOverlay);
39
40 cleanup_R1();
41#else
42 // Corrected blend method, with no loss-of-precision rounding errors
43 existing.red = blend8(existing.red, overlay.red, amountOfOverlay);
44 existing.green = blend8(existing.green, overlay.green, amountOfOverlay);
45 existing.blue = blend8(existing.blue, overlay.blue, amountOfOverlay);
46#endif
47
48 return existing;
49}
LIB8STATIC uint8_t blend8(uint8_t a, uint8_t b, uint8_t amountOfB)
Blend a variable proportion (0-255) of one byte to another.
Definition math8.h:667

References blend8(), cleanup_R1(), and scale8_LEAVING_R1_DIRTY().

Referenced by blend(), blend(), fl::Pride2015::draw(), nblend(), and nblend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nblend() [4/4]

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

Definition at line 51 of file colorutils.cpp.

52 {
53 for (uint16_t i = count; i; --i) {
54 nblend(*existing, *overlay, amountOfOverlay);
55 ++existing;
56 ++overlay;
57 }
58}

References nblend().

+ Here is the call graph for this function:

◆ nblendPaletteTowardPalette()

void fl::nblendPaletteTowardPalette ( CRGBPalette16 & current,
CRGBPalette16 & target,
uint8_t maxChanges )

Definition at line 1017 of file colorutils.cpp.

1018 {
1019 uint8_t *p1;
1020 uint8_t *p2;
1021 uint8_t changes = 0;
1022
1023 p1 = (uint8_t *)current.entries;
1024 p2 = (uint8_t *)target.entries;
1025
1026 const uint8_t totalChannels = sizeof(CRGBPalette16);
1027 for (uint8_t i = 0; i < totalChannels; ++i) {
1028 // if the values are equal, no changes are needed
1029 if (p1[i] == p2[i]) {
1030 continue;
1031 }
1032
1033 // if the current value is less than the target, increase it by one
1034 if (p1[i] < p2[i]) {
1035 ++p1[i];
1036 ++changes;
1037 }
1038
1039 // if the current value is greater than the target,
1040 // increase it by one (or two if it's still greater).
1041 if (p1[i] > p2[i]) {
1042 --p1[i];
1043 ++changes;
1044 if (p1[i] > p2[i]) {
1045 --p1[i];
1046 }
1047 }
1048
1049 // if we've hit the maximum number of changes, exit
1050 if (changes >= maxChanges) {
1051 break;
1052 }
1053 }
1054}

Referenced by fl::TwinkleFox::draw().

+ Here is the caller graph for this function:

◆ NewPtr()

template<typename T, typename... Args>
Ptr< T > fl::NewPtr ( Args... args)

Definition at line 451 of file ptr.h.

451 {
452 return Ptr<T>::New(args...);
453}
corkscrew_args args
static Ptr< T > New()
Definition ptr.h:73

References args, and fl::PtrTraits< T >::New().

Referenced by fl::function< R(Args...)>::function(), fl::function< R(Args...)>::function(), fl::function< R(Args...)>::function(), fl::LinePath::LinePath(), fl::RosePath::RosePath(), fl::FFT::get_or_create(), anonymous_namespace{xypaths.cpp}::make_path(), fl::XYPath::NewCustomPath(), fl::XYPath::NewLinePath(), and NewWaveSimulation2D().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NewPtrNoTracking() [1/2]

template<typename T, typename... Args>
Ptr< T > fl::NewPtrNoTracking ( Args... args)

References args.

◆ NewPtrNoTracking() [2/2]

template<typename T>
Ptr< T > fl::NewPtrNoTracking ( T & obj)

Definition at line 455 of file ptr.h.

455 {
456 return Ptr<T>::NoTracking(obj);
457}
static Ptr NoTracking(T &referent)
Definition ptr.h:132

References fl::Ptr< T >::NoTracking().

+ Here is the call graph for this function:

◆ nscale8()

void fl::nscale8 ( CRGB * leds,
uint16_t num_leds,
uint8_t scale )

Definition at line 169 of file colorutils.cpp.

169 {
170 for (uint16_t i = 0; i < num_leds; ++i) {
171 leds[i].nscale8(scale);
172 }
173}
UISlider scale("Scale", 1.0f, 0.0f, 1.0f, 0.01f)

References leds, and scale.

Referenced by fade_raw(), and fadeToBlackBy().

+ Here is the caller graph for this function:

◆ nscale8_video()

void fl::nscale8_video ( CRGB * leds,
uint16_t num_leds,
uint8_t scale )

Definition at line 147 of file colorutils.cpp.

147 {
148 for (uint16_t i = 0; i < num_leds; ++i) {
149 leds[i].nscale8_video(scale);
150 }
151}

References leds, and scale.

Referenced by fade_video(), and fadeLightBy().

+ Here is the caller graph for this function:

◆ operator!=()

template<typename T, size_t N>
bool fl::operator!= ( const array< T, N > & lhs,
const array< T, N > & rhs )

Definition at line 135 of file array.h.

135 {
136 return !(lhs == rhs);
137}

◆ operator==()

template<typename T, size_t N>
bool fl::operator== ( const array< T, N > & lhs,
const array< T, N > & rhs )

Definition at line 125 of file array.h.

125 {
126 // return std::equal(lhs.begin(), lhs.end(), rhs.begin());
127 for (size_t i = 0; i < N; ++i) {
128 if (lhs[i] != rhs[i]) {
129 return false;
130 }
131 }
132}

◆ parseJson()

bool fl::parseJson ( const char * json,
fl::JsonDocument * doc,
Str * _error )

Definition at line 6 of file json.cpp.

6 {
7#if !FASTLED_ENABLE_JSON
8 if (_error) {
9 *_error = "JSON not enabled";
10 }
11 return false;
12#else
13 FLArduinoJson::DeserializationError error = deserializeJson(*doc, json);
14 if (error) {
15 if (_error) {
16 *_error = error.c_str();
17 }
18 return false;
19 }
20 return true;
21#endif
22}
const char * c_str() const
Definition str.h:272

References fl::StrN< SIZE >::c_str().

Referenced by fl::ScreenMap::ParseJson(), and fl::FileSystem::readJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pop_heap() [1/2]

template<typename Iterator>
void fl::pop_heap ( Iterator first,
Iterator last )

Definition at line 61 of file priority_queue.h.

61 {
62 pop_heap(first, last, [](const auto &a, const auto &b) { return a < b; });
63}
void pop_heap(Iterator first, Iterator last, Compare comp)

References pop_heap().

+ Here is the call graph for this function:

◆ pop_heap() [2/2]

template<typename Iterator, typename Compare>
void fl::pop_heap ( Iterator first,
Iterator last,
Compare comp )

Definition at line 52 of file priority_queue.h.

52 {
53 --last;
54 auto tmp = *first;
55 *first = *last;
56 *last = tmp;
57
58 sift_down(first, last, first, comp);
59}
void sift_down(Iterator first, Iterator last, Iterator start, Compare comp)

References sift_down().

Referenced by fl::PriorityQueue< T, Compare, VectorT >::pop(), and pop_heap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_heap() [1/2]

template<typename Iterator>
void fl::push_heap ( Iterator first,
Iterator last )

Definition at line 47 of file priority_queue.h.

47 {
48 push_heap(first, last, [](const auto &a, const auto &b) { return a < b; });
49}
void push_heap(Iterator first, Iterator last, Compare comp)

References push_heap().

+ Here is the call graph for this function:

◆ push_heap() [2/2]

template<typename Iterator, typename Compare>
void fl::push_heap ( Iterator first,
Iterator last,
Compare comp )

Definition at line 33 of file priority_queue.h.

33 {
34 auto pos = last - 1;
35 auto parent = first + ((pos - first) - 1) / 2;
36
37 while (pos > first && comp(*parent, *pos)) {
38 auto tmp = *parent;
39 *parent = *pos;
40 *pos = tmp;
41
42 pos = parent;
43 parent = first + ((pos - first) - 1) / 2;
44 }
45}
uint8_t pos
Definition Blur.ino:11

References pos.

Referenced by fl::PriorityQueue< T, Compare, VectorT >::push(), and push_heap().

+ Here is the caller graph for this function:

◆ SetLargeBlockAllocator()

void fl::SetLargeBlockAllocator ( void *(* alloc )(size_t),
void(* free )(void *) )

Definition at line 36 of file allocator.cpp.

36 {
37 Alloc = alloc;
38 Free = free;
39}

◆ sift_down()

template<typename Iterator, typename Compare>
void fl::sift_down ( Iterator first,
Iterator last,
Iterator start,
Compare comp )

Definition at line 10 of file priority_queue.h.

10 {
11 auto root = start;
12 auto child = first + 2 * (root - first) + 1;
13
14 while (child < last) {
15 if (child + 1 < last && comp(*child, *(child + 1))) {
16 ++child;
17 }
18
19 if (comp(*root, *child)) {
20 auto tmp = *root;
21 *root = *child;
22 *child = tmp;
23
24 root = child;
25 child = first + 2 * (root - first) + 1;
26 } else {
27 break;
28 }
29 }
30}

Referenced by pop_heap().

+ Here is the caller graph for this function:

◆ sin16lut()

static FASTLED_FORCE_INLINE int16_t fl::sin16lut ( uint16_t angle)
static

Definition at line 53 of file sin32.h.

53 {
54 uint8_t angle256 = angle / 256;
55 int32_t subAngle = angle % 256;
56 return (sinArray[angle256] * (256 - subAngle) +
57 sinArray[angle256 + 1] * subAngle) /
58 256;
59}
const int16_t * sinArray
Definition sin32.cpp:45

References FASTLED_FORCE_INLINE, and sinArray.

◆ sin32()

static FASTLED_FORCE_INLINE int32_t fl::sin32 ( uint32_t angle)
static

Definition at line 35 of file sin32.h.

35 {
36 uint8_t angle256 = angle / 65536;
37 int32_t subAngle = angle % 65536;
38 return sinArray[angle256] * (65536 - subAngle) +
39 sinArray[angle256 + 1] * subAngle;
40}

References FASTLED_FORCE_INLINE, and sinArray.

◆ swap() [1/2]

template<typename T, size_t N>
void fl::swap ( array< T, N > & lhs,
array< T, N > & rhs )
noexcept

Definition at line 140 of file array.h.

141 {
142 lhs.swap(rhs);
143}
void swap(array &other)
Definition array.h:109

Referenced by fl::FixedVector< PairKV, N >::FixedVector(), fl::InlinedVector< T, INLINED_SIZE >::InlinedVector(), fl::array< T, N >::swap(), fl::FixedVector< PairKV, N >::swap(), fl::HashMap< Key, T, Hash, KeyEqual, INLINED_COUNT >::Entry::swap(), fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::swap(), fl::InlinedVector< T, INLINED_SIZE >::swap(), and fl::Str::swap().

+ Here is the caller graph for this function:

◆ swap() [2/2]

template<typename T>
void fl::swap ( T & a,
T & b )

Definition at line 428 of file type_traits.h.

428 {
429 // if T is a POD, use use a simple data copy swap.
430 // if T is not a POD, use the T::Swap method.
432}

◆ swap_by_copy()

template<typename T>
void fl::swap_by_copy ( T & a,
T & b )

Definition at line 434 of file type_traits.h.

434 {
435 // if T is a POD, use use a simple data copy swap.
436 // if T is not a POD, use the T::Swap method.
437 T tmp = a;
438 a = b;
439 b = tmp;
440}

◆ time_alpha16()

uint16_t fl::time_alpha16 ( uint32_t now,
uint32_t start,
uint32_t end )

Definition at line 24 of file time_alpha.cpp.

24 {
25 if (now < start) {
26 return 0;
27 }
28 if (now > end) {
29 return 65535;
30 }
31 uint32_t elapsed = now - start;
32 uint32_t total = end - start;
33 uint32_t out = (elapsed * 65535) / total;
34 if (out > 65535) {
35 out = 65535;
36 }
37 return static_cast<uint16_t>(out);
38}

◆ time_alpha8()

uint8_t fl::time_alpha8 ( uint32_t now,
uint32_t start,
uint32_t end )

Definition at line 8 of file time_alpha.cpp.

8 {
9 if (now < start) {
10 return 0;
11 }
12 if (now > end) {
13 return 255;
14 }
15 uint32_t elapsed = now - start;
16 uint32_t total = end - start;
17 uint32_t out = (elapsed * 255) / total;
18 if (out > 255) {
19 out = 255;
20 }
21 return static_cast<uint8_t>(out);
22}

Referenced by fl::TimeClampedTransition::update8(), and fl::TimeRamp::update8().

+ Here is the caller graph for this function:

◆ time_alphaf()

float fl::time_alphaf ( uint32_t now,
uint32_t start,
uint32_t end )
inline

Definition at line 17 of file time_alpha.h.

17 {
18 if (now < start) {
19 return 0.0f;
20 }
21 uint32_t elapsed = now - start;
22 uint32_t total = end - start;
23 float out = static_cast<float>(elapsed) / static_cast<float>(total);
24 return out;
25}

Referenced by fl::TimeClampedTransition::updatef().

+ Here is the caller graph for this function:

◆ toJson()

void fl::toJson ( const fl::JsonDocument & doc,
Str * jsonBuffer )

Definition at line 24 of file json.cpp.

24 {
25#if !FASTLED_ENABLE_JSON
26 return;
27#else
28 serializeJson(doc, *jsonBuffer);
29#endif
30}

Referenced by fl::ScreenMap::toJsonStr().

+ Here is the caller graph for this function:

◆ traverseGridSegment()

template<typename GridVisitor>
void fl::traverseGridSegment ( const vec2f & start,
const vec2f & end,
GridVisitor & visitor )
inline

Traverse a grid segment by selecting the cells that are crossed.

This version will select the fastest integer implementation based on the length of the segment. Most of the time it will call traverseGridSegment16() since segment spans are typically < 256 pixels.

Template Parameters
GridVisitor
Parameters
startstart point
endend point
visitorcalled for each cell visited.

Fully tested.

Definition at line 275 of file traverse_grid.h.

276 {
277 float dx = ABS(end.x - start.x);
278 float dy = ABS(end.y - start.y);
279 float maxRange = MAX(dx, dy);
280
281 // if (maxRange < 256.0f) {
282 // // Use Q8.8 (16-bit signed) if within ±127
283 // traverseGridSegment16(start, end, visitor);
284 // }
285 // else if (maxRange < 16777216.0f) {
286 // // Use Q24.8 (32-bit signed) if within ±8 million
287 // traverseGridSegment32(start, end, visitor);
288 // }
289 // else {
290 // // Fall back to floating-point
291 // traverseGridSegment(start, end, visitor);
292 // }
293
294 if (maxRange < 256.0f) {
295 // Use Q8.8 (16-bit signed) if within ±127
296 traverseGridSegment16(start, end, visitor);
297 } else {
298 // Use Q24.8 (32-bit signed) if within ±8 million
299 traverseGridSegment32(start, end, visitor);
300 }
301}
#define ABS(x)
Definition math_macros.h:19
void traverseGridSegment16(const vec2f &start, const vec2f &end, GridVisitor &visitor)
Traverse a grid segment using fixed-point 8.8 arithmetic.
void traverseGridSegment32(const vec2f &start, const vec2f &end, GridVisitor &visitor)

References ABS, MAX, traverseGridSegment16(), traverseGridSegment32(), fl::vec2< T >::x, and fl::vec2< T >::y.

+ Here is the call graph for this function:

◆ traverseGridSegment16()

template<typename GridVisitor>
void fl::traverseGridSegment16 ( const vec2f & start,
const vec2f & end,
GridVisitor & visitor )
inline

Traverse a grid segment using fixed-point 8.8 arithmetic.

Template Parameters
GridVisitor
Parameters
startstart point
endend point
visitorcalled for each cell visited.

UNTESTED!!!!

Definition at line 122 of file traverse_grid.h.

123 {
124 const int16_t FP_SHIFT = 8;
125 const int16_t FP_ONE = 1 << FP_SHIFT;
126 // const int16_t FP_MASK = FP_ONE - 1;
127
128 // Convert to fixed-point (Q8.8), signed
129 int16_t startX_fp = static_cast<int16_t>(start.x * FP_ONE);
130 int16_t startY_fp = static_cast<int16_t>(start.y * FP_ONE);
131 int16_t endX_fp = static_cast<int16_t>(end.x * FP_ONE);
132 int16_t endY_fp = static_cast<int16_t>(end.y * FP_ONE);
133
134 int16_t x0 = startX_fp >> FP_SHIFT;
135 int16_t y0 = startY_fp >> FP_SHIFT;
136 int16_t x1 = endX_fp >> FP_SHIFT;
137 int16_t y1 = endY_fp >> FP_SHIFT;
138
139 int16_t stepX = (x1 > x0) ? 1 : (x1 < x0) ? -1 : 0;
140 int16_t stepY = (y1 > y0) ? 1 : (y1 < y0) ? -1 : 0;
141
142 int16_t deltaX_fp = endX_fp - startX_fp;
143 int16_t deltaY_fp = endY_fp - startY_fp;
144
145 uint16_t absDeltaX_fp =
146 (deltaX_fp != 0) ? static_cast<uint16_t>(
147 ABS((int32_t(FP_ONE) << FP_SHIFT) / deltaX_fp))
148 : UINT16_MAX;
149 uint16_t absDeltaY_fp =
150 (deltaY_fp != 0) ? static_cast<uint16_t>(
151 ABS((int32_t(FP_ONE) << FP_SHIFT) / deltaY_fp))
152 : UINT16_MAX;
153
154 int16_t nextX_fp = (stepX > 0) ? ((x0 + 1) << FP_SHIFT) : (x0 << FP_SHIFT);
155 int16_t nextY_fp = (stepY > 0) ? ((y0 + 1) << FP_SHIFT) : (y0 << FP_SHIFT);
156
157 uint16_t tMaxX_fp =
158 (deltaX_fp != 0)
159 ? static_cast<uint16_t>(
160 ABS(int32_t(nextX_fp - startX_fp)) * absDeltaX_fp >> FP_SHIFT)
161 : UINT16_MAX;
162 uint16_t tMaxY_fp =
163 (deltaY_fp != 0)
164 ? static_cast<uint16_t>(
165 ABS(int32_t(nextY_fp - startY_fp)) * absDeltaY_fp >> FP_SHIFT)
166 : UINT16_MAX;
167
168 const uint16_t maxT_fp = FP_ONE;
169
170 int16_t currentX = x0;
171 int16_t currentY = y0;
172
173 while (true) {
174 visitor.visit(currentX, currentY);
175
176 uint16_t t_fp = (tMaxX_fp < tMaxY_fp) ? tMaxX_fp : tMaxY_fp;
177 if (t_fp > maxT_fp)
178 break;
179
180 if (tMaxX_fp < tMaxY_fp) {
181 tMaxX_fp += absDeltaX_fp;
182 currentX += stepX;
183 } else {
184 tMaxY_fp += absDeltaY_fp;
185 currentY += stepY;
186 }
187 }
188
189 // Ensure the end cell (x1, y1) is visited at least once
190 if (currentX != x1 || currentY != y1) {
191 visitor.visit(x1, y1);
192 }
193}

References ABS, fl::vec2< T >::x, and fl::vec2< T >::y.

Referenced by traverseGridSegment().

+ Here is the caller graph for this function:

◆ traverseGridSegment32()

template<typename GridVisitor>
void fl::traverseGridSegment32 ( const vec2f & start,
const vec2f & end,
GridVisitor & visitor )
inline
Template Parameters
GridVisitor
Parameters
startstart point
endend point
visitorcalled for each cell visited.

UNTESTED!!!!

Definition at line 202 of file traverse_grid.h.

203 {
204 const int32_t FP_SHIFT = 8;
205 const int32_t FP_ONE = 1 << FP_SHIFT;
206 // const int32_t FP_MASK = FP_ONE - 1;
207
208 // Convert to fixed-point (Q24.8) signed
209 int32_t startX_fp = static_cast<int32_t>(start.x * FP_ONE);
210 int32_t startY_fp = static_cast<int32_t>(start.y * FP_ONE);
211 int32_t endX_fp = static_cast<int32_t>(end.x * FP_ONE);
212 int32_t endY_fp = static_cast<int32_t>(end.y * FP_ONE);
213
214 int32_t x0 = startX_fp >> FP_SHIFT;
215 int32_t y0 = startY_fp >> FP_SHIFT;
216 int32_t x1 = endX_fp >> FP_SHIFT;
217 int32_t y1 = endY_fp >> FP_SHIFT;
218
219 int32_t stepX = (x1 > x0) ? 1 : (x1 < x0) ? -1 : 0;
220 int32_t stepY = (y1 > y0) ? 1 : (y1 < y0) ? -1 : 0;
221
222 int32_t deltaX_fp = endX_fp - startX_fp;
223 int32_t deltaY_fp = endY_fp - startY_fp;
224
225 uint32_t absDeltaX_fp =
226 (deltaX_fp != 0) ? static_cast<uint32_t>(
227 ABS((int64_t(FP_ONE) << FP_SHIFT) / deltaX_fp))
228 : UINT32_MAX;
229 uint32_t absDeltaY_fp =
230 (deltaY_fp != 0) ? static_cast<uint32_t>(
231 ABS((int64_t(FP_ONE) << FP_SHIFT) / deltaY_fp))
232 : UINT32_MAX;
233
234 int32_t nextX_fp = (stepX > 0) ? ((x0 + 1) << FP_SHIFT) : (x0 << FP_SHIFT);
235 int32_t nextY_fp = (stepY > 0) ? ((y0 + 1) << FP_SHIFT) : (y0 << FP_SHIFT);
236
237 uint32_t tMaxX_fp =
238 (deltaX_fp != 0)
239 ? static_cast<uint32_t>(
240 ABS(int64_t(nextX_fp - startX_fp)) * absDeltaX_fp >> FP_SHIFT)
241 : UINT32_MAX;
242 uint32_t tMaxY_fp =
243 (deltaY_fp != 0)
244 ? static_cast<uint32_t>(
245 ABS(int64_t(nextY_fp - startY_fp)) * absDeltaY_fp >> FP_SHIFT)
246 : UINT32_MAX;
247
248 const uint32_t maxT_fp = FP_ONE;
249
250 int32_t currentX = x0;
251 int32_t currentY = y0;
252
253 while (true) {
254 visitor.visit(currentX, currentY);
255
256 uint32_t t_fp = (tMaxX_fp < tMaxY_fp) ? tMaxX_fp : tMaxY_fp;
257 if (t_fp > maxT_fp)
258 break;
259
260 if (tMaxX_fp < tMaxY_fp) {
261 tMaxX_fp += absDeltaX_fp;
262 currentX += stepX;
263 } else {
264 tMaxY_fp += absDeltaY_fp;
265 currentY += stepY;
266 }
267 }
268
269 if (currentX != x1 || currentY != y1) {
270 visitor.visit(x1, y1);
271 }
272}

References ABS, fl::vec2< T >::x, and fl::vec2< T >::y.

Referenced by traverseGridSegment().

+ Here is the caller graph for this function:

◆ traverseGridSegmentFloat()

template<typename GridVisitor>
void fl::traverseGridSegmentFloat ( const vec2f & start,
const vec2f & end,
GridVisitor & visitor )
inline

Traverse a grid segment using floating point arithmetic.

Traverse a grid segment using fixed-point 8.8 arithmetic.

Useful for testing.

Template Parameters
GridVisitor
Parameters
startstart point
endend point
visitorcalled for each cell visited.

Fully tested.

Template Parameters
GridVisitor
Parameters
startstart point
endend point
visitorcalled for each cell visited.

Fully tested.

Definition at line 67 of file traverse_grid.h.

68 {
69 int x0 = static_cast<int>(fl::floor(start.x));
70 int y0 = static_cast<int>(fl::floor(start.y));
71 int x1 = static_cast<int>(fl::floor(end.x));
72 int y1 = static_cast<int>(fl::floor(end.y));
73
74 int stepX = (x1 > x0) ? 1 : (x1 < x0) ? -1 : 0;
75 int stepY = (y1 > y0) ? 1 : (y1 < y0) ? -1 : 0;
76
77 float dx = end.x - start.x;
78 float dy = end.y - start.y;
79
80 float tDeltaX = (dx != 0.0f) ? ABS(1.0f / dx) : FLT_MAX;
81 float tDeltaY = (dy != 0.0f) ? ABS(1.0f / dy) : FLT_MAX;
82
83 float nextX = (stepX > 0) ? (fl::floor(start.x) + 1) : fl::floor(start.x);
84 float nextY = (stepY > 0) ? (fl::floor(start.y) + 1) : fl::floor(start.y);
85
86 float tMaxX = (dx != 0.0f) ? ABS((nextX - start.x) / dx) : FLT_MAX;
87 float tMaxY = (dy != 0.0f) ? ABS((nextY - start.y) / dy) : FLT_MAX;
88
89 float maxT = 1.0f;
90
91 int currentX = x0;
92 int currentY = y0;
93
94 while (true) {
95 visitor.visit(currentX, currentY);
96 float t = MIN(tMaxX, tMaxY);
97 if (t > maxT)
98 break;
99
100 if (tMaxX < tMaxY) {
101 tMaxX += tDeltaX;
102 currentX += stepX;
103 } else {
104 tMaxY += tDeltaY;
105 currentY += stepY;
106 }
107 }
108
109 // Ensure the end cell (x1, y1) is visited at least once
110 if (currentX != x1 || currentY != y1) {
111 visitor.visit(x1, y1);
112 }
113}
#define FLT_MAX
Definition math_macros.h:53

References ABS, floor(), FLT_MAX, MIN, fl::vec2< T >::x, and fl::vec2< T >::y.

+ Here is the call graph for this function:

◆ UpscalePalette() [1/6]

void fl::UpscalePalette ( const class CHSVPalette16 & srcpal16,
class CHSVPalette256 & destpal256 )

Definition at line 969 of file colorutils.cpp.

970 {
971 for (int i = 0; i < 256; ++i) {
972 destpal256[(uint8_t)(i)] = ColorFromPalette(srcpal16, i);
973 }
974}
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)

References ColorFromPalette().

+ Here is the call graph for this function:

◆ UpscalePalette() [2/6]

void fl::UpscalePalette ( const class CHSVPalette16 & srcpal16,
class CHSVPalette32 & destpal32 )

Definition at line 985 of file colorutils.cpp.

986 {
987 for (uint8_t i = 0; i < 16; ++i) {
988 uint8_t j = i * 2;
989 destpal32[j + 0] = srcpal16[i];
990 destpal32[j + 1] = srcpal16[i];
991 }
992}

◆ UpscalePalette() [3/6]

void fl::UpscalePalette ( const class CHSVPalette32 & srcpal32,
class CHSVPalette256 & destpal256 )

Definition at line 1001 of file colorutils.cpp.

1002 {
1003 for (int i = 0; i < 256; ++i) {
1004 destpal256[(uint8_t)(i)] = ColorFromPalette(srcpal32, i);
1005 }
1006}

References ColorFromPalette().

+ Here is the call graph for this function:

◆ UpscalePalette() [4/6]

void fl::UpscalePalette ( const class CRGBPalette16 & srcpal16,
class CRGBPalette256 & destpal256 )

Definition at line 962 of file colorutils.cpp.

963 {
964 for (int i = 0; i < 256; ++i) {
965 destpal256[(uint8_t)(i)] = ColorFromPalette(srcpal16, i);
966 }
967}

References ColorFromPalette().

+ Here is the call graph for this function:

◆ UpscalePalette() [5/6]

void fl::UpscalePalette ( const class CRGBPalette16 & srcpal16,
class CRGBPalette32 & destpal32 )

Definition at line 976 of file colorutils.cpp.

977 {
978 for (uint8_t i = 0; i < 16; ++i) {
979 uint8_t j = i * 2;
980 destpal32[j + 0] = srcpal16[i];
981 destpal32[j + 1] = srcpal16[i];
982 }
983}

◆ UpscalePalette() [6/6]

void fl::UpscalePalette ( const class CRGBPalette32 & srcpal32,
class CRGBPalette256 & destpal256 )

Definition at line 994 of file colorutils.cpp.

995 {
996 for (int i = 0; i < 256; ++i) {
997 destpal256[(uint8_t)(i)] = ColorFromPalette(srcpal32, i);
998 }
999}

References ColorFromPalette().

+ Here is the call graph for this function:

◆ worley_noise_2d_q15()

int32_t fl::worley_noise_2d_q15 ( int32_t x,
int32_t y )

Definition at line 33 of file noise_woryley.cpp.

33 {
34 int32_t cell_x = x >> 15;
35 int32_t cell_y = y >> 15;
36
37 int32_t min_dist = INT32_MAX;
38
39 // Check surrounding 9 cells
40 for (int dy = -1; dy <= 1; ++dy) {
41 for (int dx = -1; dx <= 1; ++dx) {
42 int32_t gx = cell_x + dx;
43 int32_t gy = cell_y + dy;
44
45 int32_t fx, fy;
46 feature_point(gx, gy, fx, fy);
47
48 int32_t feature_x = (gx << 15) + fx;
49 int32_t feature_y = (gy << 15) + fy;
50
51 int32_t dx_q15 = x - feature_x;
52 int32_t dy_q15 = y - feature_y;
53
54 // Approximate distance using Manhattan (faster) or Euclidean
55 // (costlier)
56 int32_t dist =
57 q15_abs(dx_q15) + q15_abs(dy_q15); // Manhattan distance
58
59 if (dist < min_dist)
60 min_dist = dist;
61 }
62 }
63
64 // Normalize: maximum possible distance is roughly 2*Q15_ONE
65 return (min_dist << 15) / (2 * Q15_ONE);
66}
#define INT32_MAX

References INT32_MAX, x, and y.

◆ x_linear()

FASTLED_FORCE_INLINE uint16_t fl::x_linear ( uint16_t x,
uint16_t length )

Definition at line 14 of file xmap.h.

14 {
15 (void)length;
16 return x;
17}
UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)

References FASTLED_FORCE_INLINE, length(), and x.

Referenced by fl::XMap::mapToIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ x_reverse()

FASTLED_FORCE_INLINE uint16_t fl::x_reverse ( uint16_t x,
uint16_t length )

Definition at line 19 of file xmap.h.

19 {
20 return length - 1 - x;
21}

References FASTLED_FORCE_INLINE, length(), and x.

Referenced by fl::XMap::mapToIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XY()

uint8_t XY ( uint8_t x,
uint8_t y )

Definition at line 21 of file blur.cpp.

21 {
24 FASTLED_ASSERT(false, "the user didn't provide an XY function");
25 return 0;
26}

References FASTLED_UNUSED, x, and y.

Referenced by Fire2023(), loop(), and fl::anonymous_namespace{blur.cpp}::xy_legacy_wrapper().

+ Here is the caller graph for this function:

◆ xy_line_by_line()

FASTLED_FORCE_INLINE uint16_t fl::xy_line_by_line ( uint16_t x,
uint16_t y,
uint16_t width,
uint16_t height )

Definition at line 27 of file xymap.h.

28 {
29 (void)height;
30 return y * width + x;
31}

References FASTLED_FORCE_INLINE, x, and y.

Referenced by fl::XYMap::mapToIndex().

+ Here is the caller graph for this function:

◆ xy_serpentine()

FASTLED_FORCE_INLINE uint16_t fl::xy_serpentine ( uint16_t x,
uint16_t y,
uint16_t width,
uint16_t height )

Definition at line 17 of file xymap.h.

18 {
19 (void)height;
20 if (y & 1) // Even or odd row?
21 // reverse every second line for a serpentine lled layout
22 return (y + 1) * width - 1 - x;
23 else
24 return y * width + x;
25}

References FASTLED_FORCE_INLINE, x, and y.

Referenced by fl::XYMap::mapToIndex().

+ Here is the caller graph for this function:

Variable Documentation

◆ ActivePaletteList

const TProgmemRGBPalette16* fl::ActivePaletteList[]
Initial value:
= {
const TProgmemRGBPalette16 PartyColors_p
HSV color ramp: blue, purple, pink, red, orange, yellow (and back).
const TProgmemRGBPalette16 RainbowColors_p
HSV Rainbow.
const TProgmemRGBPalette16 Snow_p
Definition twinklefox.h:276
const TProgmemRGBPalette16 RetroC9_p
Definition twinklefox.h:281
const TProgmemRGBPalette16 BlueWhite_p
Definition twinklefox.h:253
const TProgmemRGBPalette16 RedGreenWhite_p
Definition twinklefox.h:238
const TProgmemRGBPalette16 RedWhite_p
Definition twinklefox.h:248
const TProgmemRGBPalette16 Ice_p
Definition twinklefox.h:286
const TProgmemRGBPalette16 FairyLight_p
Definition twinklefox.h:258
const TProgmemRGBPalette16 Holly_p
Definition twinklefox.h:243

Definition at line 293 of file twinklefox.h.

Referenced by fl::TwinkleFox::chooseNextColorPalette().

◆ ANIMATION_TABLE

const AnimartrixEntry fl::ANIMATION_TABLE[]
static

Definition at line 170 of file animartrix.hpp.

170 {
178 {ZOOM2, "ZOOM2", &FastLEDANIMartRIX::Zoom2},
179 {ZOOM, "ZOOM", &FastLEDANIMartRIX::Zoom},
183 {YVES, "YVES", &FastLEDANIMartRIX::Yves},
185 {LAVA1, "LAVA1", &FastLEDANIMartRIX::Lava1},
189 {DISTANCE_EXPERIMENT, "DISTANCE_EXPERIMENT",
192 {WAVES, "WAVES", &FastLEDANIMartRIX::Waves},
195 {RINGS, "RINGS", &FastLEDANIMartRIX::Rings},
197 {COMPLEX_KALEIDO_2, "COMPLEX_KALEIDO_2",
199 {COMPLEX_KALEIDO_3, "COMPLEX_KALEIDO_3",
201 {COMPLEX_KALEIDO_4, "COMPLEX_KALEIDO_4",
203 {COMPLEX_KALEIDO_5, "COMPLEX_KALEIDO_5",
205 {COMPLEX_KALEIDO_6, "COMPLEX_KALEIDO_6",
207 {WATER, "WATER", &FastLEDANIMartRIX::Water},
208 {PARAMETRIC_WATER, "PARAMETRIC_WATER",
210 {MODULE_EXPERIMENT1, "MODULE_EXPERIMENT1",
212 {MODULE_EXPERIMENT2, "MODULE_EXPERIMENT2",
214 {MODULE_EXPERIMENT3, "MODULE_EXPERIMENT3",
216 {MODULE_EXPERIMENT4, "MODULE_EXPERIMENT4",
218 {MODULE_EXPERIMENT5, "MODULE_EXPERIMENT5",
220 {MODULE_EXPERIMENT6, "MODULE_EXPERIMENT6",
222 {MODULE_EXPERIMENT7, "MODULE_EXPERIMENT7",
224 {MODULE_EXPERIMENT8, "MODULE_EXPERIMENT8",
226 {MODULE_EXPERIMENT9, "MODULE_EXPERIMENT9",
228 {MODULE_EXPERIMENT10, "MODULE_EXPERIMENT10",
230 {MODULE_EXPERIMENT_SM1, "MODULE_EXPERIMENT_SM1", &FastLEDANIMartRIX::SM1},
231 {MODULE_EXPERIMENT_SM2, "MODULE_EXPERIMENT_SM2", &FastLEDANIMartRIX::SM2},
232 {MODULE_EXPERIMENT_SM3, "MODULE_EXPERIMENT_SM3", &FastLEDANIMartRIX::SM3},
233 {MODULE_EXPERIMENT_SM4, "MODULE_EXPERIMENT_SM4", &FastLEDANIMartRIX::SM4},
234 {MODULE_EXPERIMENT_SM5, "MODULE_EXPERIMENT_SM5", &FastLEDANIMartRIX::SM5},
235 {MODULE_EXPERIMENT_SM6, "MODULE_EXPERIMENT_SM6", &FastLEDANIMartRIX::SM6},
236 {MODULE_EXPERIMENT_SM8, "MODULE_EXPERIMENT_SM8", &FastLEDANIMartRIX::SM8},
237 {MODULE_EXPERIMENT_SM9, "MODULE_EXPERIMENT_SM9", &FastLEDANIMartRIX::SM9},
238 {MODULE_EXPERIMENT_SM10, "MODULE_EXPERIMENT_SM10",
240};

Referenced by fl::Animartrix::getAnimationName(), and fl::FastLEDANIMartRIX::loop().

◆ BlueWhite_p

const TProgmemRGBPalette16 fl::BlueWhite_p
Initial value:
= {
@ Gray
<div style='background:#808080;width:4em;height:4em;'></div>
Definition crgb.h:550
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>
Definition crgb.h:506

Definition at line 253 of file twinklefox.h.

◆ cosArray

const int16_t * fl::cosArray = &sinLut[64]

Definition at line 47 of file sin32.cpp.

Referenced by cos16lut(), and cos32().

◆ FairyLight_p

const TProgmemRGBPalette16 fl::FairyLight_p
Initial value:

Definition at line 258 of file twinklefox.h.

◆ gFlexFFT

FFT fl::gFlexFFT
static

Definition at line 110 of file audio.cpp.

Referenced by fl::AudioSample::fft().

◆ Holly_p

const TProgmemRGBPalette16 fl::Holly_p
Initial value:
= {
0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c,
0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c,
0x00580c, 0x00580c, 0x00580c, 0xB00402}

Definition at line 243 of file twinklefox.h.

243 {
244 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c,
245 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c, 0x00580c,
246 0x00580c, 0x00580c, 0x00580c, 0xB00402};

◆ Ice_p

const TProgmemRGBPalette16 fl::Ice_p
Initial value:
= {
0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040,
0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040,
0x182080, 0x182080, 0x182080, 0x5080C0}

Definition at line 286 of file twinklefox.h.

286 {
287 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040,
288 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040, 0x0C1040,
289 0x182080, 0x182080, 0x182080, 0x5080C0};

◆ instead

void const fl::XYMap& xymap fl::instead

Definition at line 52 of file blur.h.

◆ RedGreenWhite_p

const TProgmemRGBPalette16 fl::RedGreenWhite_p
Initial value:
= {
@ Green
<div style='background:#008000;width:4em;height:4em;'></div>
Definition crgb.h:552
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:616

Definition at line 238 of file twinklefox.h.

◆ RedWhite_p

const TProgmemRGBPalette16 fl::RedWhite_p
Initial value:

Definition at line 248 of file twinklefox.h.

◆ RetroC9_p

const TProgmemRGBPalette16 fl::RetroC9_p
Initial value:
= {
0xB80400, 0x902C02, 0xB80400, 0x902C02, 0x902C02, 0xB80400,
0x902C02, 0xB80400, 0x046002, 0x046002, 0x046002, 0x046002,
0x070758, 0x070758, 0x070758, 0x606820}

Definition at line 281 of file twinklefox.h.

281 {
282 0xB80400, 0x902C02, 0xB80400, 0x902C02, 0x902C02, 0xB80400,
283 0x902C02, 0xB80400, 0x046002, 0x046002, 0x046002, 0x046002,
284 0x070758, 0x070758, 0x070758, 0x606820};

◆ sinArray

const int16_t * fl::sinArray = &sinLut[0]

Definition at line 45 of file sin32.cpp.

Referenced by sin16lut(), and sin32().

◆ sinLut

const int16_t fl::sinLut[]

Definition at line 7 of file sin32.cpp.

7 {
8 0, 804, 1608, 2410, 3212, 4011, 4808, 5602, 6393,
9 7179, 7962, 8739, 9512, 10278, 11039, 11793, 12539, 13279,
10 14010, 14732, 15446, 16151, 16846, 17530, 18204, 18868, 19519,
11 20159, 20787, 21403, 22005, 22594, 23170, 23731, 24279, 24811,
12 25329, 25832, 26319, 26790, 27245, 27683, 28105, 28510, 28898,
13 29268, 29621, 29956, 30273, 30571, 30852, 31113, 31356, 31580,
14 31785, 31971, 32137, 32285, 32412, 32521, 32609, 32678, 32728,
15 32757, 32767, 32757, 32728, 32678, 32609, 32521, 32412, 32285,
16 32137, 31971, 31785, 31580, 31356, 31113, 30852, 30571, 30273,
17 29956, 29621, 29268, 28898, 28510, 28105, 27683, 27245, 26790,
18 26319, 25832, 25329, 24811, 24279, 23731, 23170, 22594, 22005,
19 21403, 20787, 20159, 19519, 18868, 18204, 17530, 16846, 16151,
20 15446, 14732, 14010, 13279, 12539, 11793, 11039, 10278, 9512,
21 8739, 7962, 7179, 6393, 5602, 4808, 4011, 3212, 2410,
22 1608, 804, 0, -804, -1608, -2410, -3212, -4011, -4808,
23 -5602, -6393, -7179, -7962, -8739, -9512, -10278, -11039, -11793,
24 -12539, -13279, -14010, -14732, -15446, -16151, -16846, -17530, -18204,
25 -18868, -19519, -20159, -20787, -21403, -22005, -22594, -23170, -23731,
26 -24279, -24811, -25329, -25832, -26319, -26790, -27245, -27683, -28105,
27 -28510, -28898, -29268, -29621, -29956, -30273, -30571, -30852, -31113,
28 -31356, -31580, -31785, -31971, -32137, -32285, -32412, -32521, -32609,
29 -32678, -32728, -32757, -32767, -32757, -32728, -32678, -32609, -32521,
30 -32412, -32285, -32137, -31971, -31785, -31580, -31356, -31113, -30852,
31 -30571, -30273, -29956, -29621, -29268, -28898, -28510, -28105, -27683,
32 -27245, -26790, -26319, -25832, -25329, -24811, -24279, -23731, -23170,
33 -22594, -22005, -21403, -20787, -20159, -19519, -18868, -18204, -17530,
34 -16846, -16151, -15446, -14732, -14010, -13279, -12539, -11793, -11039,
35 -10278, -9512, -8739, -7962, -7179, -6393, -5602, -4808, -4011,
36 -3212, -2410, -1608, -804, 0, 804, 1608, 2410, 3212,
37 4011, 4808, 5602, 6393, 7179, 7962, 8739, 9512, 10278,
38 11039, 11793, 12539, 13279, 14010, 14732, 15446, 16151, 16846,
39 17530, 18204, 18868, 19519, 20159, 20787, 21403, 22005, 22594,
40 23170, 23731, 24279, 24811, 25329, 25832, 26319, 26790, 27245,
41 27683, 28105, 28510, 28898, 29268, 29621, 29956, 30273, 30571,
42 30852, 31113, 31356, 31580, 31785, 31971, 32137, 32285, 32412,
43 32521, 32609, 32678, 32728, 32757, 32767};

◆ Snow_p

const TProgmemRGBPalette16 fl::Snow_p
Initial value:
= {
0x304048, 0x304048, 0x304048, 0x304048, 0x304048, 0x304048,
0x304048, 0x304048, 0x304048, 0x304048, 0x304048, 0x304048,
0x304048, 0x304048, 0x304048, 0xE0F0FF}

Definition at line 276 of file twinklefox.h.

276 {
277 0x304048, 0x304048, 0x304048, 0x304048, 0x304048, 0x304048,
278 0x304048, 0x304048, 0x304048, 0x304048, 0x304048, 0x304048,
279 0x304048, 0x304048, 0x304048, 0xE0F0FF};