MCPcopy Create free account
hub / github.com/FastLED/FastLED / fill_2dnoise16

Function fill_2dnoise16

src/noise.cpp.hpp:922–959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920
921
922void fill_2dnoise16(CRGB *leds, int width, int height, bool serpentine,
923 fl::u8 octaves, fl::u32 x, int xscale, fl::u32 y, int yscale, fl::u32 time,
924 fl::u8 hue_octaves, fl::u16 hue_x, int hue_xscale, fl::u16 hue_y, fl::u16 hue_yscale,fl::u16 hue_time, bool blend, fl::u16 hue_shift) {
925
926 FASTLED_STACK_ARRAY(fl::u8, V, height*width);
927 FASTLED_STACK_ARRAY(fl::u8, H, height*width);
928
929 fl::memset(V,0,height*width);
930 fl::memset(H,0,height*width);
931
932 fill_raw_2dnoise16into8((fl::u8*)V,width,height,octaves,fl::q44(2,0),171,1,x,xscale,y,yscale,time);
933 // fill_raw_2dnoise16into8((uint8_t*)V,width,height,octaves,x,xscale,y,yscale,time);
934 // fill_raw_2dnoise8((uint8_t*)V,width,height,hue_octaves,x,xscale,y,yscale,time);
935 fill_raw_2dnoise8((fl::u8*)H,width,height,hue_octaves,hue_x,hue_xscale,hue_y,hue_yscale,hue_time);
936
937
938 int w1 = width-1;
939 int h1 = height-1;
940 hue_shift >>= 8;
941
942 for(int i = 0; i < height; ++i) {
943 int wb = i*width;
944 for(int j = 0; j < width; ++j) {
945 CRGB led(CHSV(hue_shift + (H[(h1-i)*width + (w1-j)]), 196, V[i*width + j]));
946
947 int pos = j;
948 if(serpentine && (i & 0x1)) {
949 pos = w1-j;
950 }
951
952 if(blend) {
953 leds[wb+pos] >>= 1; leds[wb+pos] += (led>>=1);
954 } else {
955 leds[wb+pos] = led;
956 }
957 }
958 }
959}
960
961FL_DISABLE_WARNING_POP

Callers 1

loopFunction · 0.85

Calls 3

memsetFunction · 0.85
fill_raw_2dnoise16into8Function · 0.85
fill_raw_2dnoise8Function · 0.85

Tested by

no test coverage detected