diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 7 |
2 files changed, 12 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2007-01-26 Philipp Sehmisch <tmw@crushnet.org> + + * scr/gui/truetypefont.cpp: Added support for alpha blending to + true type font rendering. + 2007-01-24 Philipp Sehmisch <tmw@crushnet.org> * src/net/beinghandler.cpp, src/resources/spritedef.h: Fixed 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); } |