… | |
… | |
356 | unshare (); |
356 | unshare (); |
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 | while (r | g | b | a) |
362 | //while (r | g | b | a) |
362 | { |
363 | { |
363 | unsigned short xr, xg, xb, xa; |
364 | unsigned short xr, xg, xb, xa; |
364 | XRenderColor mask_c; |
365 | XRenderColor mask_c; |
365 | |
366 | |
366 | 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)) |
… | |
… | |
368 | |
369 | |
369 | 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)) |
370 | { |
371 | { |
371 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | 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 |
374 | mask_c.green = -mask_c.green; |
375 | mask_c.green = -mask_c.green; |
375 | mask_c.blue = -mask_c.blue; |
376 | mask_c.blue = -mask_c.blue; |
376 | mask_c.alpha = -mask_c.alpha; |
377 | mask_c.alpha = -mask_c.alpha; |
377 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
379 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
… | |
… | |
393 | } |
394 | } |
394 | |
395 | |
395 | unshare (); |
396 | unshare (); |
396 | |
397 | |
397 | Display *dpy = s->display->dpy; |
398 | Display *dpy = s->display->dpy; |
398 | Picture src = create_xrender_mask (dpy, pm, True); |
|
|
399 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
399 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
400 | |
400 | |
401 | XRenderColor mask_c; |
401 | XRenderColor mask_c; |
402 | mask_c.red = r; |
402 | mask_c.red = r; |
403 | mask_c.green = g; |
403 | mask_c.green = g; |
404 | mask_c.blue = b; |
404 | mask_c.blue = b; |
405 | mask_c.alpha = a; |
405 | mask_c.alpha = a; |
406 | XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); |
406 | XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h); |
407 | |
407 | |
408 | XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
|
|
409 | |
|
|
410 | XRenderFreePicture (dpy, src); |
|
|
411 | XRenderFreePicture (dpy, dst); |
408 | XRenderFreePicture (dpy, dst); |
412 | } |
409 | } |
413 | |
410 | |
414 | rxvt_img * |
411 | rxvt_img * |
415 | rxvt_img::clone () |
412 | rxvt_img::clone () |