diff options
author | Arthur Valadares | 2009-08-21 21:12:22 -0300 |
---|---|---|
committer | Arthur Valadares | 2009-08-21 21:12:22 -0300 |
commit | 7923fd29a019eae168b6793ed6e388bc27bc288e (patch) | |
tree | fda1b25c9f53afe3fa4aa2ca55a3ca3d648b6764 /OpenSim/Region/CoreModules/Scripting | |
parent | Fix issue where conversion of temporary boolean variable fails on MySQL (diff) | |
download | opensim-SC-7923fd29a019eae168b6793ed6e388bc27bc288e.zip opensim-SC-7923fd29a019eae168b6793ed6e388bc27bc288e.tar.gz opensim-SC-7923fd29a019eae168b6793ed6e388bc27bc288e.tar.bz2 opensim-SC-7923fd29a019eae168b6793ed6e388bc27bc288e.tar.xz |
Adds osDrawPolygon to OSSL. Works a little different then other OS Drawing functions, this one has no start and end point, but a number of points that will form the desired polygon. Only FilledPolygon implemented so far.
* Also added some LSL transparent type conversion, as it's done in LSL scripting (string to integer, float to string, etc)
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 2640f08..d7f39b0 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -469,13 +469,19 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
469 | startPoint.X += endPoint.X; | 469 | startPoint.X += endPoint.X; |
470 | startPoint.Y += endPoint.Y; | 470 | startPoint.Y += endPoint.Y; |
471 | } | 471 | } |
472 | else if (nextLine.StartsWith("FillPolygon")) | ||
473 | { | ||
474 | PointF[] points = null; | ||
475 | GetParams(partsDelimiter, ref nextLine, 11, ref points); | ||
476 | graph.FillPolygon(myBrush, points); | ||
477 | } | ||
472 | else if (nextLine.StartsWith("Ellipse")) | 478 | else if (nextLine.StartsWith("Ellipse")) |
473 | { | 479 | { |
474 | float x = 0; | 480 | float x = 0; |
475 | float y = 0; | 481 | float y = 0; |
476 | GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); | 482 | GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); |
477 | endPoint.X = (int) x; | 483 | endPoint.X = (int)x; |
478 | endPoint.Y = (int) y; | 484 | endPoint.Y = (int)y; |
479 | graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 485 | graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
480 | startPoint.X += endPoint.X; | 486 | startPoint.X += endPoint.X; |
481 | startPoint.Y += endPoint.Y; | 487 | startPoint.Y += endPoint.Y; |
@@ -492,30 +498,31 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
492 | nextLine = nextLine.Remove(0, 8); | 498 | nextLine = nextLine.Remove(0, 8); |
493 | nextLine = nextLine.Trim(); | 499 | nextLine = nextLine.Trim(); |
494 | 500 | ||
495 | string [] fprops = nextLine.Split(partsDelimiter); | 501 | string[] fprops = nextLine.Split(partsDelimiter); |
496 | foreach (string prop in fprops) { | 502 | foreach (string prop in fprops) |
497 | 503 | { | |
504 | |||
498 | switch (prop) | 505 | switch (prop) |
499 | { | 506 | { |
500 | case "B": | 507 | case "B": |
501 | if (!(myFont.Bold)) | 508 | if (!(myFont.Bold)) |
502 | myFont = new Font(myFont, myFont.Style | FontStyle.Bold); | 509 | myFont = new Font(myFont, myFont.Style | FontStyle.Bold); |
503 | break; | 510 | break; |
504 | case "I": | 511 | case "I": |
505 | if (!(myFont.Italic)) | 512 | if (!(myFont.Italic)) |
506 | myFont = new Font(myFont, myFont.Style | FontStyle.Italic); | 513 | myFont = new Font(myFont, myFont.Style | FontStyle.Italic); |
507 | break; | 514 | break; |
508 | case "U": | 515 | case "U": |
509 | if (!(myFont.Underline)) | 516 | if (!(myFont.Underline)) |
510 | myFont = new Font(myFont, myFont.Style | FontStyle.Underline); | 517 | myFont = new Font(myFont, myFont.Style | FontStyle.Underline); |
511 | break; | 518 | break; |
512 | case "S": | 519 | case "S": |
513 | if (!(myFont.Strikeout)) | 520 | if (!(myFont.Strikeout)) |
514 | myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); | 521 | myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); |
515 | break; | 522 | break; |
516 | case "R": | 523 | case "R": |
517 | myFont = new Font(myFont, FontStyle.Regular); | 524 | myFont = new Font(myFont, FontStyle.Regular); |
518 | break; | 525 | break; |
519 | } | 526 | } |
520 | } | 527 | } |
521 | } | 528 | } |
@@ -542,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
542 | if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) | 549 | if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) |
543 | { | 550 | { |
544 | newColour = Color.FromArgb(hex); | 551 | newColour = Color.FromArgb(hex); |
545 | } | 552 | } |
546 | else | 553 | else |
547 | { | 554 | { |
548 | // this doesn't fail, it just returns black if nothing is found | 555 | // this doesn't fail, it just returns black if nothing is found |
@@ -582,6 +589,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
582 | } | 589 | } |
583 | } | 590 | } |
584 | 591 | ||
592 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref PointF[] points) | ||
593 | { | ||
594 | line = line.Remove(0, startLength); | ||
595 | string[] parts = line.Split(partsDelimiter); | ||
596 | if (parts.Length > 1 && parts.Length % 2 == 0) | ||
597 | { | ||
598 | points = new PointF[parts.Length / 2]; | ||
599 | for (int i = 0; i < parts.Length; i = i + 2) | ||
600 | { | ||
601 | string xVal = parts[i].Trim(); | ||
602 | string yVal = parts[i+1].Trim(); | ||
603 | float x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | ||
604 | float y = Convert.ToSingle(yVal, CultureInfo.InvariantCulture); | ||
605 | PointF point = new PointF(x, y); | ||
606 | points[i / 2] = point; | ||
607 | } | ||
608 | } | ||
609 | } | ||
610 | |||
585 | private Bitmap ImageHttpRequest(string url) | 611 | private Bitmap ImageHttpRequest(string url) |
586 | { | 612 | { |
587 | WebRequest request = HttpWebRequest.Create(url); | 613 | WebRequest request = HttpWebRequest.Create(url); |