fixed alpha blending for 'radial' inner circle

This commit is contained in:
Jarcode
2018-02-11 11:42:26 -08:00
parent 79b99b09be
commit 3df89da8bb
3 changed files with 6 additions and 6 deletions

View File

@@ -784,10 +784,10 @@ struct renderer* rd_new(const char** paths, const char* entry, const char* force
#ifdef GLFW_TRANSPARENT_FRAMEBUFFER
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, native_opacity ? GLFW_TRUE : GLFW_FALSE);
if (native_opacity) gl->use_alpha = false;
// if (native_opacity) gl->use_alpha = false;
#elif GLFW_TRANSPARENT
glfwWindowHint(GLFW_TRANSPARENT, native_opacity ? GLFW_TRUE : GLFW_FALSE);
if (native_opacity) gl->use_alpha = false;
// if (native_opacity) gl->use_alpha = false;
#else
if (native_opacity)
printf("WARNING: the linked version of GLFW3 does not have transparency support"

View File

@@ -32,7 +32,7 @@ void main() {
#if USE_ALPHA > 0
#define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - f.a), max(c.a, f.a))
fragment.a = 0;
fragment.a;
#else
#define APPLY_FRAG(f, c) f = c
#endif
@@ -46,9 +46,9 @@ void main() {
float theta = atan(dy, dx); /* fragment angle with the center of the screen as the origin */
float d = sqrt((dx * dx) + (dy * dy)); /* distance */
if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) {
fragment = OUTLINE;
APPLY_FRAG(fragment, OUTLINE);
#if USE_ALPHA > 0
fragment.a *= ((float(C_LINE) / 2.0F) - abs(d - C_RADIUS)) * C_ALIAS_FACTOR;
fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1);
#else
return; /* return immediately if there is no alpha blending available */
#endif

View File

@@ -55,7 +55,7 @@
/* Window background color (RGB format).
Only works with `setopacity "none"` */
#request setbg 3C3C3C
#request setbg 000000
/* (X11 only) EWMH Window type. Possible values are: