diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-01-26 01:52:46 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-01-26 01:52:46 +0000 |
commit | 89a1dcb59be3e531cc0761c32d1aa70e141d4a12 (patch) | |
tree | 637c2728757532a60b1f6886d2bf5e0fe0d0a211 /src | |
parent | 90c0fb74a317e9c4181d35fead0c7c67e653d9ad (diff) | |
download | mana-client-89a1dcb59be3e531cc0761c32d1aa70e141d4a12.tar.gz mana-client-89a1dcb59be3e531cc0761c32d1aa70e141d4a12.tar.bz2 mana-client-89a1dcb59be3e531cc0761c32d1aa70e141d4a12.tar.xz mana-client-89a1dcb59be3e531cc0761c32d1aa70e141d4a12.zip |
Added support for alpha blending to true type font drawing.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/truetypefont.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 91c86da9..82c55413 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -130,6 +130,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, } gcn::Color col = g->getColor(); + float alpha = 1.0f; + if (col.a != 255) alpha = col.a / 255.0f; + col.a = 255; + /* alpha value is ignored at sting generation so it makes no sense to + * cache the same text with different alpha values. + */ TextChunk chunk(text, col); @@ -157,6 +163,7 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, cache.front().generate(mFont); } + if (alpha != 1.0f) cache.front().img->setAlpha(alpha); g->drawImage(cache.front().img, x, y); } |