summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Moynes <smoynes@nexus.carleton.ca>2002-10-23 02:46:47 +0000
committerScott Moynes <smoynes@nexus.carleton.ca>2002-10-23 02:46:47 +0000
commit1e36acfd9198a7d8cbad4eef094e15a03eebc291 (patch)
tree22d51d982f5f0ecd2630d4480bd4ea5b4a9fc5ab /src
parentdc4957eed8ea4844dc7bdba0830b7bbd95be3fd2 (diff)
Allow variable tinting of the shadow. Use *.xft.tint: integer
integer is a number -100 to 100 that specifies the alpha channel, with negative numbers meaning lighten the background and positive being darken.
Diffstat (limited to 'src')
-rw-r--r--src/Font.cc22
-rw-r--r--src/Font.hh4
-rw-r--r--src/Screen.cc4
3 files changed, 20 insertions, 10 deletions
diff --git a/src/Font.cc b/src/Font.cc
index ea70933a..4699350c 100644
--- a/src/Font.cc
+++ b/src/Font.cc
@@ -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
diff --git a/src/Font.hh b/src/Font.hh
index 8f3856b6..6f6431ef 100644
--- a/src/Font.hh
+++ b/src/Font.hh
@@ -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);
diff --git a/src/Screen.cc b/src/Screen.cc
index 70494cab..165a4a93 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -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,