@@ -202,15 +202,39 @@ bool IRAM_ATTR Segment::isPixelXYClipped(int x, int y) {
202202void IRAM_ATTR Segment::setPixelColorXY (int x, int y, uint32_t col)
203203{
204204 if (!isActive ()) return ; // not active
205- if (x >= virtualWidth () || y >= virtualHeight () || x < 0 || y < 0 || isPixelXYClipped (x,y)) return ; // if pixel would fall out of virtual segment just exit
205+
206+ int vW = virtualWidth ();
207+ int vH = virtualHeight ();
208+
209+ #ifndef WLED_DISABLE_MODE_BLEND
210+ if (!_modeBlend &&
211+ (blendingStyle == BLEND_STYLE_PUSH_RIGHT ||
212+ blendingStyle == BLEND_STYLE_PUSH_LEFT ||
213+ blendingStyle == BLEND_STYLE_PUSH_UP ||
214+ blendingStyle == BLEND_STYLE_PUSH_DOWN ||
215+ blendingStyle == BLEND_STYLE_PUSH_TL ||
216+ blendingStyle == BLEND_STYLE_PUSH_TR ||
217+ blendingStyle == BLEND_STYLE_PUSH_BR ||
218+ blendingStyle == BLEND_STYLE_PUSH_BL)) {
219+ unsigned prog = 0xFFFF - progress ();
220+ unsigned dX = (blendingStyle == BLEND_STYLE_PUSH_UP || blendingStyle == BLEND_STYLE_PUSH_DOWN) ? 0 : prog * vW / 0xFFFF ;
221+ unsigned dY = (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_RIGHT) ? 0 : prog * vH / 0xFFFF ;
222+ if (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_BL) x -= dX;
223+ else x += dX;
224+ if (blendingStyle == BLEND_STYLE_PUSH_DOWN || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_TR) y -= dY;
225+ else y += dY;
226+ }
227+ #endif
228+
229+ if (x >= vW || y >= vH || x < 0 || y < 0 || isPixelXYClipped (x,y)) return ; // if pixel would fall out of virtual segment just exit
206230
207231 uint8_t _bri_t = currentBri ();
208232 if (_bri_t < 255 ) {
209233 col = color_fade (col, _bri_t );
210234 }
211235
212- if (reverse ) x = virtualWidth () - x - 1 ;
213- if (reverse_y) y = virtualHeight () - y - 1 ;
236+ if (reverse ) x = vW - x - 1 ;
237+ if (reverse_y) y = vH - y - 1 ;
214238 if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
215239
216240 x *= groupLength (); // expand to physical pixels
@@ -294,9 +318,34 @@ void Segment::setPixelColorXY(float x, float y, uint32_t col, bool aa)
294318// returns RGBW values of pixel
295319uint32_t IRAM_ATTR Segment::getPixelColorXY (int x, int y) {
296320 if (!isActive ()) return 0 ; // not active
297- if (x >= virtualWidth () || y >= virtualHeight () || x<0 || y<0 || isPixelXYClipped (x,y)) return 0 ; // if pixel would fall out of virtual segment just exit
298- if (reverse ) x = virtualWidth () - x - 1 ;
299- if (reverse_y) y = virtualHeight () - y - 1 ;
321+
322+ int vW = virtualWidth ();
323+ int vH = virtualHeight ();
324+
325+ #ifndef WLED_DISABLE_MODE_BLEND
326+ if (!_modeBlend &&
327+ (blendingStyle == BLEND_STYLE_PUSH_RIGHT ||
328+ blendingStyle == BLEND_STYLE_PUSH_LEFT ||
329+ blendingStyle == BLEND_STYLE_PUSH_UP ||
330+ blendingStyle == BLEND_STYLE_PUSH_DOWN ||
331+ blendingStyle == BLEND_STYLE_PUSH_TL ||
332+ blendingStyle == BLEND_STYLE_PUSH_TR ||
333+ blendingStyle == BLEND_STYLE_PUSH_BR ||
334+ blendingStyle == BLEND_STYLE_PUSH_BL)) {
335+ unsigned prog = 0xFFFF - progress ();
336+ unsigned dX = (blendingStyle == BLEND_STYLE_PUSH_UP || blendingStyle == BLEND_STYLE_PUSH_DOWN) ? 0 : prog * vW / 0xFFFF ;
337+ unsigned dY = (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_RIGHT) ? 0 : prog * vH / 0xFFFF ;
338+ if (blendingStyle == BLEND_STYLE_PUSH_LEFT || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_BL) x -= dX;
339+ else x += dX;
340+ if (blendingStyle == BLEND_STYLE_PUSH_DOWN || blendingStyle == BLEND_STYLE_PUSH_TL || blendingStyle == BLEND_STYLE_PUSH_TR) y -= dY;
341+ else y += dY;
342+ }
343+ #endif
344+
345+ if (x >= vW || y >= vH || x<0 || y<0 || isPixelXYClipped (x,y)) return 0 ; // if pixel would fall out of virtual segment just exit
346+
347+ if (reverse ) x = vW - x - 1 ;
348+ if (reverse_y) y = vH - y - 1 ;
300349 if (transpose) { unsigned t = x; x = y; y = t; } // swap X & Y if segment transposed
301350 x *= groupLength (); // expand to physical pixels
302351 y *= groupLength (); // expand to physical pixels
0 commit comments