st

Luke's fork of the suckless terminal: vim-bindings, Xresrouces colors, transparency
Log | Files | Refs | README | LICENSE

commit e2046555c069d283638edadf4e521dddde74c4fb
parent d06bf1fd7ecb066d0b1838fc6e34a3d341df410f
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Thu, 23 May 2019 23:02:08 -0400

Merge pull request #88 from lucaslugao/master

Premultiply background RGB values if alpha is used
Diffstat:
Mx.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/x.c b/x.c @@ -784,9 +784,15 @@ xloadcols(void) /* set alpha value of bg color */ if (opt_alpha) alpha = strtof(opt_alpha, NULL); - dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); - dc.col[defaultbg].pixel &= 0x00FFFFFF; - dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); + dc.col[defaultbg].color.red = + ((unsigned short)(dc.col[defaultbg].color.red * alpha)) & 0xff00; + dc.col[defaultbg].color.green = + ((unsigned short)(dc.col[defaultbg].color.green * alpha)) & 0xff00; + dc.col[defaultbg].color.blue = + ((unsigned short)(dc.col[defaultbg].color.blue * alpha)) & 0xff00; + dc.col[defaultbg].pixel &= 0x00FFFFFF; + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; loaded = 1; }