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

Provide picture to image support? #73

Closed
jtdaugherty opened this issue Jun 8, 2015 · 2 comments
Closed

Provide picture to image support? #73

jtdaugherty opened this issue Jun 8, 2015 · 2 comments

Comments

@jtdaugherty
Copy link
Owner

Would it be possible for vty to provide a function with this type?

composite :: Picture -> (Int, Int) -> Image

This function would convert the layers in the Picture to an Image suitable for composing with other Images or as a layer in another Picture, subject to the width and height expectations provided as a parameter.

I am working on a new terminal UI library similar (in spirit) to vty-ui, and one operation I thought would be cool would be to composite layers as an intermediate step in building interfaces. Specifically I was modifying the Vty Rogue demo application and thought it would be nice to be able to build a minimap by compositing the player and geography images and then compose that with other images in the UI.

What do you think?

@coreyoconnor
Copy link
Contributor

I cannot start dev on this now, but here's some notes:

The code that is responsible for compositing the layers is from:

to:

First each layer is transformed from the Image representation to an array of SpanOp s. These arrays of SpanOps are then composed together by the code above.

I see no reason the composition could not be done before. That would likely be simpler than compositing the SpanOps as well.

A verification test for no regressions would be:

forall p < Picture. displayOpsForPic p displayRegion == displayOpsForPic (composite p displayRegion) displayRegion

@jtdaugherty
Copy link
Owner Author

Okay, thank you for the context. If I get time, I will work on this.

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