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

Image for demo #2

Open
joshka opened this issue Mar 16, 2024 · 3 comments
Open

Image for demo #2

joshka opened this issue Mar 16, 2024 · 3 comments

Comments

@joshka
Copy link

joshka commented Mar 16, 2024

The image used for the logo is a bit blurry due to several factors:

  • the resize from the main logo into the png in this lib is using (cubic?) interpolation, which makes all the pixels blurred.
  • the mapping of screen pixels to image pixels isn't on an integer amount, so they leave random gaps between pixels

These can both be fixed to make a higher fidelity image (but it's a bit of work to get it perfect).

Here's a half baked attempt that works ok 160x40. I mainly just resized the logo using linear interpolation and redid the text as 30 pt size (the font is Silkscreen)) with a offset shadow layer that is the width of the character cell.

splash

image

To get this perfect, you'd need to align the text so that the outlines of each letter start and end at a multiple of the braille character sizing (x = 2, y = 4) and aim to ensure that only a single color is in each 2x4 area. For the logo, it would probably require some pixel editing. The colors for things rendered in braille need to be a bit brighter also to avoid the background washing them out.

I noticed that rendering at double this pixel density (e.g. a 320x160 image instead of 160x40 here renders pretty slowly).

Also, there's a bug that causes a panic if the render area > buffer size (this is something in a lot of widgets, which I try to generally stamp out when possible).

If you want to start with something higher fidelity than the existing png, then take a look at the gimp xcf file in the website repo.

@orhun
Copy link
Owner

orhun commented Mar 16, 2024

Hey, thanks for the feedback! I think the image you provided works better than the current one so I will just update it.

I noticed that rendering at double this pixel density (e.g. a 320x160 image instead of 160x40 here renders pretty slowly).

Some parts of the codebase (e.g. get_image_data) is pretty old so certainly there are parts that needs performance improvements 🐻

Also, there's a bug that causes a panic if the render area > buffer size (this is something in a lot of widgets, which I try to generally stamp out when possible).

Do you think I should take action on this or should we handle that in Ratatui?

@joshka
Copy link
Author

joshka commented Mar 16, 2024

Do you think I should take action on this or should we handle that in Ratatui?

Both really. We should generally have many more methods that return results / options instead of panicking, but for now most things should do an area check (let area = area.instersection(buf.area); can work good enough for this).

@orhun
Copy link
Owner

orhun commented Mar 19, 2024

Pushed 05fe02c and released v0.1.3 for fixing the panic!

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