Adding alpha gradient patch

This commit is contained in:
bakkeby 2021-02-15 14:37:37 +01:00
parent a23971fff1
commit 99903c67d9
4 changed files with 20 additions and 3 deletions

View File

@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
2021-02-15 - Added the alpha gradient patch
2020-11-14 - Added the wide glyphs patch
2020-10-23 - Added the monochrome patch
@ -99,6 +101,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [~force-redraw-after-keypress~](https://lists.suckless.org/hackers/2004/17221.html)
- ~this patch forces the terminal to check for new data on the tty on keypress with the aim of reducing input latency~
- [gradient](https://st.suckless.org/patches/gradient/)
- adds gradient transparency to st
- depends on the alpha patch
- [hidecursor](https://st.suckless.org/patches/hidecursor/)
- hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window

View File

@ -124,6 +124,10 @@ unsigned int tabspaces = 8;
#if ALPHA_PATCH
/* bg opacity */
float alpha = 0.8;
#if ALPHA_GRADIENT_PATCH
float grad_alpha = 0.54; //alpha value that'll change
float stat_alpha = 0.46; //constant alpha value that'll get added to grad_alpha
#endif // ALPHA_GRADIENT_PATCH
#endif // ALPHA_PATCH
/* Terminal colors (16 first used in escape sequence) */

View File

@ -13,7 +13,7 @@ X11LIB = /usr/X11R6/lib
PKG_CONFIG = pkg-config
# Uncomment this for the alpha patch / ALPHA_PATCH
#XRENDER = -lXrender
XRENDER = -lXrender
# Uncomment this for the themed cursor patch / THEMED_CURSOR_PATCH
#XCURSOR = -lXcursor
@ -36,8 +36,8 @@ STLDFLAGS = $(LIBS) $(LDFLAGS)
# OpenBSD:
#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
# `$(PKG_CONFIG) --libs fontconfig` \
# `$(PKG_CONFIG) --libs freetype2`
# `pkg-config --libs fontconfig` \
# `pkg-config --libs freetype2`
# compiler and linker
# CC = c99

7
x.c
View File

@ -1729,6 +1729,13 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
}
#endif // INVERT_PATCH
#if ALPHA_PATCH && ALPHA_GRADIENT_PATCH
// gradient
bg->color.alpha = grad_alpha * 0xffff * (win.h - y*win.ch) / win.h + stat_alpha * 0xffff;
// uncomment to invert the gradient
// bg->color.alpha = grad_alpha * 0xffff * (y*win.ch) / win.h + stat_alpha * 0xffff;
#endif // ALPHA_PATCH | ALPHA_GRADIENT_PATCH
#if WIDE_GLYPHS_PATCH
if (dmode & DRAW_BG) {
#endif // WIDE_GLYPHS_PATCH