Terminal-Print
Terminal-Print copied to clipboard
Support cell and pixel transparency
The easiest of these will be "screen door" transparency - cells are either fully opaque or fully transparent. More difficult will be alpha transparency, which may require treating foreground and background transparency separately. Harder still is paying any attention to the text involved.
Pixels are a bit simpler where alpha transparency is concerned because a colored pixel has only one alpha value ... but what about when a cell includes both a pixel with a defined color and no defined color?
As a simple first step, when I pulled T::P::Pixelated out of the attacks example in commit ac9dfce, I gave its .composite-pixels method a :skip-empty option that essentially gives screen-door transparency of the cells created from the pixels. In other words, with this option if neither of the pixels that make up a cell have a defined color, the entire cell is skipped in compositing.
That's not nearly as far as I'd like to go with this, but it's a start.
I'm confused. Is alpha transparency even supported by terminfo? Please provide a link to spec.
Xliff: No, this goes higher level than terminfo. See for example the blessed.js demo GIF at the top of their README; the first thing it demos is dragging "semi-transparent" text popups over another window and having shadows and window background look reasonable.
Ah. I see. We would then need to incorporate some kind of color merging routine to make such a thing, correct?
Xliff: Yep, that's correct. blessed.js only bothers with 0%, 50%, or 100% transparency, which makes the color calculations much simpler. But that's only one piece; the other is that we'll need some logic for handling overlapping box borders, especially of different types: What happens when a dialog is popped up over a menu, and both have borders? What happens when a box with a double border is next to a box with a single border, and they are both logically on the same Z plane? Etc.