<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/sixel.c, branch 1.13.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.13.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.13.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2022-04-25T18:00:14Z</updated>
<entry>
<title>sixel/terminal: use the new grid and selection APIs</title>
<updated>2022-04-25T18:00:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-25T18:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1d4e1b921d351da349ccfbc5d587489d7b77e690'/>
<id>urn:sha1:1d4e1b921d351da349ccfbc5d587489d7b77e690</id>
<content type='text'>
Use grid_row_abs_to_sb() instead of manually “rebasing” row numbers.

Use selection_get_{start,end}() to retrieve the current selection
coordinates.
</content>
</entry>
<entry>
<title>sixel: revert to default state when an invalid DECGRI character is received</title>
<updated>2022-02-04T17:14:25Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-03T18:24:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=58bbbb0a319687774e7c06edf52b17bb79d6085a'/>
<id>urn:sha1:58bbbb0a319687774e7c06edf52b17bb79d6085a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: DECGRI (repeat) with a count of 0 should emit a single sixel</title>
<updated>2022-02-04T17:14:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-03T18:23:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9e8d553a21c3a96ede2c830de695f6a255538cdd'/>
<id>urn:sha1:9e8d553a21c3a96ede2c830de695f6a255538cdd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: resize: truncate instead of failing, when new size exceeds max size</title>
<updated>2022-02-04T17:14:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-03T18:20:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9150507209fd60a4eeb6374f7aabd3f1226f150f'/>
<id>urn:sha1:9150507209fd60a4eeb6374f7aabd3f1226f150f</id>
<content type='text'>
If the size we’re trying to set exceeds the configured max size,
truncate instead of failing.
</content>
</entry>
<entry>
<title>sixel: VT state’s bg color may now be an index, rather than an actual color value</title>
<updated>2021-12-26T11:37:48Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-12-25T20:22:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b218b8cfb0938b44cf75209d342c20240d9f8ef3'/>
<id>urn:sha1:b218b8cfb0938b44cf75209d342c20240d9f8ef3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>term: track cell color source</title>
<updated>2021-11-20T15:46:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-11-20T15:29:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d46af6bd7ac7606bf99d63b2453b656a5defb892'/>
<id>urn:sha1:d46af6bd7ac7606bf99d63b2453b656a5defb892</id>
<content type='text'>
Each cell now tracks it’s current color source:

* default fg/bg
* base16 fg/bg (maps to *both* the regular and bright colors)
* base256 fg/bg
* RGB

Note that we don’t have enough bits to separate the regular from the
bright colors. These _shouldn’t_ be the same, so we ought to be
fine...
</content>
</entry>
<entry>
<title>sixel: call decsixel() directly, instead of going through sixel_put()</title>
<updated>2021-09-05T09:09:45Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T09:09:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b1a4d4384571a6aa2bfc97644a6dff7066afef0b'/>
<id>urn:sha1:b1a4d4384571a6aa2bfc97644a6dff7066afef0b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: avoid looking up color from palette for each sixel</title>
<updated>2021-09-05T09:08:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T09:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=47c32d5913044912f5e0974ab6554de1f2a62b3b'/>
<id>urn:sha1:47c32d5913044912f5e0974ab6554de1f2a62b3b</id>
<content type='text'>
Instead, do the palette lookup when we receive the DECGCI (i.e. when
the palette entry is selected), and store the actual color value in
our sixel struct.
</content>
</entry>
<entry>
<title>sixel: calculate default bg once, in init</title>
<updated>2021-09-05T08:27:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T08:27:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f9642e959725fc43ad7dac0e3c8be842d53aa903'/>
<id>urn:sha1:f9642e959725fc43ad7dac0e3c8be842d53aa903</id>
<content type='text'>
We have all information we need to calculate the default background
color in sixel_init():

* Whether the image have transparency or not
* The current ANSI background color
</content>
</entry>
<entry>
<title>sixel: destroy(): don’t unref a NULL pixman image</title>
<updated>2021-07-18T14:30:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-07-18T14:30:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f65e062ce4defaa647b43927e462eaf2d683942b'/>
<id>urn:sha1:f65e062ce4defaa647b43927e462eaf2d683942b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: fix crash when splitting up an image across the scrollback</title>
<updated>2021-06-24T15:08:33Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-24T15:08:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a52d8679472f3695394d6e718bd85c4d204c4523'/>
<id>urn:sha1:a52d8679472f3695394d6e718bd85c4d204c4523</id>
<content type='text'>
If an image was split up across the scrollback, and the first image
chunk was resized due to it being blended with an already existing
sixel, we crashed.

The reason being the second chunk, emitted *after* the scrollback,
tried to memcpy() image data from a now-free:d image buffer.

The fix is pretty simple: create copies for *all* chunks when an image
has to be split up across the scrollback. Previously, the first chunk
re-used the source image buffer.

Closes #608
</content>
</entry>
<entry>
<title>sixel: add support for overlapping sixels</title>
<updated>2021-06-09T08:00:19Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-06-06T19:38:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6d336fcadd08ebbf19e63a32fa5be3fbfdc2ae59'/>
<id>urn:sha1:6d336fcadd08ebbf19e63a32fa5be3fbfdc2ae59</id>
<content type='text'>
Writing a sixel on top of an already existing sixel currently has the
following limitations in foot:

* The parts of the first sixel that is covered by the new sixel are
  removed, completely. Even if the new sixel has transparent
  areas. I.e. writing a transparent sixel on top of another
  sixel *replaces* the first sixel with the new sixel, instead of
  layering them on top of each other.

* The second sixel erases the first sixel cell-wise. That is, a sixel
  whose size isn’t a multiple of the cell dimensions will leave
  unsightly holes in the first sixel.

This patch takes care of both issues.

The first one is actually the easiest one: all we need to do is
calculate the intersection, and blend the two images. To keep things
relatively simple, we use the pixman image from the *new* image, and
use the ‘OVER_REVERSE’ operation to blend the new image over the old
one.

That is, the old image is still split into four tiles (top, left,
right, bottom), just like before. But instead of throwing away the
fifth middle tile, we blend it with the new image. As an optimization,
this is only done if the new image has transparency (P1=1).

The second problem is solved by detecting when we’re erasing an area
from the second image that is larger than the new image. In this case,
we enlarge the new image, and copy the old image into the new one.

Finally, when we enlarge the new image, there may be areas in the new
image that is *not* covered by the old image. These areas are made
transparent.

The end result is:

* Each cell is covered by at *most* 1 sixel image. I.e. the total
  numbers of sixels are finite. This is important for the ‘mpv
  --vo=sixel’ use case - we don’t want to end up with thousands of
  sixels layered on top of each other.

* Writing an opaque sixel on top of another sixel has _almost_ zero
  performance impact. Especially if the two sixels have the same size,
  so that we don’t have to resize the new image. Again, important for
  the ‘mpv --vo=sixel’ use case.

Closes #562
</content>
</entry>
<entry>
<title>sixel: don’t *ever* shrink image below its SRA size</title>
<updated>2021-05-16T09:00:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-16T08:57:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e0f1a4ae33168ad1dd5d3c01fab0acadcb964943'/>
<id>urn:sha1:e0f1a4ae33168ad1dd5d3c01fab0acadcb964943</id>
<content type='text'>
If the image was accompanied with a “Set Raster Attributes” (SRA)
command, make sure we *never* shrink the image below the size
specified in the SRA.

Images are normally shrunk when their bottom rows are fully
transparent. This enables sixels that aren’t a multiple of 6 to be
emitted, without also emitting an SRA command.

But if there *is* an SRA command, obey it.

Verified against XTerm-367
</content>
</entry>
<entry>
<title>sixel: don’t emit sixels that will end up covering more than the entire scrollback</title>
<updated>2021-05-08T18:28:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-08T17:03:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ba451af5c73ae4198b354690f2f2321364367d36'/>
<id>urn:sha1:ba451af5c73ae4198b354690f2f2321364367d36</id>
<content type='text'>
This limit can be reached by the sixel alone, or the sixel + the final
newline.

Closes #494
</content>
</entry>
<entry>
<title>sixel: fix assertion: image is allowed to cover the entire scrollback</title>
<updated>2021-05-08T18:28:16Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-05-08T17:02:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9bd14c0fd217721d32f52808878ed7e89bb82a16'/>
<id>urn:sha1:9bd14c0fd217721d32f52808878ed7e89bb82a16</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: unhook: tighten up the condition needed for us to free image data pre-maturely</title>
<updated>2021-04-07T17:08:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:08:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5f8a8951c77abec86f81b783a955d49cc9679faf'/>
<id>urn:sha1:5f8a8951c77abec86f81b783a955d49cc9679faf</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: sixel_fini(): free image data</title>
<updated>2021-04-07T17:07:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-04-07T17:07:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f9a730f33b14e61bf5466f6e2361b1d74dabcada'/>
<id>urn:sha1:f9a730f33b14e61bf5466f6e2361b1d74dabcada</id>
<content type='text'>
Normally, this data is always free:d indirectly, when the sixel image
that took over ownership is destroyed. But let’s play it safe.
</content>
</entry>
<entry>
<title>sixel: fix double free caused by bad free() in sixel_colors_set()</title>
<updated>2021-03-30T09:08:03Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-30T09:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=00083125a12bc8809f5b6d498a85a880e268cc81'/>
<id>urn:sha1:00083125a12bc8809f5b6d498a85a880e268cc81</id>
<content type='text'>
sixel_color_set() is called when the number of (sixel) color registers
is changed.

It frees the current palette, and changes the “palette size” variable.

Originally, we only had a single palette. This is the one free:d by
sixel_color_set().

Later, we added support for private vs. shared palettes. With this
change, we now have one palette that is “never” free:d (the shared
one), and a private palette that is always free:d after a sixel has
been emitted.

‘sixel.palette’ is a pointer to the palette currently in use, and
should only be accessed **while emitting a sixel**.

This is the pointer sixel_color_set() free:d. So for example, if
‘sixel.palette’ pointed to the shared palette, we’d free the shared
palette. But, we didn’t reset ‘sixel.shared_palette’, causing a double
free later on.

Closes #427
</content>
</entry>
<entry>
<title>sixel: free backing buffer if final image size is zero</title>
<updated>2021-03-28T11:22:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T10:57:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=19289bad5ef60f4c5ca2b45c0e495db60ed34267'/>
<id>urn:sha1:19289bad5ef60f4c5ca2b45c0e495db60ed34267</id>
<content type='text'>
</content>
</entry>
<entry>
<title>sixel: initialize max_non_empty_row_no to -1, not 0</title>
<updated>2021-03-28T11:22:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T10:55:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3566be591a971a118dca6edc263dd7eefaa5f648'/>
<id>urn:sha1:3566be591a971a118dca6edc263dd7eefaa5f648</id>
<content type='text'>
0 is a perfectly valid row number, and if max_non_empty_row_no==0,
that means we have *1* sixel row, and after trimming the image, the
image will have a height of 6 pixels.

If the sixel sequence is empty (or at least doesn’t emit any non-empty
pixels), then trimming the image should result in an image height of
0.

When max_non_empty_row_no is initialized to -1, it will still have
that value in unhook(), which makes the final image height 0.
</content>
</entry>
</feed>
