… | |
… | |
317 | |
317 | |
318 | return img; |
318 | return img; |
319 | } |
319 | } |
320 | |
320 | |
321 | static Picture |
321 | static Picture |
322 | create_xrender_mask (Display *dpy, Drawable drawable, Bool argb) |
322 | create_xrender_mask (Display *dpy, Drawable drawable, Bool argb, Bool component_alpha) |
323 | { |
323 | { |
324 | Pixmap pixmap = XCreatePixmap (dpy, drawable, 1, 1, argb ? 32 : 8); |
324 | Pixmap pixmap = XCreatePixmap (dpy, drawable, 1, 1, argb ? 32 : 8); |
325 | |
325 | |
326 | XRenderPictFormat *format = XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8); |
326 | XRenderPictFormat *format = XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8); |
327 | XRenderPictureAttributes pa; |
327 | XRenderPictureAttributes pa; |
328 | pa.repeat = RepeatNormal; |
328 | pa.repeat = RepeatNormal; |
|
|
329 | pa.component_alpha = component_alpha; |
329 | Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); |
330 | Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat | CPComponentAlpha, &pa); |
330 | |
331 | |
331 | XFreePixmap (dpy, pixmap); |
332 | XFreePixmap (dpy, pixmap); |
332 | |
333 | |
333 | return mask; |
334 | return mask; |
334 | } |
335 | } |
… | |
… | |
407 | |
408 | |
408 | Display *dpy = s->display->dpy; |
409 | Display *dpy = s->display->dpy; |
409 | |
410 | |
410 | Picture src = src_picture (); |
411 | Picture src = src_picture (); |
411 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, 0, 0); |
412 | Picture dst = XRenderCreatePicture (dpy, img->pm, format, 0, 0); |
412 | Picture mul = create_xrender_mask (dpy, pm, True); |
413 | Picture mul = create_xrender_mask (dpy, pm, True, True); |
413 | |
|
|
414 | XRenderPictureAttributes pa; |
|
|
415 | pa.component_alpha = 1; |
|
|
416 | XRenderChangePicture (dpy, mul, CPComponentAlpha, &pa); |
|
|
417 | |
414 | |
418 | //TODO: this operator does not yet implement some useful contrast |
415 | //TODO: this operator does not yet implement some useful contrast |
419 | while (r | g | b | a) |
416 | while (r | g | b | a) |
420 | { |
417 | { |
421 | unsigned short xr, xg, xb, xa; |
418 | unsigned short xr, xg, xb, xa; |
… | |
… | |
625 | { |
622 | { |
626 | rxvt_img *img2 = clone (); |
623 | rxvt_img *img2 = clone (); |
627 | Display *dpy = s->display->dpy; |
624 | Display *dpy = s->display->dpy; |
628 | Picture src = img->src_picture (); |
625 | Picture src = img->src_picture (); |
629 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
626 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
630 | |
627 | Picture mask = create_xrender_mask (dpy, img->pm, False, False); |
631 | Pixmap pixmap = XCreatePixmap (dpy, img->pm, 1, 1, 8); |
|
|
632 | XRenderPictFormat *format = XRenderFindStandardFormat (dpy, PictStandardA8); |
|
|
633 | XRenderPictureAttributes pa; |
|
|
634 | pa.repeat = True; |
|
|
635 | Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); |
|
|
636 | XFreePixmap (dpy, pixmap); |
|
|
637 | |
628 | |
638 | XRenderColor mask_c; |
629 | XRenderColor mask_c; |
639 | |
630 | |
640 | mask_c.alpha = float_to_component (factor); |
631 | mask_c.alpha = float_to_component (factor); |
641 | mask_c.red = |
632 | mask_c.red = |