… | |
… | |
357 | |
357 | |
358 | Display *dpy = s->display->dpy; |
358 | Display *dpy = s->display->dpy; |
359 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
359 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
360 | |
360 | |
361 | // loop should not be needed for brightness, as only -1..1 makes sense |
361 | // loop should not be needed for brightness, as only -1..1 makes sense |
362 | |
|
|
363 | while (r | g | b | a) |
362 | //while (r | g | b | a) |
364 | { |
363 | { |
365 | unsigned short xr, xg, xb, xa; |
364 | unsigned short xr, xg, xb, xa; |
366 | XRenderColor mask_c; |
365 | XRenderColor mask_c; |
367 | |
366 | |
368 | if (extract (0, 65535, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
367 | if (extract (0, 65535, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
… | |
… | |
370 | |
369 | |
371 | if (extract (-65535, 0, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
370 | if (extract (-65535, 0, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
372 | { |
371 | { |
373 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
374 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
375 | mask_c.red = -mask_c.red; |
374 | mask_c.red = -mask_c.red; //TODO: verify that doing clamp, assign, and negation does the right thing |
376 | mask_c.green = -mask_c.green; |
375 | mask_c.green = -mask_c.green; |
377 | mask_c.blue = -mask_c.blue; |
376 | mask_c.blue = -mask_c.blue; |
378 | mask_c.alpha = -mask_c.alpha; |
377 | mask_c.alpha = -mask_c.alpha; |
379 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
380 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
379 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
… | |
… | |
395 | } |
394 | } |
396 | |
395 | |
397 | unshare (); |
396 | unshare (); |
398 | |
397 | |
399 | Display *dpy = s->display->dpy; |
398 | Display *dpy = s->display->dpy; |
400 | Picture src = create_xrender_mask (dpy, pm, True); |
|
|
401 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
399 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
402 | |
400 | |
403 | XRenderColor mask_c; |
401 | XRenderColor mask_c; |
404 | mask_c.red = r; |
402 | mask_c.red = r; |
405 | mask_c.green = g; |
403 | mask_c.green = g; |
406 | mask_c.blue = b; |
404 | mask_c.blue = b; |
407 | mask_c.alpha = a; |
405 | mask_c.alpha = a; |
408 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
406 | XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h); |
409 | |
407 | |
410 | XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
|
|
411 | |
|
|
412 | XRenderFreePicture (dpy, src); |
|
|
413 | XRenderFreePicture (dpy, dst); |
408 | XRenderFreePicture (dpy, dst); |
414 | } |
409 | } |
415 | |
410 | |
416 | rxvt_img * |
411 | rxvt_img * |
417 | rxvt_img::clone () |
412 | rxvt_img::clone () |