@@ -325,6 +325,30 @@ extern byte realtimeMode; // used in getMappedPixelIndex()
325325
326326#define MODE_COUNT 187
327327
328+
329+ #define BLEND_STYLE_FADE 0x00 // universal
330+ #define BLEND_STYLE_FAIRY_DUST 0x01 // universal
331+ #define BLEND_STYLE_SWIPE_RIGHT 0x02 // 1D or 2D
332+ #define BLEND_STYLE_SWIPE_LEFT 0x03 // 1D or 2D
333+ #define BLEND_STYLE_PINCH_OUT 0x04 // 1D or 2D
334+ #define BLEND_STYLE_INSIDE_OUT 0x05 // 1D or 2D
335+ #define BLEND_STYLE_SWIPE_UP 0x06 // 2D
336+ #define BLEND_STYLE_SWIPE_DOWN 0x07 // 2D
337+ #define BLEND_STYLE_OPEN_H 0x08 // 2D
338+ #define BLEND_STYLE_OPEN_V 0x09 // 2D
339+ // as there are many push variants to optimise if statements they are groupped together
340+ #define BLEND_STYLE_PUSH_RIGHT 0x10 // 1D or 2D (& 0b00010000)
341+ #define BLEND_STYLE_PUSH_LEFT 0x11 // 1D or 2D (& 0b00010000)
342+ #define BLEND_STYLE_PUSH_UP 0x12 // 2D (& 0b00010000)
343+ #define BLEND_STYLE_PUSH_DOWN 0x13 // 2D (& 0b00010000)
344+ #define BLEND_STYLE_PUSH_TL 0x14 // 2D (& 0b00010000)
345+ #define BLEND_STYLE_PUSH_TR 0x15 // 2D (& 0b00010000)
346+ #define BLEND_STYLE_PUSH_BR 0x16 // 2D (& 0b00010000)
347+ #define BLEND_STYLE_PUSH_BL 0x17 // 2D (& 0b00010000)
348+ #define BLEND_STYLE_PUSH_MASK 0x10
349+ #define BLEND_STYLE_COUNT 18
350+
351+
328352typedef enum mapping1D2D {
329353 M12_Pixels = 0 ,
330354 M12_pBar = 1 ,
@@ -333,7 +357,7 @@ typedef enum mapping1D2D {
333357 M12_sPinwheel = 4
334358} mapping1D2D_t;
335359
336- // segment, 80 bytes
360+ // segment, 68 bytes
337361typedef struct Segment {
338362 public:
339363 uint16_t start; // start index / start X coordinate 2D (left)
@@ -436,6 +460,9 @@ typedef struct Segment {
436460 static uint16_t _transitionprogress; // current transition progress 0 - 0xFFFF
437461 #ifndef WLED_DISABLE_MODE_BLEND
438462 static bool _modeBlend; // mode/effect blending semaphore
463+ // clipping
464+ static uint16_t _clipStart, _clipStop;
465+ static uint8_t _clipStartY, _clipStopY;
439466 #endif
440467
441468 // transition data, valid only if transitional==true, holds values during transition (72 bytes)
@@ -446,6 +473,7 @@ typedef struct Segment {
446473 #else
447474 uint32_t _colorT[NUM_COLORS];
448475 #endif
476+ uint8_t _palTid; // previous palette
449477 uint8_t _briT; // temporary brightness
450478 uint8_t _cctT; // temporary CCT
451479 CRGBPalette16 _palT; // temporary palette
@@ -607,6 +635,10 @@ typedef struct Segment {
607635 inline void setPixelColor (float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0 , bool aa = true ) const { setPixelColor (i, RGBW32 (r,g,b,w), aa); }
608636 inline void setPixelColor (float i, CRGB c, bool aa = true ) const { setPixelColor (i, RGBW32 (c.r ,c.g ,c.b ,0 ), aa); }
609637 #endif
638+ #ifndef WLED_DISABLE_MODE_BLEND
639+ static inline void setClippingRect (int startX, int stopX, int startY = 0 , int stopY = 1 ) { _clipStart = startX; _clipStop = stopX; _clipStartY = startY; _clipStopY = stopY; };
640+ #endif
641+ bool isPixelClipped (int i) const ;
610642 [[gnu::hot]] uint32_t getPixelColor (int i) const ;
611643 // 1D support functions (some implement 2D as well)
612644 void blur (uint8_t , bool smear = false );
@@ -653,6 +685,7 @@ typedef struct Segment {
653685 inline void setPixelColorXY (float x, float y, byte r, byte g, byte b, byte w = 0 , bool aa = true ) const { setPixelColorXY (x, y, RGBW32 (r,g,b,w), aa); }
654686 inline void setPixelColorXY (float x, float y, CRGB c, bool aa = true ) const { setPixelColorXY (x, y, RGBW32 (c.r ,c.g ,c.b ,0 ), aa); }
655687 #endif
688+ [[gnu::hot]] bool isPixelXYClipped (int x, int y) const ;
656689 [[gnu::hot]] uint32_t getPixelColorXY (int x, int y) const ;
657690 // 2D support functions
658691 inline void blendPixelColorXY (uint16_t x, uint16_t y, uint32_t color, uint8_t blend) { setPixelColorXY (x, y, color_blend (getPixelColorXY (x,y), color, blend)); }
@@ -690,6 +723,7 @@ typedef struct Segment {
690723 inline void setPixelColorXY (float x, float y, byte r, byte g, byte b, byte w = 0 , bool aa = true ) { setPixelColor (x, RGBW32 (r,g,b,w), aa); }
691724 inline void setPixelColorXY (float x, float y, CRGB c, bool aa = true ) { setPixelColor (x, RGBW32 (c.r ,c.g ,c.b ,0 ), aa); }
692725 #endif
726+ inline bool isPixelXYClipped (int x, int y) { return isPixelClipped (x); }
693727 inline uint32_t getPixelColorXY (int x, int y) { return getPixelColor (x); }
694728 inline void blendPixelColorXY (uint16_t x, uint16_t y, uint32_t c, uint8_t blend) { blendPixelColor (x, c, blend); }
695729 inline void blendPixelColorXY (uint16_t x, uint16_t y, CRGB c, uint8_t blend) { blendPixelColor (x, RGBW32 (c.r ,c.g ,c.b ,0 ), blend); }
@@ -734,9 +768,7 @@ class WS2812FX { // 96 bytes
734768 public:
735769
736770 WS2812FX () :
737- paletteFade (0 ),
738771 paletteBlend (0 ),
739- cctBlending (0 ),
740772 now (millis()),
741773 timebase (0 ),
742774 isMatrix (false ),
@@ -824,7 +856,6 @@ class WS2812FX { // 96 bytes
824856 inline void resume () { _suspend = false ; } // will resume strip.service() execution
825857
826858 bool
827- paletteFade,
828859 checkSegmentAlignment () const ,
829860 hasRGBWBus () const ,
830861 hasCCTBus () const ,
@@ -839,7 +870,6 @@ class WS2812FX { // 96 bytes
839870
840871 uint8_t
841872 paletteBlend,
842- cctBlending,
843873 getActiveSegmentsNum () const ,
844874 getFirstSelectedSegId () const ,
845875 getLastActiveSegmentId () const ,
0 commit comments