]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: backdrop/stroke option for text (based on Gijs patch).
authorThomas Geymayer <tomgey@gmail.com>
Sun, 27 Jul 2014 09:05:49 +0000 (11:05 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 27 Jul 2014 09:05:49 +0000 (11:05 +0200)
simgear/canvas/elements/CanvasText.cxx

index d99760a35d82eb0c8dab8fcb6c3d84794d3cf1c6..6ef37819d35aed8ea2cfac38eca8a4aae08840c6 100644 (file)
@@ -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<