ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtimg.C (file contents):
Revision 1.22 by sf-exg, Tue Jun 5 15:18:23 2012 UTC vs.
Revision 1.24 by sf-exg, Tue Jun 5 18:52:48 2012 UTC

212 mask_c.blue = float_to_component (b); 212 mask_c.blue = float_to_component (b);
213 mask_c.alpha = float_to_component (a); 213 mask_c.alpha = float_to_component (a);
214 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); 214 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1);
215 215
216 XRenderComposite (dpy, PictOpAdd, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); 216 XRenderComposite (dpy, PictOpAdd, src, None, dst, 0, 0, 0, 0, 0, 0, w, h);
217
218 XRenderFreePicture (dpy, src);
219 XRenderFreePicture (dpy, dst);
217} 220}
218 221
219void 222void
220rxvt_img::contrast (double r, double g, double b, double a) 223rxvt_img::contrast (double r, double g, double b, double a)
221{ 224{
232 mask_c.blue = float_to_component (b); 235 mask_c.blue = float_to_component (b);
233 mask_c.alpha = float_to_component (a); 236 mask_c.alpha = float_to_component (a);
234 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); 237 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1);
235 238
236 XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); 239 XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h);
240
241 XRenderFreePicture (dpy, src);
242 XRenderFreePicture (dpy, dst);
237} 243}
238 244
239bool 245bool
240rxvt_img::render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y) 246rxvt_img::render_pixbuf (GdkPixbuf *pixbuf, int src_x, int src_y, int width, int height, int dst_x, int dst_y)
241{ 247{
445 XRenderFreePicture (dpy, dst); 451 XRenderFreePicture (dpy, dst);
446 452
447 return img; 453 return img;
448} 454}
449 455
456rxvt_img *
457rxvt_img::blend (rxvt_img *img, double factor)
458{
459 rxvt_img *img2 = clone ();
460 Display *dpy = s->display->dpy;
461 Picture src = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0);
462 Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0);
463 Picture mask = create_xrender_mask (dpy, img->pm, False);
464
465 XRenderColor mask_c;
466
467 mask_c.alpha = float_to_component (factor);
468 mask_c.red =
469 mask_c.green =
470 mask_c.blue = 0;
471 XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1);
472
473 XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, w, h);
474
475 XRenderFreePicture (dpy, src);
476 XRenderFreePicture (dpy, dst);
477 XRenderFreePicture (dpy, mask);
478
479 return img2;
480}
481
450#endif 482#endif
451 483

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines