]> Dogcows Code - chaz/openbox/commitdiff
Allow variable tinting of the shadow. Use *.xft.tint: integer
authorScott Moynes <smoynes@nexus.carleton.ca>
Wed, 23 Oct 2002 02:46:47 +0000 (02:46 +0000)
committerScott Moynes <smoynes@nexus.carleton.ca>
Wed, 23 Oct 2002 02:46:47 +0000 (02:46 +0000)
integer is a number -100 to 100 that specifies the alpha channel, with
negative numbers meaning lighten the background and positive being
darken.

src/Font.cc
src/Font.hh
src/Screen.cc

index ea70933acffbb1630841784d799b552de7788b02..4699350c2d22f90af0e30e349993c944479596d0 100644 (file)
@@ -49,7 +49,7 @@ string      BFont::_fallback_font   = "fixed";
 #ifdef XFT
 BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
              bool bold, bool italic, bool shadow, unsigned char offset, 
-             unsigned char tint, bool antialias) :
+             int tint, bool antialias) :
                                           _display(d),
                                           _screen(screen),
                                           _family(family),
@@ -265,14 +265,22 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color,
                                   _screen->getColormap());
     assert(draw);
 
+
     if (_shadow) {
       XftColor c;
-      c.color.red = 0;
-      c.color.green = 0;
-      c.color.blue = 0;
-      c.color.alpha = _tint | _tint << 8; // transparent shadow
-      c.pixel = BlackPixel(_display, _screen->getScreenNumber());
-
+      if (_tint >= 0) {
+        c.color.red = 0;
+        c.color.green =  0;
+        c.color.blue = 0;
+        c.color.alpha = 0xffff * _tint/100; // transparent shadow
+        c.pixel = BlackPixel(_display, _screen->getScreenNumber());
+      } else {
+        c.color.red = 0xffff * -_tint/100;
+        c.color.green = 0xffff * -_tint/100;
+        c.color.blue = 0xffff * -_tint/100;
+        c.color.alpha = 0xffff * -_tint/100;
+        c.pixel = WhitePixel(_display, _screen->getScreenNumber());
+      }
 #ifdef XFT_UTF8
       XftDrawStringUtf8(
 #else
index 8f3856b61de30570f19f6d9ac0f87479be024f50..6f6431ef276af8d83723a0f677f79c6a34678600 100644 (file)
@@ -73,7 +73,7 @@ private:
   bool              _antialias;
   bool              _shadow;
   unsigned char     _offset;
-  unsigned char     _tint;
+  int               _tint;
 
   XftFont          *_xftfont;
 
@@ -99,7 +99,7 @@ public:
   // loads an Xft font
   BFont(Display *d, BScreen *screen, const std::string &family, int size,
         bool bold, bool italic, bool shadow, unsigned char offset, 
-        unsigned char tint, bool antialias = True);
+        int tint, bool antialias = True);
 #endif
   // loads a standard X font
   BFont(Display *d, BScreen *screen, const std::string &xlfd);
index 70494cab38132a0b1916f96a258f1ad7726e5d6b..165a4a93c8f058ce905c00dddeceb53ce81e3cfc 100644 (file)
@@ -2750,11 +2750,13 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
         offset = 1;
     }
 
-    unsigned char tint = 0x40;
+    int tint = 25;
     if (style.getValue(rbasename + "xft.shadow.tint", s)) {
       tint = atoi(s.c_str());
     }
 
+    if (tint > 100) tint = 100;
+    if (tint < -100) tint = -100;
     
     BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
                          italic, dropShadow && resource.shadow_fonts, offset, 
This page took 0.027436 seconds and 4 git commands to generate.