Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new effect suggestion: dim #102

Open
redxtech opened this issue Mar 26, 2023 · 1 comment
Open

new effect suggestion: dim #102

redxtech opened this issue Mar 26, 2023 · 1 comment

Comments

@redxtech
Copy link

i used to use a fork of i3lock that had a dimblur effect option.

it would be great to be able to combine the existing blur effect with a new dim effect.

would this be reasonable to add?

@CcydtN
Copy link

CcydtN commented Oct 13, 2023

I think you can achieve a similar effect using effect-vignette.
Set "factor" as 0 and "base" as the dim ratio (0 -- black, 1 -- original color)

Here is a clip of the related code, you can look at it and see if it match your needs.
If you want more detail, this code is in effect.c, at line 326.

double xf = (x * 1.0) / width;
double yf = (y * 1.0) / height;
double vignette_factor = base + factor * 16 * xf * yf * (1.0 - xf) * (1.0 - yf);

r = (int)(r * vignette_factor) & 0xFF;
g = (int)(g * vignette_factor) & 0xFF;
b = (int)(b * vignette_factor) & 0xFF;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants