Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: postprocessing the contents of Display #6

Open
filiph opened this issue Feb 26, 2019 · 2 comments
Open

Feature: postprocessing the contents of Display #6

filiph opened this issue Feb 26, 2019 · 2 comments

Comments

@filiph
Copy link

filiph commented Feb 26, 2019

I notice that Terminals don't make the Display public (and Display itself doesn't provide a way to read from the current frame). This would be useful for my scenario, where I want to post-process the image on the screen.

Example use cases:

  • I want to draw a box around an enemy. I can just overwrite what's there, but it would look better if I make the colors in the box lighter but keep the contents.
  • I want to create a tutorial "layer" that darkens everything on the screen except for a single area, without changing code of the UI that I'm highlighting.
  • I want to draw a panel over the map, but I want it to be "see through". The background of each pixel of the panel should correspond to the color on the underlying map.
  • I want to add post-processing effects. Scrambles, glitches, blur.

I plan to do this anyway, and I was going to just create a custom CanvasTerminal in my own repo. I wonder a) whether this is something that's already supported somehow and I just don't see it, b) if it makes sense to make a PR to this package instead of making my own thing.

@munificent
Copy link
Owner

There are a couple of ways you can handle this, I think:

  1. Have multiple canvas elements on top of each other with the top ones semi-transparent.

  2. Have malison render to an offscreen canvas, and then draw that onto your own canvas where you do other post-processing.

@filiph
Copy link
Author

filiph commented Mar 3, 2019

Right.

To be a bit more clear: I meant "ASCII post-processing". For example, a glitch means that, at some point during an animation, a whole one line of the output is offset by 6 characters to the right, wrapping around. A highlight means that I take the current Glyph at some position, and replace it with the same one, only with a little lighter background.

If I understand your suggestions correctly, I think 2) doesn't help, and 1) might be overkill (both in performance and code complexity).

I propose this because it seems like a common use case, but of course I have no idea. My N equals 1. It's trivial for me to make a custom version of one of the provided Terminals that makes _display public, so no big deal.

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

No branches or pull requests

2 participants