Terminal-Print icon indicating copy to clipboard operation
Terminal-Print copied to clipboard

Support cell and pixel transparency

Open japhb opened this issue 8 years ago • 5 comments

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?

japhb avatar Dec 12 '16 04:12 japhb

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.

japhb avatar Dec 24 '16 04:12 japhb

I'm confused. Is alpha transparency even supported by terminfo? Please provide a link to spec.

Xliff avatar Aug 22 '17 15:08 Xliff

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.

japhb avatar Aug 31 '17 00:08 japhb

Ah. I see. We would then need to incorporate some kind of color merging routine to make such a thing, correct?

Xliff avatar Sep 09 '17 04:09 Xliff

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.

japhb avatar Sep 12 '17 23:09 japhb