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.16 by root, Wed Jul 13 00:51:47 2005 UTC vs.
Revision 1.18 by root, Thu Aug 11 02:05:07 2005 UTC

171 depth = DefaultDepth (display, screen); 171 depth = DefaultDepth (display, screen);
172 172
173 int fd = XConnectionNumber (display); 173 int fd = XConnectionNumber (display);
174 174
175#ifndef NO_SLOW_LINK_SUPPORT 175#ifndef NO_SLOW_LINK_SUPPORT
176 // try to detetc wether we have a local connection. 176 // try to detect wether we have a local connection.
177 // assume unix domains socket == local, everything else not 177 // assume unix domains socket == local, everything else not
178 // TODO: might want to check for inet/127.0.0.1 178 // TODO: might want to check for inet/127.0.0.1
179 is_local = 0; 179 is_local = 0;
180 sockaddr_un sa; 180 sockaddr_un sa;
181 socklen_t sl = sizeof (sa); 181 socklen_t sl = sizeof (sa);
474} 474}
475 475
476rxvt_color 476rxvt_color
477rxvt_color::fade (rxvt_display *display, int percent) 477rxvt_color::fade (rxvt_display *display, int percent)
478{ 478{
479 percent = 100 - percent;
480
479 unsigned short cr, cg, cb; 481 unsigned short cr, cg, cb;
480 rxvt_color faded; 482 rxvt_color faded;
481 483
482 get (display, cr, cg, cb); 484 get (display, cr, cg, cb);
485
483 faded.set (display, 486 faded.set (
487 display,
484 cr * percent / 100, 488 cr * percent / 100,
485 cg * percent / 100, 489 cg * percent / 100,
486 cb * percent / 100); 490 cb * percent / 100
491 );
487 492
488 return faded; 493 return faded;
489} 494}
490 495
496#define LERP(a,b,p) (a * p / 100 + b * (100 - p) / 100)
497
498rxvt_color
499rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto)
500{
501 percent = 100 - percent;
502
503 unsigned short cr, cg, cb;
504 unsigned short fcr, fcg, fcb;
505 rxvt_color faded;
506
507 get (display, cr, cg, cb);
508 fadeto.get(display, fcr, fcg, fcb);
509
510 faded.set (
511 display,
512 LERP (cr, fcr, percent),
513 LERP (cg, fcg, percent),
514 LERP (cb, fcb, percent)
515 );
516
517 return faded;
518}
519

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines