Skip to content

Commit

Permalink
Tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Feb 18, 2025
1 parent a66437b commit 9a9ea7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1677,15 +1677,15 @@ void WS2812FX::blendSegment(const Segment &topSegment) {
constexpr auto difference = [](uint8_t a, uint8_t b){ return uint8_t(b > a ? (b - a) : (a - b)); };
constexpr auto average = [](uint8_t a, uint8_t b){ return uint8_t((a + b) >> 1); };
constexpr auto multiply = [](uint8_t a, uint8_t b){ return uint8_t((a * b) / 255); }; // origianl uses a & b in range [0,1]
constexpr auto divide = [](uint8_t a, uint8_t b){ return uint8_t(a > 0 ? (b*255) / a : b); };
constexpr auto divide = [](uint8_t a, uint8_t b){ return uint8_t(a > b ? (b*255) / a : 255); };
constexpr auto lighten = [](uint8_t a, uint8_t b){ return uint8_t(a > b ? a : b); };
constexpr auto darken = [](uint8_t a, uint8_t b){ return uint8_t(a < b ? a : b); };
constexpr auto screen = [](uint8_t a, uint8_t b){ return uint8_t(255 - multiply(~a, ~b)); }; // 255 - (255-a)*(255-b)/255
constexpr auto screen = [](uint8_t a, uint8_t b){ return uint8_t(255 - multiply(~a,~b)); }; // 255 - (255-a)*(255-b)/255
constexpr auto overlay = [](uint8_t a, uint8_t b){ return uint8_t(b<128 ? 2*a*b/255 : (255 - 2*~a*~b/255)); };
constexpr auto hardlight = [](uint8_t a, uint8_t b){ return uint8_t(a<128 ? 2*a*b/255 : (255 - 2*~a*~b/255)); };
constexpr auto softlight = [](uint8_t a, uint8_t b){ return uint8_t((b*b*(255-2*a)/255 + 2*a*b)/255); }; // Pegtop's formula (1 - 2a)b^2 + 2ab
constexpr auto dodge = [](uint8_t a, uint8_t b){ return divide(b,~a); };
constexpr auto burn = [](uint8_t a, uint8_t b){ return divide(~b,a); };
constexpr auto dodge = [](uint8_t a, uint8_t b){ return divide(~a,b); };
constexpr auto burn = [](uint8_t a, uint8_t b){ return uint8_t(~divide(a,~b)); };

typedef uint8_t(*FuncType)(uint8_t, uint8_t);
FuncType funcs[] = {
Expand Down
4 changes: 2 additions & 2 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ function populateSegments(s)
`<option value="4" ${inst.m12==4?' selected':''}>Pinwheel</option>`+
`</select></div>`+
`</div>`;
let blend = `<div class="lbl-s">Blend mode<br>`+
let blend = `<div class="lbl-l">Blend mode<br>`+
`<div class="sel-p"><select class="sel-p" id="seg${i}bm" onchange="setBm(${i})">`+
`<option value="0" ${inst.bm==0?' selected':''}>Top/Default</option>`+
`<option value="1" ${inst.bm==1?' selected':''}>Bottom/None</option>`+
Expand Down Expand Up @@ -880,9 +880,9 @@ function populateSegments(s)
`</tr>`+
`</table>`+
`<div class="h bp" id="seg${i}len"></div>`+
blend +
(!isMSeg ? rvXck : '') +
(isMSeg&&stoY-staY>1&&stoX-staX>1 ? map2D : '') +
blend +
// (s.AudioReactive && s.AudioReactive.on ? "" : sndSim) +
`<label class="check revchkl" id="seg${i}lbtm">`+
(isMSeg?'Transpose':'Mirror effect') + (isMSeg ?
Expand Down

0 comments on commit 9a9ea7c

Please sign in to comment.