-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add some manner of Sixel interface #200
Comments
libsixel looks pretty solid, and is MIT-licensed: https://github.com/dankamongmen/libsixel so sixel seems sweet. Problem is lack of support -- it's not present in kitty, alacritty, or vte, at least. To get it working well in xterm, you need:
in your xresources database, or to launch it with:
(we can upgrade the number of color registers ourselves, ala lsix, so long as vt340 mode is used) but yeah, that's just xterm. it does work over ssh, though. |
And now, of course, it is obvious how we ought integrate Sixel: as a glyph blitting backend of |
it looks like we'll want to use /* convert pixels into sixel format and write it to output context */
SIXELAPI SIXELSTATUS
sixel_encode(
unsigned char /* in */ *pixels, /* pixel bytes */
int /* in */ width, /* image width */
int /* in */ height, /* image height */
int /* in */ depth, /* color depth: now unused */
sixel_dither_t /* in */ *dither, /* dither context */
sixel_output_t /* in */ *context); /* output context */ we'll need to provide an output context: /* create output context object */
SIXELAPI SIXELSTATUS
sixel_output_new(
sixel_output_t /* out */ **output, /* output object to be created */
sixel_write_function /* in */ fn_write, /* callback for output sixel */
void /* in */ *priv, /* private data given as
3rd argument of fn_write */
sixel_allocator_t /* in */ *allocator); /* allocator, null if you use
default allocator */ |
I spent some time looking through libsixel, and am unimpressed. It's lousy with And we still don't seem to have a way to detect whether Sixel is available :/. |
lsix appears to be capable of determining this:
|
JFC, # IS TERMINAL SIXEL CAPABLE? # Send Device Attributes
IFS=";" read -a REPLY -s -t 1 -d "c" -p $'\e[c' >&2
for code in "${REPLY[@]}"; do
if [[ $code == "4" ]]; then
hassixel=yup
break
fi
done ugh, it looks like it requires interrogating the terminal :/ |
Yeah, drop the libsixel crap. We'll proceed directly. |
The only terminals I can find with support for this are Xterm and mlterm (though maybe the OSX and Windows terminals have support; I'm unsure). Hrmm. |
We are now detecting Sixel support dynamically. If |
Just stumbled across OCS1337, supported by hterm and iterm |
OK, I've got all the detection and such working in |
Sixel Graphics CSI Ps c Send Device Attributes (Primary DA), xterm. xterm responds to CSI ? Pm h DCS Pa ; Pb ; Ph q Ps..Ps ST
|
|
I just tried running notcurses-demo on |
Time to go to bed, but we're now generating some manner of pixel output through direct mode. We're outputting a bunch of sixel codes in rendered mode, but that ought be simple enough to resolve. Need to break down the colors; we're currently always providing 100;100;100, but it shouldn't be difficult to break down. We're close! |
I merged the first big bit of work -- all the infrastructure and documentation -- just now as #1372. Need to get |
getting closer...we can now draw a 20x20 monochromatic square, except that there are gaps between each sixel band, lol. but getting there! and we draw it in both direct and rendered mode. |
I'm not yet deeply knowledgeable regarding Sixel, but it seems pretty tight (where supported). It's definitely not a 1.0.0 thing, but we ought open up the Sixel floodgates sooner rather than later IMHO.
The text was updated successfully, but these errors were encountered: