From 887f9688a47b6564622a46c116879c4ca2c5add7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 24 Feb 2009 11:07:22 +0000 Subject: [PATCH] Improved the look of the icon label outline, at least the white text version should look much better now. Not so sure about the dark text version, but if you don't want that, just make sure your desktop bg color is dark enough to get white text. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29310 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/TextWidget.cpp | 56 +++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/src/kits/tracker/TextWidget.cpp b/src/kits/tracker/TextWidget.cpp index 4e32205ec8..58fdfe748f 100644 --- a/src/kits/tracker/TextWidget.cpp +++ b/src/kits/tracker/TextWidget.cpp @@ -517,33 +517,55 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view, // draw a halo around the text by using the "false bold" // feature for text rendering. Either black or white is used for // the glow (whatever acts as contrast) with a some alpha value, - // two passes are used to achive a blur effect drawView->SetDrawingMode(B_OP_ALPHA); drawView->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY); BFont font; drawView->GetFont(&font); -// NOTE: commented out first pass for halo, since just a plain -// outline looks better IMHO -stippi -// font.SetFalseBoldWidth(2.0); -// drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + rgb_color textColor = drawView->HighColor(); - rgb_color glow = textColor.red - + textColor.green + textColor.blue > 128 * 3 ? kBlack : kWhite; -// glow.alpha = 40; -// drawView->SetHighColor(glow); + rgb_color outlineColor; + if (textColor.red + textColor.green + textColor.blue < 128 * 3) { + // dark text on light outline + rgb_color glowColor = kWhite; -// drawView->DrawString(fittingText, loc); + font.SetFalseBoldWidth(2.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + glowColor.alpha = 30; + drawView->SetHighColor(glowColor); - font.SetFalseBoldWidth(1.0); - drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); - glow.alpha = 220; - drawView->SetHighColor(glow); + drawView->DrawString(fittingText, loc); - drawView->DrawString(fittingText, loc); + font.SetFalseBoldWidth(1.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + glowColor.alpha = 65; + drawView->SetHighColor(glowColor); - font.SetFalseBoldWidth(0.0); - drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + drawView->DrawString(fittingText, loc); + + font.SetFalseBoldWidth(0.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + } else { + // light text on dark outline + rgb_color outlineColor = kBlack; + + font.SetFalseBoldWidth(1.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + outlineColor.alpha = 30; + drawView->SetHighColor(outlineColor); + + drawView->DrawString(fittingText, loc); + + font.SetFalseBoldWidth(0.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + + outlineColor.alpha = 200; + drawView->SetHighColor(outlineColor); + + drawView->DrawString(fittingText, loc + BPoint(1, 1)); + } + + drawView->SetDrawingMode(B_OP_OVER); drawView->SetHighColor(textColor); } #endif // __HAIKU__