diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-01-26 01:52:46 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-05 22:17:49 -0700 |
commit | c5331a575468ee94b4cde35d157b74d9776676e5 (patch) | |
tree | 9d0969e3906364a674c4ef6ae3a0a1785815ff82 /src | |
parent | 97fb7026570f60bd3286c27e6049e19f08baa35e (diff) | |
download | mana-c5331a575468ee94b4cde35d157b74d9776676e5.tar.gz mana-c5331a575468ee94b4cde35d157b74d9776676e5.tar.bz2 mana-c5331a575468ee94b4cde35d157b74d9776676e5.tar.xz mana-c5331a575468ee94b4cde35d157b74d9776676e5.zip |
Added support for alpha blending to true type font drawing.
(cherry picked from mainline commit 89a1dcb59be3e531cc0761c32d1aa70e141d4a12)
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 3986cca5..82a22bc2 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); } |