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

Experimental sixel support #19

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft

Conversation

ilobilo
Copy link

@ilobilo ilobilo commented Jan 4, 2025

According to the limited tests I've done, the code seems to work fine. Theoretically, the performance shouldn't be affected at all, unless sixels are drawn. If they are, scrolling code will need to call memmove and memset for the part of the sixel_canvas where the images are drawn.

revscroll isn't implemented.

The sixel decoder has been extracted from https://github.com/saitoha/libsixel

The sixel needs to be drawn in a single call to flanterm_write. That means, the string passed should contain both starting ESC+Pp1;p2;p3;q (which needs to be the very first thing in it) and ESC+\ at the end. After the closing escape sequence, the rest of the string is printed normally.
If the requirement above is not met, the sixel will be outputed as a string.

Changes to the flanterm api:
malloc and free are no longer passed to flanterm_fb_init. Instead, they are declared as weak symbols that need to be defined by the user. This is because sixel.c needs to allocate memory outside flanterm_fb_init.
Those functions are called flanterm_fb_alloc(size) and flanterm_fb_free(ptr).

memmove has been added as a requirement.

I'm creating this pull request in hopes that it gets reviewed so I (or someone else who cares more) can improve it.

According to the limited tests I've done, the code seems to work fine.
Theoretically, the performance shouldn't be affected at all, unless sixels are drawn.
If they are, scrolling code will need to call memmove and memset for the part of the sixel_canvas where the images are drawn.
revscroll isn't implemented.

The sixel decoder has been extracted from libsixel.

Changes to the flanterm api:
malloc and free are no longer passed to flanterm_fb_init.
Instead, they are declared as weak symbols that need to be defined by the user.
This is because sixel.c needs to allocate memory outside flanterm_fb_init.
functions: flanterm_fb_alloc and flanterm_fb_free
flanterm_fb_free doesn't pass the size anymore.
memmove has been added as a requirement.
@ilobilo
Copy link
Author

ilobilo commented Jan 4, 2025

_malloc and _free could be stored as global variables instead of using weak symbols (if that is an issue)

@ilobilo ilobilo marked this pull request as draft January 4, 2025 22:11
@ilobilo ilobilo changed the title Initial sixel support Experimental sixel support Jan 6, 2025
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

Successfully merging this pull request may close these issues.

1 participant