diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-09-24 23:25:07 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-09-24 23:55:43 +0200 |
| commit | 1c9277343140effcc9eee8845757afd1eed4f4bd (patch) | |
| tree | 7a902dc2aebce67ee5749442129176b0683cf60f /src/types | |
| parent | 0c738c94e14c213562f69ff6e376c19fb0487201 (diff) | |
| download | chawan-1c9277343140effcc9eee8845757afd1eed4f4bd.tar.gz | |
sixel: support transparency
Sixel can only represent transparency for fully transparent (alpha
= 0) and fully opaque (alpha = 255) pixels, i.e. we would have to
do blending ourselves to do this "properly". But what do you even
blend? Background color? Images? Clearly you can't do text...
So instead of going down the blending route, we now just approximate
the 8-bit channel with Sixel's 1-bit channel and then patch it up with
dither. It does look a bit weird, but it's not *that* bad, especially
compared to the previous strategy of "blend with some color which
hopefully happens to be the background color" (it rarely was).
Note that this requires us to handle transparent images specially
in term. That is, for opaque ones, we can leave out the "clear cells
affected by image" part, but for transparent ones, we must clear the
entire image every time.
Diffstat (limited to 'src/types')
| -rw-r--r-- | src/types/color.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/types/color.nim b/src/types/color.nim index ab8d4984..20de1fcc 100644 --- a/src/types/color.nim +++ b/src/types/color.nim @@ -293,7 +293,7 @@ func fastmul*(c, ca: uint32): uint32 = return ga or (rb shr 8) # fastmul, but preserves alpha -func fastmul1(c, ca: uint32): uint32 = +func fastmul1*(c, ca: uint32): uint32 = let u = c var rb = u and 0x00FF00FFu32 rb *= ca |