Skip to content

Conversation

@imminentgloom
Copy link

Fixes #1852

By default Arc:segment() clears any background leds making it impossible to stack several segments.

Added a boolean flag, "stacking", which defaults to false to preserve original behaviour.
Setting it to true skips drawing any background/0 brightness leds.

By default Arc:segment() clears any background leds making it impossible to stack several segments.

Added a boolean flag, "stacking", which defaults to false to preserve original behaviour. Setting it to true skips drawing any background/0 brightness leds.
@tehn
Copy link
Member

tehn commented Dec 1, 2025

thanks for bringing this up!

i have an alternative proposition that i've been meaning to implement, which is a flag for all of the drawing functions to use relative levels.

for example:

arc:led(1,1,10) -- sets ring 1 LED 1 to 10
arc:led(1,1,2, true) -- increases ring 1 LED 1 by 2, so now it's 12

similarly this can apply to:

arc:all(1, true) -- add 1 to all LEDs
arc:segment(1, 1, 16, -4, true) -- subtract four from a segment on ring 1 from 1 to 16

level range clamping happens internally.

i've implemented similar on the iii arc/grid. a similar set of function extension can/should happen for the grid at the same time.

side note function additions:

arc:ring(n, level, relative_flag) -- set ring n to level, with relative (basically, all but for one ring)


the takeaway is, with the above implemented (which isn't difficult, just a bit of typing/testing) you'd be able to layer segments elegantly and preserve the anti-aliased edges.

which, come to think of it--- implementing the segment function in c would be quite sensible, though not entirely necessary.

i'm going to leave this open as a reminder, and i'll get this fix on my short list.

@tehn
Copy link
Member

tehn commented Dec 1, 2025

got started, tested the grid single led, works. will finish typing the rest tomorrow

https://github.com/monome/norns/compare/rel-leds?expand=1

@imminentgloom
Copy link
Author

this sounds great! like that it's a general solution as well

will we be able to do something like this after:
a:segment(1, from, to, function() return math.random(5) + 1 end)
which draws an noisy, dim segment without breaks?
i did this inside segment() in another script, and started testing last night without success. if it works or can be made to work it might be an interesting example for the reference docs

@imminentgloom
Copy link
Author

using the relative levels, will it be possible to draw a uniform (let's say 2 brightness) segment over an uneven background?
or will the segment become whatever the background is + 2, but maxing out at 15?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arc:segment() - skip blank leds?

2 participants