~rockorager/vaxis#16: 
Image resizing cutoff

Need an interface for cutting off images (see the width/height option in kitty graphics), currently I have some scrolling images in my tui that cannot get cut off when they go "behind" other elements/outside of the defined window. Ideally images should get cut off when drawn too large inside a window rather than not drawing at all as well.

Status
REPORTED
Submitter
zettexe@mailbox.org
Assigned to
No-one
Submitted
10 months ago
Updated
10 months ago
Labels
No labels applied.

~rockorager 10 months ago

This is a papercut I've discovered, and I'm not certain the best approach. Ideally, we can punt this type of issue off to the application author so they can decide what is best for their use case. Contrary to that, I intend for the go version of this library to be very usable - and work "as one would expect". That said, I'm aware of this issue...I think the best solution is to pass in some sort of options struct into the New() function which tells Vaxis what to do in these cases (clip, scale, fill, etc). The current implementation gives enough data back to the application to do this on their own (IE clip, scale, fill) the image on their own using go std lib functions so I haven't bothered to fix it.

Any thoughts on what would be preferred? There haven't been many users of the image API so it's hard to see what most would prefer, outside of my own opinions.

William Zettergren 10 months ago ยท edit

I do like your idea of specifying in New() what the behaviour should be.

Personally I find dynamic resizing and cutting at render time to be quite an important and powerful feature as well so some way of moving and cutting the image on a cell level would be nice.

For example; have some variables in the draw function to specify an offset in cells X and Y for moving the image around the window and min/max size in cells for setting the size of the image. This would also allow for greater flexibility in drawing within windows as I find myself having to create a separate window purely for the image I want to display so as not to mess with other content.

Register here or Log in to comment, or comment via email.