summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-01-26 01:52:46 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-29 15:34:58 +0100
commita38a8e56faa33b00c94414bde859e637d096de0d (patch)
treec74c209b6399eaa3af31b84dc7070b3df941bc40 /src/gui
parent883548ac5601a06e680bc0e272b4520ecaf4ff03 (diff)
downloadmana-a38a8e56faa33b00c94414bde859e637d096de0d.tar.gz
mana-a38a8e56faa33b00c94414bde859e637d096de0d.tar.bz2
mana-a38a8e56faa33b00c94414bde859e637d096de0d.tar.xz
mana-a38a8e56faa33b00c94414bde859e637d096de0d.zip
Added support for alpha blending to true type font drawing.
(cherry picked from mainline commit 89a1dcb59be3e531cc0761c32d1aa70e141d4a12)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/truetypefont.cpp7
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);
}