From 4442a9fea9b3ebf7289ada503b58848867a24113 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 16 Apr 2021 01:03:32 -0400 Subject: [PATCH] rgba_trans_p: any non-zero alpha must be displayed #1540 --- src/lib/internal.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/internal.h b/src/lib/internal.h index 1c54164cc..1364ed12d 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -1472,12 +1472,15 @@ int drop_signals(void* nc); void ncvisual_printbanner(const notcurses* nc); -// alpha comes to us 0--255, but we have only 3 alpha values to map them to. -// settled on experimentally. if transcolor is non-zero, match its lower 24 -// bits against the color, and treat a match as transparent. +// alpha comes to us 0--255, but we have only 3 alpha values to map them to +// (opaque, blended, and transparent). it's necessary that we display +// something for any non-zero alpha (see #1540), so the threshold is 1. +// we might want to map this to blended, but we only use opaque and +// transparent for now. if |transcolor| is non-zero, match its lower 24 +// bits against each pixel's RGB value, and treat a match as transparent. static inline bool rgba_trans_p(uint32_t p, uint32_t transcolor){ - if(ncpixel_a(p) < 192){ + if(ncpixel_a(p) == 0){ return true; } if(transcolor &&