mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-08 10:06:22 -05:00
sixel: size provided by DECGRA does *not* limit the sixel size
Foot has, up until now, used a fixed image size when the application used DECGRA (Raster Attributes) to “configure” the image size. This was based on a misunderstanding, that this was how you emitted sixels where the height was *not* a multiple of 6. This isn’t the case. The VT340 documentation is actually pretty clear about this: Ph and Pv do not limit the size of the image defined by the sixel data. However, Ph and Pv let you omit background sixel data from the image definition and still have a color background. They also provide a concise way for the application or terminal to encode the size of an image. This is also how XTerm behaves. Test image: \EPq "1;1;1;1 #0;2;0;0;0#1;2;100;100;0#2;2;0;100;0 #1~~@@vv@@~~@@~~$ #2??}}GG}}??}}??- #1!14@ \E\ This uses DECGRA to set the image size to 1x1. The sixel however is *not* clipped to 1x1, but is resized to 14x12
This commit is contained in:
parent
be980a6282
commit
c95c663989
2 changed files with 1 additions and 7 deletions
7
sixel.c
7
sixel.c
|
|
@ -45,7 +45,6 @@ sixel_init(struct terminal *term)
|
|||
term->sixel.image.data = xmalloc(1 * 6 * sizeof(term->sixel.image.data[0]));
|
||||
term->sixel.image.width = 1;
|
||||
term->sixel.image.height = 6;
|
||||
term->sixel.image.autosize = true;
|
||||
|
||||
/* TODO: default palette */
|
||||
|
||||
|
|
@ -841,9 +840,6 @@ sixel_unhook(struct terminal *term)
|
|||
static bool
|
||||
resize(struct terminal *term, int new_width, int new_height)
|
||||
{
|
||||
if (!term->sixel.image.autosize)
|
||||
return false;
|
||||
|
||||
LOG_DBG("resizing image: %dx%d -> %dx%d",
|
||||
term->sixel.image.width, term->sixel.image.height,
|
||||
new_width, new_height);
|
||||
|
|
@ -1034,8 +1030,7 @@ decgra(struct terminal *term, uint8_t c)
|
|||
if (ph >= term->sixel.image.height && pv >= term->sixel.image.width &&
|
||||
ph <= term->sixel.max_height && pv <= term->sixel.max_width)
|
||||
{
|
||||
if (resize(term, ph, pv))
|
||||
term->sixel.image.autosize = false;
|
||||
resize(term, ph, pv);
|
||||
}
|
||||
|
||||
term->sixel.state = SIXEL_DECSIXEL;
|
||||
|
|
|
|||
|
|
@ -531,7 +531,6 @@ struct terminal {
|
|||
uint32_t *data; /* Raw image data, in ARGB */
|
||||
int width; /* Image width, in pixels */
|
||||
int height; /* Image height, in pixels */
|
||||
bool autosize;
|
||||
} image;
|
||||
|
||||
bool scrolling:1; /* Private mode 80 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue