transparent blitter stacking is FIXED

2 views
Skip to first unread message

Nick Black

unread,
Jan 31, 2021, 6:18:12 PM1/31/21
to team notcurses
i've gotta say this was one of my top ten bugs ever, and
definitely the most interesting bug thus far in notcurses
development. in the end, we solved it with no measurable
performance impact, and a total space cost of 4 bits per *struct
crender* (recoverable) and 2 bits per *struct nccell* (already
in the struct, but previously free to use). essentially, once i
recover the 4 bits per struct crender, there will be *no net
time nor space cost* for this fix.

https://github.com/dankamongmen/notcurses/issues/1068

the basic problem can be stated thus: imagine we have two
images, both two pixels tall and one pixel wide. image 1 is
above image 2. image 1 is a transparent pixel and a white pixel.
image 2 is a blue pixel and a red pixel. what ought be the
output? i'd think a blue pixel atop a white pixel, but the
result could have been a red pixel atop a white pixel, because
rendering is solved in terms of *foreground and background*, but
here we want rendering in terms of *occupied geometry*.

the solution is quite intricate, and i'd really appreciate some
eyes on the PR:

https://github.com/dankamongmen/notcurses/pull/1317

w000000000000t!

https://www.youtube.com/watch?v=omfz62qu_Bc
https://www.youtube.com/watch?v=lVehcuJXe6I

--
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.
signature.asc
Reply all
Reply to author
Forward
0 new messages