From 1e36acfd9198a7d8cbad4eef094e15a03eebc291 Mon Sep 17 00:00:00 2001 From: Scott Moynes Date: Wed, 23 Oct 2002 02:46:47 +0000 Subject: 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. --- src/Font.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/Font.cc') 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 -- cgit v1.2.3