Commit 77881a72 authored by twanvl's avatar twanvl

Added shadow_blur property to fonts

parent cf13517f
......@@ -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 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 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.
--Example--
......
......@@ -18,6 +18,7 @@ Font::Font()
, scale_down_to(100000)
, max_stretch(1.0)
, shadow_displacement(0,0)
, shadow_blur(0)
, separator_color(128,128,128)
, flags(FONT_NORMAL)
{}
......@@ -117,5 +118,6 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
REFLECT_N("shadow_displacement_x", shadow_displacement.width);
REFLECT_N("shadow_displacement_y", shadow_displacement.height);
REFLECT(shadow_color);
REFLECT(shadow_blur);
REFLECT(separator_color);
}
......@@ -43,6 +43,7 @@ class Font : public IntrusivePtrBase<Font> {
Scriptable<Color> color; ///< Color to use
Scriptable<Color> shadow_color; ///< Color for shadow
RealSize shadow_displacement; ///< Position of the shadow
double shadow_blur; ///< Blur radius of the shadow
Color separator_color; ///< Color for <sep> text
int flags; ///< FontFlags for this font
......
......@@ -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) {
if (font.hasShadow()) {
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);
DrawText(text, pos, 0, 1, stretch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment