From 7e0e9ef179032fdda6030f47f57b14abf7159fc1 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Thu, 19 Feb 2009 02:51:32 +0000
Subject: Mantis#3188. Thank you kindly, BlueWall, for a patch that: Adding the
 ability to set the background color for osSetDynamicTextureData in the extra
 data: bgcolour:value (see
 http://msdn.microsoft.com/en-us/library/aa358802.aspx [^] for color names)

---
 CONTRIBUTORS.txt                                   |  1 +
 .../Scripting/VectorRender/VectorRenderModule.cs   | 52 ++++++++++++++++++++--
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 28ede78..6b3cbd0 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -41,6 +41,7 @@ Patches
 * alex_carnell
 * awebb (IBM)
 * BigFootAg
+* BlueWall Slade
 * brianw/Sir_Ahzz
 * CharlieO
 * ChrisDown
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index c3e39ad..86f836c 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -147,6 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
             int width = 256;
             int height = 256;
             int alpha = 255; // 0 is transparent
+			Color bgColour = Color.White;  // Default background color
             
             char[] paramDelimiter = { ',' };
             char[] nvpDelimiter = { ':' };
@@ -229,6 +230,18 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
                               }
                           }
                           break;
+					 case "bgcolour":
+						 int hex = 0;
+		                 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
+		                 {
+		                     bgColour = Color.FromArgb(hex);
+		                 } 
+		                 else
+		                 {
+		                     
+		                     bgColour = Color.FromName(value);
+		                 }
+					     break;	
                      case "":
                          // blank string has been passed do nothing just use defaults
                      break;
@@ -266,10 +279,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
             Graphics graph = Graphics.FromImage(bitmap);
 
             // this is really just to save people filling the 
-            // background white in their scripts, only do when fully opaque
-            if (alpha == 255) 
+            // background color in their scripts, only do when fully opaque
+            if (alpha == 255)
             {
-                graph.FillRectangle(new SolidBrush(Color.White), 0, 0, width, height); 
+				graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); 
+             
             }
 
             for (int w = 0; w < bitmap.Width; w++)
@@ -448,6 +462,38 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
                     fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture);
                     myFont = new Font(fontName, fontSize);
                 }
+				else if (nextLine.StartsWith("FontProp"))
+				{
+					nextLine = nextLine.Remove(0, 8);
+                    nextLine = nextLine.Trim();
+
+					string [] fprops = nextLine.Split(partsDelimiter);
+					foreach (string prop in  fprops) {
+						
+						switch (prop)
+						{
+							case "B":
+							    if(!(myFont.Bold))
+								    myFont = new Font(myFont, myFont.Style | FontStyle.Bold);
+							break;
+							case "I":
+							    if(!(myFont.Italic))
+								    myFont = new Font(myFont, myFont.Style | FontStyle.Italic);
+							break;
+							case "U":
+							    if(!(myFont.Underline))
+								    myFont = new Font(myFont, myFont.Style | FontStyle.Underline);
+							break;
+						    case "S":
+							    if(!(myFont.Strikeout))
+								    myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
+							break;
+						    case "R":
+								myFont = new Font(myFont, FontStyle.Regular);
+							break;
+						}
+					}
+				}
                 else if (nextLine.StartsWith("FontName"))
                 {
                     nextLine = nextLine.Remove(0, 8);
-- 
cgit v1.1