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

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.17 by root, Fri Aug 5 16:42:44 2005 UTC vs.
Revision 1.20 by root, Fri Jan 6 02:11:15 2006 UTC

279 XNextEvent (display, &xev); 279 XNextEvent (display, &xev);
280 280
281#ifdef USE_XIM 281#ifdef USE_XIM
282 if (!XFilterEvent (&xev, None)) 282 if (!XFilterEvent (&xev, None))
283 { 283 {
284
285 if (xev.type == PropertyNotify 284 if (xev.type == PropertyNotify
286 && xev.xany.window == root 285 && xev.xany.window == root
287 && xev.xproperty.atom == xa_xim_servers) 286 && xev.xproperty.atom == xa_xim_servers)
288 im_change_check (); 287 im_change_check ();
289#endif 288#endif
474} 473}
475 474
476rxvt_color 475rxvt_color
477rxvt_color::fade (rxvt_display *display, int percent) 476rxvt_color::fade (rxvt_display *display, int percent)
478{ 477{
478 percent = 100 - percent;
479
479 unsigned short cr, cg, cb; 480 unsigned short cr, cg, cb;
480 rxvt_color faded; 481 rxvt_color faded;
481 482
482 get (display, cr, cg, cb); 483 get (display, cr, cg, cb);
484
483 faded.set (display, 485 faded.set (
486 display,
484 cr * percent / 100, 487 cr * percent / 100,
485 cg * percent / 100, 488 cg * percent / 100,
486 cb * percent / 100); 489 cb * percent / 100
490 );
487 491
488 return faded; 492 return faded;
489} 493}
490 494
495#define LERP(a,b,p) (a * p + b * (100 - p)) / 100
496
497rxvt_color
498rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto)
499{
500 percent = 100 - percent;
501
502 unsigned short cr, cg, cb;
503 unsigned short fcr, fcg, fcb;
504 rxvt_color faded;
505
506 get (display, cr, cg, cb);
507 fadeto.get(display, fcr, fcg, fcb);
508
509 faded.set (
510 display,
511 LERP (cr, fcr, percent),
512 LERP (cg, fcg, percent),
513 LERP (cb, fcb, percent)
514 );
515
516 return faded;
517}
518

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines