remove pixelation entirley and remove need for BLUR definition

This commit is contained in:
Jakub 2023-01-03 13:31:26 -05:00
parent 23c155fb1b
commit 83c2201d52
2 changed files with 0 additions and 49 deletions

View File

@ -40,16 +40,9 @@ static XRectangle rectangles[9] = {
{11,4, 1, 2}, {11,4, 1, 2},
}; };
/*Enable blur*/
#define BLUR
/*Set blur radius*/ /*Set blur radius*/
static int blurRadius=5; static int blurRadius=5;
/*Enable Pixelation*/
//#define PIXELATION
/*Set pixelation radius*/
static const int pixelSize=0;
/* /*
* Xresources preferences to load at startup * Xresources preferences to load at startup
*/ */

42
slock.c
View File

@ -553,51 +553,9 @@ main(int argc, char **argv) {
imlib_context_set_drawable(RootWindow(dpy,XScreenNumberOfScreen(scr))); imlib_context_set_drawable(RootWindow(dpy,XScreenNumberOfScreen(scr)));
imlib_copy_drawable_to_image(0,0,0,scr->width,scr->height,0,0,1); imlib_copy_drawable_to_image(0,0,0,scr->width,scr->height,0,0,1);
#ifdef BLUR
/*Blur function*/ /*Blur function*/
imlib_image_blur(blurRadius); imlib_image_blur(blurRadius);
#endif // BLUR
#ifdef PIXELATION
/*Pixelation*/
int width = scr->width;
int height = scr->height;
for(int y = 0; y < height; y += pixelSize)
{
for(int x = 0; x < width; x += pixelSize)
{
int red = 0;
int green = 0;
int blue = 0;
Imlib_Color pixel;
Imlib_Color* pp;
pp = &pixel;
for(int j = 0; j < pixelSize && j < height; j++)
{
for(int i = 0; i < pixelSize && i < width; i++)
{
imlib_image_query_pixel(x+i,y+j,pp);
red += pixel.red;
green += pixel.green;
blue += pixel.blue;
}
}
red /= (pixelSize*pixelSize);
green /= (pixelSize*pixelSize);
blue /= (pixelSize*pixelSize);
imlib_context_set_color(red,green,blue,pixel.alpha);
imlib_image_fill_rectangle(x,y,pixelSize,pixelSize);
red = 0;
green = 0;
blue = 0;
}
}
#endif
/* check for Xrandr support */ /* check for Xrandr support */
rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase); rr.active = XRRQueryExtension(dpy, &rr.evbase, &rr.errbase);