From 719ee36f5c57423e41078d7ddd57f0f56fa2cbaf Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 27 Jul 2014 11:05:49 +0200 Subject: [PATCH] Canvas: backdrop/stroke option for text (based on Gijs patch). --- simgear/canvas/elements/CanvasText.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/simgear/canvas/elements/CanvasText.cxx b/simgear/canvas/elements/CanvasText.cxx index d99760a3..6ef37819 100644 --- a/simgear/canvas/elements/CanvasText.cxx +++ b/simgear/canvas/elements/CanvasText.cxx @@ -38,6 +38,7 @@ namespace canvas void setCharacterAspect(float aspect); void setLineHeight(float factor); void setFill(const std::string& fill); + void setStroke(const std::string& color); void setBackgroundColor(const std::string& fill); SGVec2i sizeForWidth(int w) const; @@ -88,6 +89,19 @@ namespace canvas setColor( color ); } + //---------------------------------------------------------------------------- + void Text::TextOSG::setStroke(const std::string& stroke) + { + osg::Vec4 color; + if( stroke == "none" || !parseColor(stroke, color) ) + setBackdropType(NONE); + else + { + setBackdropType(OUTLINE); + setBackdropColor(color); + } + } + //---------------------------------------------------------------------------- void Text::TextOSG::setBackgroundColor(const std::string& fill) { @@ -546,6 +560,7 @@ namespace canvas addStyle("fill", "color", &TextOSG::setFill, text); addStyle("background", "color", &TextOSG::setBackgroundColor, text); + addStyle("stroke", "color", &TextOSG::setStroke, text); addStyle("character-size", "numeric", static_cast< -- 2.39.5