aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs56
1 files changed, 28 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 2fc89fc..f12286d 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
117 return true; 117 return true;
118 } 118 }
119 119
120 public void GetDrawStringSize(string text, string fontName, int fontSize, 120 public void GetDrawStringSize(string text, string fontName, int fontSize,
121 out double xSize, out double ySize) 121 out double xSize, out double ySize)
122 { 122 {
123 lock (this) 123 lock (this)
@@ -209,32 +209,32 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
209 int alpha = 255; // 0 is transparent 209 int alpha = 255; // 0 is transparent
210 Color bgColor = Color.White; // Default background color 210 Color bgColor = Color.White; // Default background color
211 char altDataDelim = ';'; 211 char altDataDelim = ';';
212 212
213 char[] paramDelimiter = { ',' }; 213 char[] paramDelimiter = { ',' };
214 char[] nvpDelimiter = { ':' }; 214 char[] nvpDelimiter = { ':' };
215 215
216 extraParams = extraParams.Trim(); 216 extraParams = extraParams.Trim();
217 extraParams = extraParams.ToLower(); 217 extraParams = extraParams.ToLower();
218 218
219 string[] nvps = extraParams.Split(paramDelimiter); 219 string[] nvps = extraParams.Split(paramDelimiter);
220 220
221 int temp = -1; 221 int temp = -1;
222 foreach (string pair in nvps) 222 foreach (string pair in nvps)
223 { 223 {
224 string[] nvp = pair.Split(nvpDelimiter); 224 string[] nvp = pair.Split(nvpDelimiter);
225 string name = ""; 225 string name = "";
226 string value = ""; 226 string value = "";
227 227
228 if (nvp[0] != null) 228 if (nvp[0] != null)
229 { 229 {
230 name = nvp[0].Trim(); 230 name = nvp[0].Trim();
231 } 231 }
232 232
233 if (nvp.Length == 2) 233 if (nvp.Length == 2)
234 { 234 {
235 value = nvp[1].Trim(); 235 value = nvp[1].Trim();
236 } 236 }
237 237
238 switch (name) 238 switch (name)
239 { 239 {
240 case "width": 240 case "width":
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
301 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 301 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
302 { 302 {
303 bgColor = Color.FromArgb(hex); 303 bgColor = Color.FromArgb(hex);
304 } 304 }
305 else 305 else
306 { 306 {
307 bgColor = Color.FromName(value); 307 bgColor = Color.FromName(value);
@@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
321 } 321 }
322 else 322 else
323 { 323 {
324 // this function used to accept an int on its own that represented both 324 // this function used to accept an int on its own that represented both
325 // width and height, this is to maintain backwards compat, could be removed 325 // width and height, this is to maintain backwards compat, could be removed
326 // but would break existing scripts 326 // but would break existing scripts
327 temp = parseIntParam(name); 327 temp = parseIntParam(name);
@@ -329,10 +329,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
329 { 329 {
330 if (temp > 1024) 330 if (temp > 1024)
331 temp = 1024; 331 temp = 1024;
332 332
333 if (temp < 128) 333 if (temp < 128)
334 temp = 128; 334 temp = 128;
335 335
336 width = temp; 336 width = temp;
337 height = temp; 337 height = temp;
338 } 338 }
@@ -358,10 +358,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
358 bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); 358 bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
359 else 359 else
360 bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); 360 bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
361 361
362 graph = Graphics.FromImage(bitmap); 362 graph = Graphics.FromImage(bitmap);
363 363
364 // this is really just to save people filling the 364 // this is really just to save people filling the
365 // background color in their scripts, only do when fully opaque 365 // background color in their scripts, only do when fully opaque
366 if (alpha >= 255) 366 if (alpha >= 255)
367 { 367 {
@@ -370,10 +370,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
370 graph.FillRectangle(bgFillBrush, 0, 0, width, height); 370 graph.FillRectangle(bgFillBrush, 0, 0, width, height);
371 } 371 }
372 } 372 }
373 373
374 for (int w = 0; w < bitmap.Width; w++) 374 for (int w = 0; w < bitmap.Width; w++)
375 { 375 {
376 if (alpha <= 255) 376 if (alpha <= 255)
377 { 377 {
378 for (int h = 0; h < bitmap.Height; h++) 378 for (int h = 0; h < bitmap.Height; h++)
379 { 379 {
@@ -381,10 +381,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
381 } 381 }
382 } 382 }
383 } 383 }
384 384
385 GDIDraw(data, graph, altDataDelim, out reuseable); 385 GDIDraw(data, graph, altDataDelim, out reuseable);
386 } 386 }
387 387
388 byte[] imageJ2000 = new byte[0]; 388 byte[] imageJ2000 = new byte[0];
389 389
390 // This code exists for testing purposes, please do not remove. 390 // This code exists for testing purposes, please do not remove.
@@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
394// imageJ2000 = s_asset2Data; 394// imageJ2000 = s_asset2Data;
395// 395//
396// s_flipper = !s_flipper; 396// s_flipper = !s_flipper;
397 397
398 try 398 try
399 { 399 {
400 imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); 400 imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
@@ -420,13 +420,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
420 { 420 {
421 if (graph != null) 421 if (graph != null)
422 graph.Dispose(); 422 graph.Dispose();
423 423
424 if (bitmap != null) 424 if (bitmap != null)
425 bitmap.Dispose(); 425 bitmap.Dispose();
426 } 426 }
427 } 427 }
428 } 428 }
429 429
430 private int parseIntParam(string strInt) 430 private int parseIntParam(string strInt)
431 { 431 {
432 int parsed; 432 int parsed;
@@ -440,7 +440,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
440 // m_log.Debug("Problem with Draw. Please verify parameters." + e.ToString()); 440 // m_log.Debug("Problem with Draw. Please verify parameters." + e.ToString());
441 parsed = -1; 441 parsed = -1;
442 } 442 }
443 443
444 return parsed; 444 return parsed;
445 } 445 }
446 446
@@ -572,7 +572,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
572 graph.DrawString("not an image. Please check URL.", errorFont, 572 graph.DrawString("not an image. Please check URL.", errorFont,
573 myBrush, new Point(startPoint.X, 12 + startPoint.Y)); 573 myBrush, new Point(startPoint.X, 12 + startPoint.Y));
574 } 574 }
575 575
576 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); 576 graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
577 } 577 }
578 } 578 }
@@ -638,11 +638,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
638 { 638 {
639 nextLine = nextLine.Remove(0, 8); 639 nextLine = nextLine.Remove(0, 8);
640 nextLine = nextLine.Trim(); 640 nextLine = nextLine.Trim();
641 641
642 string[] fprops = nextLine.Split(partsDelimiter); 642 string[] fprops = nextLine.Split(partsDelimiter);
643 foreach (string prop in fprops) 643 foreach (string prop in fprops)
644 { 644 {
645 645
646 switch (prop) 646 switch (prop)
647 { 647 {
648 case "B": 648 case "B":
@@ -717,7 +717,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
717 else if (cap[0].ToLower() != "both") 717 else if (cap[0].ToLower() != "both")
718 return; 718 return;
719 string type = cap[1].ToLower(); 719 string type = cap[1].ToLower();
720 720
721 if (end) 721 if (end)
722 { 722 {
723 switch (type) 723 switch (type)
@@ -760,7 +760,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
760 nextLine = nextLine.Remove(0, 9); 760 nextLine = nextLine.Remove(0, 9);
761 nextLine = nextLine.Trim(); 761 nextLine = nextLine.Trim();
762 int hex = 0; 762 int hex = 0;
763 763
764 Color newColor; 764 Color newColor;
765 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 765 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
766 { 766 {