<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/sixel.c, branch 1.20.2</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.20.2</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.20.2'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2024-10-23T06:35:30Z</updated>
<entry>
<title>config: add color.sixelN options</title>
<updated>2024-10-23T06:35:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-10-23T06:35:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=511aad419b9c869972902fe88b4f593b0faa6719'/>
<id>urn:sha1:511aad419b9c869972902fe88b4f593b0faa6719</id>
<content type='text'>
These options allows you to configure the default sixel color palette.
</content>
</entry>
<entry>
<title>sixel: default bg color is now taken from the sixel palette, not the ANSI bg color</title>
<updated>2024-09-05T05:33:05Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-09-05T05:17:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c41f55c3a0994f86aca4d6add49420a25e023ba4'/>
<id>urn:sha1:c41f55c3a0994f86aca4d6add49420a25e023ba4</id>
<content type='text'>
The wording in the original VT340 documentation is vague:

    Pixel positions specified as 0 are set to the current background
    color.

What does that mean? We _thought_ it meant the current ANSI background
color, as set with e.g. CSI 4x m.

It's still all a bit vague, but seeing that we have separate palettes
for text and graphic (should we?), it doesn't make sense to use the
ANSI background color as the default sixel background color.

So, use entry 0 from the sixel palette instead.
</content>
</entry>
<entry>
<title>term: performance: use a bitfield to track which ascii printer to use</title>
<updated>2024-06-26T16:39:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-06-23T23:26:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=48cf57818d354625fd1820ee82e31b8bb3227202'/>
<id>urn:sha1:48cf57818d354625fd1820ee82e31b8bb3227202</id>
<content type='text'>
The things affecting which ASCII printer we use have grown...

Instead of checking everything inside term_update_ascii_printer(), use
a bitfield.

Anything affecting the printer used, must now set a bit in this
bitfield. This makes term_update_ascii_printer() much faster, since
all it needs to do is check if the bitfield is zero or not.
</content>
</entry>
<entry>
<title>sixel: comment: document the P1 parameter</title>
<updated>2024-05-22T12:56:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-05-22T12:56:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0bf5a7e90279e87d0418bbce46e3a9b7cc4e699f'/>
<id>urn:sha1:0bf5a7e90279e87d0418bbce46e3a9b7cc4e699f</id>
<content type='text'>
(and no, it's no longer unimplemented)
</content>
</entry>
<entry>
<title>sixel: don't allow pan/pad changes after sixel data has been emitted</title>
<updated>2024-04-15T14:07:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-04-15T14:07:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3d2588edf8a90a7ba74d75089193a52b69905a4f'/>
<id>urn:sha1:3d2588edf8a90a7ba74d75089193a52b69905a4f</id>
<content type='text'>
Changing pan/pad changes the sixel's aspect ratio. While I don't know
for certain what a real VT340 would do, I suspect it would change the
aspect ratio of all subsequent sixels, but not those already emitted.

The way we implement sixels in foot, makes this behavior hard to
implement. We currently don't resize the image properly if the aspect
ratio is changed, but not the RA area. We have code that assumes all
sixel lines have the same aspect ratio, etc.

Since no "normal" applications change the aspect ratio in the middle
of a sixel, simply disallow it, and print a warning.

This also fixes a crash, when writing sixels after having modified the
aspect ratio.
</content>
</entry>
<entry>
<title>sixel: also set 'alloc_height', when short-cutting a resize operation</title>
<updated>2024-04-15T14:05:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-04-15T14:05:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0ab05f480789c0ccd452ed4d7f678d3e4fa36874'/>
<id>urn:sha1:0ab05f480789c0ccd452ed4d7f678d3e4fa36874</id>
<content type='text'>
In some cases, a sixel may be resized vertically, while still having a
zero-width. In this case, the resize operations are short-cutted, and
no actual allocations are done.

However, we forgot to set 'alloc_height' when doing so. As a result,
the trimming code (when the sixel is "done"), trimmed away the entire
sixel.
</content>
</entry>
<entry>
<title>sixel: abuse wmemset() when initializing a freshly allocated image buffer</title>
<updated>2024-03-25T15:33:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-25T15:33:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a99434929ced7673087458d18c4f78ae8a4c962a'/>
<id>urn:sha1:a99434929ced7673087458d18c4f78ae8a4c962a</id>
<content type='text'>
wmemset() is heavily optimized, and in some cases, *much* faster than
manually initializing the new image pixels.

Furthermore, assume calloc() is better at initializing memory to zero,
and use that when initializing new pixels in a transparent image.
</content>
</entry>
<entry>
<title>sixel: fix cursor positioning when image is split up into several</title>
<updated>2024-03-18T16:12:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-15T16:39:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9fcf5977c05686d55892d32fa3f980b03ef1b30a'/>
<id>urn:sha1:9fcf5977c05686d55892d32fa3f980b03ef1b30a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: hopefully handle image height correctly when trimming</title>
<updated>2024-03-18T16:11:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-15T16:23:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=bce1d7313dfe04f92b7a37c0352637045b4881dc'/>
<id>urn:sha1:bce1d7313dfe04f92b7a37c0352637045b4881dc</id>
<content type='text'>
When trimming trailing empty rows from the final image, handle the RA
region correctly:

* If image is transparent, trim down to the last non-empty pixel row,
  regardless of whether it is inside or outside the RA region.

* If image is opaque, trim down to either the last non-empty pixel
  row, or the RA region, whatever is the largest height.
</content>
</entry>
<entry>
<title>sixel: RA region does not affect the text cursor position</title>
<updated>2024-03-18T16:11:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-15T14:11:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cb820a498bc8b9c3823f54d0452c2e5d30de1996'/>
<id>urn:sha1:cb820a498bc8b9c3823f54d0452c2e5d30de1996</id>
<content type='text'>
The raster attributes is, really, just a way to erase an area. And, if
the sixel is transparent, it's a nop.

The final text cursor position depends, not on our image size (which
is based on RA), but on the final graphical cursor position.

However, we do want to continue using it as a hint of the final image
size, to be able to pre-allocate the backing buffer.

So, here's what we do:

* When trimming trailing transparent rows, only trim the *image*, if
  the graphical cursor is positioned on the last sixel row, *and* the
  sixel is transparent.
* Opaque sixels aren't trimmed at all, since RA in this acts as an
  erase that fills the RA region with the background color.
* The graphical cursor position is always adjusted (i.e. trimmed),
  since it affects the text cursor position.
* The text cursor position is now calculated from the graphical cursor
  position, instead of the image height.
</content>
</entry>
<entry>
<title>sixel: trim trailing, fully transparent sixel rows</title>
<updated>2024-03-18T16:09:20Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-11T15:25:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cc660bc7c1a55e71f8c7a131fbcf8753b447f977'/>
<id>urn:sha1:cc660bc7c1a55e71f8c7a131fbcf8753b447f977</id>
<content type='text'>
See https://github.com/hpjansson/chafa/issues/192
</content>
</entry>
<entry>
<title>sixel: place cursor on the last character row touched by the sixel</title>
<updated>2024-03-18T15:58:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-04T15:18:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=282c55aa4ac9a082392ee13107958fd0b84e7767'/>
<id>urn:sha1:282c55aa4ac9a082392ee13107958fd0b84e7767</id>
<content type='text'>
After emitting a sixel, place the cursor on the character row touched
by the last sixel. The last sixel _may_ not be a multiple of 6
pixels, *if* the sixel had an explicit width/height set via raster
attributes.

This is an intended deviation from the DEC cursor placement algorithm,
where the cursor is placed on the character row touched by the last
sixel's *upper* pixel.

The adjusted algorithm implemented here makes it much easier for
applications to handle text-after-sixels, since they can now simply
assume a single text newline is required to move the cursor to a
character row not touched by the sixel.
</content>
</entry>
<entry>
<title>sixel: disable debug logging</title>
<updated>2024-03-16T07:57:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-16T07:57:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f17b989650a00d5b888c9634bded4407198b7c69'/>
<id>urn:sha1:f17b989650a00d5b888c9634bded4407198b7c69</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: initialize the color table to colors used by the VT340</title>
<updated>2024-03-15T14:19:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-15T14:19:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=60fd4a262c5a3ce1c3951e305bcade3a88019f8a'/>
<id>urn:sha1:60fd4a262c5a3ce1c3951e305bcade3a88019f8a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: don't try to emit a sixel if we're outside the image's boundaries</title>
<updated>2024-03-07T15:21:06Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-07T15:21:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3e6f0e63f3027f19a83c6a2ddcf52018d30f2751'/>
<id>urn:sha1:3e6f0e63f3027f19a83c6a2ddcf52018d30f2751</id>
<content type='text'>
Closes #1634
</content>
</entry>
<entry>
<title>sixel: debug: sixel image _may_ be zero-sized</title>
<updated>2024-03-07T15:20:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-07T15:20:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=75fd59df3f27f914729abd69d790e3a2a51c70e4'/>
<id>urn:sha1:75fd59df3f27f914729abd69d790e3a2a51c70e4</id>
<content type='text'>
For example, and single GNL (Graphical New Line) will result in a
sixel with a non-zero height, but a zero width.
</content>
</entry>
<entry>
<title>sixel: we no longer need the extra newline</title>
<updated>2024-03-07T15:19:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-07T15:19:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a2fa667f45015f616171eccac9d6f55789b281d2'/>
<id>urn:sha1:a2fa667f45015f616171eccac9d6f55789b281d2</id>
<content type='text'>
Since we never place the cursor *under* the sixel anymore.
</content>
</entry>
<entry>
<title>sixel: debug: fix logged width/height values when emitting sixel</title>
<updated>2024-03-07T15:18:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-07T15:18:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1421ba504d58764b7801be72912a9afdddd18cb6'/>
<id>urn:sha1:1421ba504d58764b7801be72912a9afdddd18cb6</id>
<content type='text'>
image.width and image.height are the scaled dimensions, and these
haven't been set when the log message is printed.
</content>
</entry>
<entry>
<title>sixel: performance improvements</title>
<updated>2024-03-06T15:37:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-04T15:40:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1568518ab3c30ce9d83d6e2c4a9d8e74bbe15051'/>
<id>urn:sha1:1568518ab3c30ce9d83d6e2c4a9d8e74bbe15051</id>
<content type='text'>
* Store pointer to current pixel (i.e. pixel we're about to write to),
  instead of a row-byte-offset. This way, we don't have to calculate the
  offset into the backing image every time we emit a sixel band.

* Pass data pointer directly to sixel_add_*(), to avoid having to
  calculate an offset into the backing image.

* Special case adding a single 1:1 sixel. This removes a for loop, and
  simplifies state (position) updates. It is likely LTO does this for
  us, but this way, we get it optimized in non-LTO builds as well.
</content>
</entry>
<entry>
<title>sixel: fix row height calculation in resize_vertically()</title>
<updated>2024-03-06T15:36:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-03-04T15:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=8ff8ec5b70da567f28b6e0aba1d09931bd680fb3'/>
<id>urn:sha1:8ff8ec5b70da567f28b6e0aba1d09931bd680fb3</id>
<content type='text'>
In resize_vertically(), we assumed a sixel is 6 pixels tall. This is
mostly true, but not for non-1:1 sixels. Or, to be more precise, not
for sixels where 'pan' != 1.

This caused us to allocate too little backing memory, resulting in a
crash when we later tried to write to the image.
</content>
</entry>
</feed>
