Added shadow_blur property to fonts

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@846 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-05-16 19:26:11 +00:00
parent ec174fc2a7
commit 36c7e3ef43
4 changed files with 5 additions and 1 deletions
+1
View File
@@ -18,6 +18,7 @@ A reference to a normal [[type:font]] for drawing text.
| @shadow color@ [[type:scriptable]] [[type:color]] @rgb(0,0,0)@ Color for a shadow below the text. | @shadow color@ [[type:scriptable]] [[type:color]] @rgb(0,0,0)@ Color for a shadow below the text.
| @shadow displacement x@ [[type:double]] @0@ Relative position of the shadow in pixels. A shadow is only drawn if the displacement is nonzero. | @shadow displacement x@ [[type:double]] @0@ Relative position of the shadow in pixels. A shadow is only drawn if the displacement is nonzero.
| @shadow displacement y@ [[type:double]] @0@ ^^^ | @shadow displacement y@ [[type:double]] @0@ ^^^
| @shadow blur@ [[type:double]] @0@ How much should the shadow be blurred?
| @separator color@ [[type:color]] @rgb(128,128,128)@ Color for @"<sep-soft>"@ tags inserted by the [[fun:combined_editor]] function. | @separator color@ [[type:color]] @rgb(128,128,128)@ Color for @"<sep-soft>"@ tags inserted by the [[fun:combined_editor]] function.
--Example-- --Example--
+2
View File
@@ -18,6 +18,7 @@ Font::Font()
, scale_down_to(100000) , scale_down_to(100000)
, max_stretch(1.0) , max_stretch(1.0)
, shadow_displacement(0,0) , shadow_displacement(0,0)
, shadow_blur(0)
, separator_color(128,128,128) , separator_color(128,128,128)
, flags(FONT_NORMAL) , flags(FONT_NORMAL)
{} {}
@@ -117,5 +118,6 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
REFLECT_N("shadow_displacement_x", shadow_displacement.width); REFLECT_N("shadow_displacement_x", shadow_displacement.width);
REFLECT_N("shadow_displacement_y", shadow_displacement.height); REFLECT_N("shadow_displacement_y", shadow_displacement.height);
REFLECT(shadow_color); REFLECT(shadow_color);
REFLECT(shadow_blur);
REFLECT(separator_color); REFLECT(separator_color);
} }
+1
View File
@@ -43,6 +43,7 @@ class Font : public IntrusivePtrBase<Font> {
Scriptable<Color> color; ///< Color to use Scriptable<Color> color; ///< Color to use
Scriptable<Color> shadow_color; ///< Color for shadow Scriptable<Color> shadow_color; ///< Color for shadow
RealSize shadow_displacement; ///< Position of the shadow RealSize shadow_displacement; ///< Position of the shadow
double shadow_blur; ///< Blur radius of the shadow
Color separator_color; ///< Color for <sep> text Color separator_color; ///< Color for <sep> text
int flags; ///< FontFlags for this font int flags; ///< FontFlags for this font
+1 -1
View File
@@ -229,7 +229,7 @@ void RotatedDC::DrawText (const String& text, const RealPoint& pos, int blur_ra
void RotatedDC::DrawTextWithShadow(const String& text, const Font& font, const RealPoint& pos, double scale, double stretch) { void RotatedDC::DrawTextWithShadow(const String& text, const Font& font, const RealPoint& pos, double scale, double stretch) {
if (font.hasShadow()) { if (font.hasShadow()) {
SetTextForeground(font.shadow_color); SetTextForeground(font.shadow_color);
DrawText(text, pos + font.shadow_displacement * scale, 0, 1, stretch); DrawText(text, pos + font.shadow_displacement * scale, font.shadow_blur * scale, 1, stretch);
} }
SetTextForeground(font.color); SetTextForeground(font.color);
DrawText(text, pos, 0, 1, stretch); DrawText(text, pos, 0, 1, stretch);