diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-03-09 16:23:55 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-03-11 16:34:19 +0000 |
| commit | 7d315d7bf9ab0376468929f0e41fbac98370e035 (patch) | |
| tree | ce5434c1c4dd97c4a7e61c3ef66f65cc02bc0423 /dcs.c | |
| parent | Merge branch 'sixel-optimize' (diff) | |
sixel: implement P2=1 - transparent pixels
When P2=1, empty pixels are transparent.
This patch also changes the behavior of P2=0|2, from setting empty
pixels to the default background color, to instead use the *current*
background color.
To implement this, a couple of changes are needed:
* Sixel pixels always use alpha=1.0, except for *empty* cells when
P2=1 (i.e. transparent pixels).
* The renderer draws sixels with the OVER operator, instead of the SRC
operator.
* The renderer *must* now render the cells beneath the sixel. As an
optimization, this is only done for sixels where P2=1. I.e. for
fully opaque sixels, there’s no need to render the cells beneath.
The sixel renderer isn’t yet hooked into the multi-threaded
renderer. This means *rows* (not just the cells) beneath
maybe-transparent sixels are rendered single-threaded.
Closes #391.
Diffstat (limited to 'dcs.c')
| -rw-r--r-- | dcs.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -42,12 +42,17 @@ dcs_hook(struct terminal *term, uint8_t final) switch (term->vt.private) { case 0: switch (final) { - case 'q': - sixel_init(term); + case 'q': { + int p1 = vt_param_get(term, 0, 0); + int p2 = vt_param_get(term, 1,0); + int p3 = vt_param_get(term, 2, 0); + + sixel_init(term, p1, p2, p3); term->vt.dcs.put_handler = &sixel_put; term->vt.dcs.unhook_handler = &sixel_unhook; break; } + } break; case '=': |
