diff options
author | Charles Krinke | 2009-02-19 02:51:32 +0000 |
---|---|---|
committer | Charles Krinke | 2009-02-19 02:51:32 +0000 |
commit | 7e0e9ef179032fdda6030f47f57b14abf7159fc1 (patch) | |
tree | 42ed01f2d029598c88f9582684aba0afd7c55315 /OpenSim/Region/CoreModules | |
parent | Fix region crossing for unscripted prims, avoid costly SEH (diff) | |
download | opensim-SC_OLD-7e0e9ef179032fdda6030f47f57b14abf7159fc1.zip opensim-SC_OLD-7e0e9ef179032fdda6030f47f57b14abf7159fc1.tar.gz opensim-SC_OLD-7e0e9ef179032fdda6030f47f57b14abf7159fc1.tar.bz2 opensim-SC_OLD-7e0e9ef179032fdda6030f47f57b14abf7159fc1.tar.xz |
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)
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 52 |
1 files changed, 49 insertions, 3 deletions
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 | |||
147 | int width = 256; | 147 | int width = 256; |
148 | int height = 256; | 148 | int height = 256; |
149 | int alpha = 255; // 0 is transparent | 149 | int alpha = 255; // 0 is transparent |
150 | Color bgColour = Color.White; // Default background color | ||
150 | 151 | ||
151 | char[] paramDelimiter = { ',' }; | 152 | char[] paramDelimiter = { ',' }; |
152 | char[] nvpDelimiter = { ':' }; | 153 | char[] nvpDelimiter = { ':' }; |
@@ -229,6 +230,18 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
229 | } | 230 | } |
230 | } | 231 | } |
231 | break; | 232 | break; |
233 | case "bgcolour": | ||
234 | int hex = 0; | ||
235 | if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) | ||
236 | { | ||
237 | bgColour = Color.FromArgb(hex); | ||
238 | } | ||
239 | else | ||
240 | { | ||
241 | |||
242 | bgColour = Color.FromName(value); | ||
243 | } | ||
244 | break; | ||
232 | case "": | 245 | case "": |
233 | // blank string has been passed do nothing just use defaults | 246 | // blank string has been passed do nothing just use defaults |
234 | break; | 247 | break; |
@@ -266,10 +279,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
266 | Graphics graph = Graphics.FromImage(bitmap); | 279 | Graphics graph = Graphics.FromImage(bitmap); |
267 | 280 | ||
268 | // this is really just to save people filling the | 281 | // this is really just to save people filling the |
269 | // background white in their scripts, only do when fully opaque | 282 | // background color in their scripts, only do when fully opaque |
270 | if (alpha == 255) | 283 | if (alpha == 255) |
271 | { | 284 | { |
272 | graph.FillRectangle(new SolidBrush(Color.White), 0, 0, width, height); | 285 | graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); |
286 | |||
273 | } | 287 | } |
274 | 288 | ||
275 | for (int w = 0; w < bitmap.Width; w++) | 289 | for (int w = 0; w < bitmap.Width; w++) |
@@ -448,6 +462,38 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
448 | fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | 462 | fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); |
449 | myFont = new Font(fontName, fontSize); | 463 | myFont = new Font(fontName, fontSize); |
450 | } | 464 | } |
465 | else if (nextLine.StartsWith("FontProp")) | ||
466 | { | ||
467 | nextLine = nextLine.Remove(0, 8); | ||
468 | nextLine = nextLine.Trim(); | ||
469 | |||
470 | string [] fprops = nextLine.Split(partsDelimiter); | ||
471 | foreach (string prop in fprops) { | ||
472 | |||
473 | switch (prop) | ||
474 | { | ||
475 | case "B": | ||
476 | if(!(myFont.Bold)) | ||
477 | myFont = new Font(myFont, myFont.Style | FontStyle.Bold); | ||
478 | break; | ||
479 | case "I": | ||
480 | if(!(myFont.Italic)) | ||
481 | myFont = new Font(myFont, myFont.Style | FontStyle.Italic); | ||
482 | break; | ||
483 | case "U": | ||
484 | if(!(myFont.Underline)) | ||
485 | myFont = new Font(myFont, myFont.Style | FontStyle.Underline); | ||
486 | break; | ||
487 | case "S": | ||
488 | if(!(myFont.Strikeout)) | ||
489 | myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); | ||
490 | break; | ||
491 | case "R": | ||
492 | myFont = new Font(myFont, FontStyle.Regular); | ||
493 | break; | ||
494 | } | ||
495 | } | ||
496 | } | ||
451 | else if (nextLine.StartsWith("FontName")) | 497 | else if (nextLine.StartsWith("FontName")) |
452 | { | 498 | { |
453 | nextLine = nextLine.Remove(0, 8); | 499 | nextLine = nextLine.Remove(0, 8); |