diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/Scripting/VectorRender | |
parent | Add a build script. (diff) | |
download | opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | 48 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 122 |
2 files changed, 96 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index ed255bf..325f7f9 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | |||
@@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
77 | so.UUID, | 77 | so.UUID, |
78 | m_vrm.GetContentType(), | 78 | m_vrm.GetContentType(), |
79 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | 79 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", |
80 | "", | 80 | ""); |
81 | 0); | ||
82 | 81 | ||
83 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 82 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
84 | } | 83 | } |
@@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
98 | so.UUID, | 97 | so.UUID, |
99 | m_vrm.GetContentType(), | 98 | m_vrm.GetContentType(), |
100 | dtText, | 99 | dtText, |
101 | "", | 100 | ""); |
102 | 0); | ||
103 | 101 | ||
104 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 102 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
105 | 103 | ||
@@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
108 | so.UUID, | 106 | so.UUID, |
109 | m_vrm.GetContentType(), | 107 | m_vrm.GetContentType(), |
110 | dtText, | 108 | dtText, |
111 | "", | 109 | ""); |
112 | 0); | ||
113 | 110 | ||
114 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 111 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
115 | } | 112 | } |
@@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
129 | so.UUID, | 126 | so.UUID, |
130 | m_vrm.GetContentType(), | 127 | m_vrm.GetContentType(), |
131 | dtText, | 128 | dtText, |
132 | "", | 129 | ""); |
133 | 0); | ||
134 | 130 | ||
135 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 131 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
136 | 132 | ||
@@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
139 | so.UUID, | 135 | so.UUID, |
140 | m_vrm.GetContentType(), | 136 | m_vrm.GetContentType(), |
141 | dtText, | 137 | dtText, |
142 | "alpha:250", | 138 | "alpha:250"); |
143 | 0); | ||
144 | 139 | ||
145 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 140 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
146 | } | 141 | } |
@@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
161 | so.UUID, | 156 | so.UUID, |
162 | m_vrm.GetContentType(), | 157 | m_vrm.GetContentType(), |
163 | dtText, | 158 | dtText, |
164 | "", | 159 | ""); |
165 | 0); | ||
166 | 160 | ||
167 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 161 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
168 | 162 | ||
@@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
171 | so.UUID, | 165 | so.UUID, |
172 | m_vrm.GetContentType(), | 166 | m_vrm.GetContentType(), |
173 | dtText, | 167 | dtText, |
174 | "", | 168 | ""); |
175 | 0); | ||
176 | 169 | ||
177 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 170 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
178 | } | 171 | } |
@@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
191 | so.UUID, | 184 | so.UUID, |
192 | m_vrm.GetContentType(), | 185 | m_vrm.GetContentType(), |
193 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | 186 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", |
194 | "", | 187 | ""); |
195 | 0); | ||
196 | 188 | ||
197 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 189 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
198 | } | 190 | } |
@@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
213 | so.UUID, | 205 | so.UUID, |
214 | m_vrm.GetContentType(), | 206 | m_vrm.GetContentType(), |
215 | dtText, | 207 | dtText, |
216 | "", | 208 | ""); |
217 | 0); | ||
218 | 209 | ||
219 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 210 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
220 | 211 | ||
@@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
223 | so.UUID, | 214 | so.UUID, |
224 | m_vrm.GetContentType(), | 215 | m_vrm.GetContentType(), |
225 | dtText, | 216 | dtText, |
226 | "", | 217 | ""); |
227 | 0); | ||
228 | 218 | ||
229 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 219 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
230 | } | 220 | } |
@@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
253 | so.UUID, | 243 | so.UUID, |
254 | m_vrm.GetContentType(), | 244 | m_vrm.GetContentType(), |
255 | dtText, | 245 | dtText, |
256 | "1024", | 246 | "1024"); |
257 | 0); | ||
258 | 247 | ||
259 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 248 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
260 | 249 | ||
@@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
263 | so.UUID, | 252 | so.UUID, |
264 | m_vrm.GetContentType(), | 253 | m_vrm.GetContentType(), |
265 | dtText, | 254 | dtText, |
266 | "1024", | 255 | "1024"); |
267 | 0); | ||
268 | 256 | ||
269 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 257 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
270 | } | 258 | } |
@@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
284 | so.UUID, | 272 | so.UUID, |
285 | m_vrm.GetContentType(), | 273 | m_vrm.GetContentType(), |
286 | dtText, | 274 | dtText, |
287 | "", | 275 | ""); |
288 | 0); | ||
289 | 276 | ||
290 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 277 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
291 | 278 | ||
@@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
294 | so.UUID, | 281 | so.UUID, |
295 | m_vrm.GetContentType(), | 282 | m_vrm.GetContentType(), |
296 | dtText, | 283 | dtText, |
297 | "alpha:250", | 284 | "alpha:250"); |
298 | 0); | ||
299 | 285 | ||
300 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 286 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
301 | } | 287 | } |
@@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
316 | so.UUID, | 302 | so.UUID, |
317 | m_vrm.GetContentType(), | 303 | m_vrm.GetContentType(), |
318 | dtText, | 304 | dtText, |
319 | "", | 305 | ""); |
320 | 0); | ||
321 | 306 | ||
322 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 307 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
323 | 308 | ||
@@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
326 | so.UUID, | 311 | so.UUID, |
327 | m_vrm.GetContentType(), | 312 | m_vrm.GetContentType(), |
328 | dtText, | 313 | dtText, |
329 | "", | 314 | ""); |
330 | 0); | ||
331 | 315 | ||
332 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 316 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
333 | } | 317 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 4cecd85..8a26ab7 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 | } |
@@ -355,36 +355,28 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
355 | lock (this) | 355 | lock (this) |
356 | { | 356 | { |
357 | if (alpha == 256) | 357 | if (alpha == 256) |
358 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); | ||
359 | else | ||
360 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); | ||
361 | |||
362 | graph = Graphics.FromImage(bitmap); | ||
363 | |||
364 | // this is really just to save people filling the | ||
365 | // background color in their scripts, only do when fully opaque | ||
366 | if (alpha >= 255) | ||
367 | { | 358 | { |
359 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); | ||
360 | graph = Graphics.FromImage(bitmap); | ||
368 | using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) | 361 | using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) |
369 | { | 362 | { |
370 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); | 363 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); |
371 | } | 364 | } |
372 | } | 365 | } |
373 | 366 | else | |
374 | for (int w = 0; w < bitmap.Width; w++) | ||
375 | { | 367 | { |
376 | if (alpha <= 255) | 368 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); |
369 | graph = Graphics.FromImage(bitmap); | ||
370 | Color newbg = Color.FromArgb(alpha,bgColor); | ||
371 | using (SolidBrush bgFillBrush = new SolidBrush(newbg)) | ||
377 | { | 372 | { |
378 | for (int h = 0; h < bitmap.Height; h++) | 373 | graph.FillRectangle(bgFillBrush, 0, 0, width, height); |
379 | { | ||
380 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | ||
381 | } | ||
382 | } | 374 | } |
383 | } | 375 | } |
384 | 376 | ||
385 | GDIDraw(data, graph, altDataDelim, out reuseable); | 377 | GDIDraw(data, graph, altDataDelim, out reuseable); |
386 | } | 378 | } |
387 | 379 | ||
388 | byte[] imageJ2000 = new byte[0]; | 380 | byte[] imageJ2000 = new byte[0]; |
389 | 381 | ||
390 | // This code exists for testing purposes, please do not remove. | 382 | // This code exists for testing purposes, please do not remove. |
@@ -394,7 +386,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
394 | // imageJ2000 = s_asset2Data; | 386 | // imageJ2000 = s_asset2Data; |
395 | // | 387 | // |
396 | // s_flipper = !s_flipper; | 388 | // s_flipper = !s_flipper; |
397 | 389 | ||
398 | try | 390 | try |
399 | { | 391 | { |
400 | imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); | 392 | imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); |
@@ -420,13 +412,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
420 | { | 412 | { |
421 | if (graph != null) | 413 | if (graph != null) |
422 | graph.Dispose(); | 414 | graph.Dispose(); |
423 | 415 | ||
424 | if (bitmap != null) | 416 | if (bitmap != null) |
425 | bitmap.Dispose(); | 417 | bitmap.Dispose(); |
426 | } | 418 | } |
427 | } | 419 | } |
428 | } | 420 | } |
429 | 421 | ||
430 | private int parseIntParam(string strInt) | 422 | private int parseIntParam(string strInt) |
431 | { | 423 | { |
432 | int parsed; | 424 | int parsed; |
@@ -440,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
440 | // m_log.Debug("Problem with Draw. Please verify parameters." + e.ToString()); | 432 | // m_log.Debug("Problem with Draw. Please verify parameters." + e.ToString()); |
441 | parsed = -1; | 433 | parsed = -1; |
442 | } | 434 | } |
443 | 435 | ||
444 | return parsed; | 436 | return parsed; |
445 | } | 437 | } |
446 | 438 | ||
@@ -519,8 +511,32 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
519 | 511 | ||
520 | // m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine); | 512 | // m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine); |
521 | 513 | ||
514 | if (nextLine.StartsWith("ResetTransf")) | ||
515 | { | ||
516 | graph.ResetTransform(); | ||
517 | } | ||
518 | else if (nextLine.StartsWith("TransTransf")) | ||
519 | { | ||
520 | float x = 0; | ||
521 | float y = 0; | ||
522 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
523 | graph.TranslateTransform(x, y); | ||
524 | } | ||
525 | else if (nextLine.StartsWith("ScaleTransf")) | ||
526 | { | ||
527 | float x = 0; | ||
528 | float y = 0; | ||
529 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
530 | graph.ScaleTransform(x, y); | ||
531 | } | ||
532 | else if (nextLine.StartsWith("RotTransf")) | ||
533 | { | ||
534 | float x = 0; | ||
535 | GetParams(partsDelimiter, ref nextLine, 9, ref x); | ||
536 | graph.RotateTransform(x); | ||
537 | } | ||
522 | //replace with switch, or even better, do some proper parsing | 538 | //replace with switch, or even better, do some proper parsing |
523 | if (nextLine.StartsWith("MoveTo")) | 539 | else if (nextLine.StartsWith("MoveTo")) |
524 | { | 540 | { |
525 | float x = 0; | 541 | float x = 0; |
526 | float y = 0; | 542 | float y = 0; |
@@ -572,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
572 | graph.DrawString("not an image. Please check URL.", errorFont, | 588 | graph.DrawString("not an image. Please check URL.", errorFont, |
573 | myBrush, new Point(startPoint.X, 12 + startPoint.Y)); | 589 | myBrush, new Point(startPoint.X, 12 + startPoint.Y)); |
574 | } | 590 | } |
575 | 591 | ||
576 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | 592 | graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); |
577 | } | 593 | } |
578 | } | 594 | } |
@@ -625,6 +641,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
625 | startPoint.X += endPoint.X; | 641 | startPoint.X += endPoint.X; |
626 | startPoint.Y += endPoint.Y; | 642 | startPoint.Y += endPoint.Y; |
627 | } | 643 | } |
644 | else if (nextLine.StartsWith("FillEllipse")) | ||
645 | { | ||
646 | float x = 0; | ||
647 | float y = 0; | ||
648 | GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y); | ||
649 | endPoint.X = (int)x; | ||
650 | endPoint.Y = (int)y; | ||
651 | graph.FillEllipse(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); | ||
652 | startPoint.X += endPoint.X; | ||
653 | startPoint.Y += endPoint.Y; | ||
654 | } | ||
628 | else if (nextLine.StartsWith("FontSize")) | 655 | else if (nextLine.StartsWith("FontSize")) |
629 | { | 656 | { |
630 | nextLine = nextLine.Remove(0, 8); | 657 | nextLine = nextLine.Remove(0, 8); |
@@ -638,11 +665,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
638 | { | 665 | { |
639 | nextLine = nextLine.Remove(0, 8); | 666 | nextLine = nextLine.Remove(0, 8); |
640 | nextLine = nextLine.Trim(); | 667 | nextLine = nextLine.Trim(); |
641 | 668 | ||
642 | string[] fprops = nextLine.Split(partsDelimiter); | 669 | string[] fprops = nextLine.Split(partsDelimiter); |
643 | foreach (string prop in fprops) | 670 | foreach (string prop in fprops) |
644 | { | 671 | { |
645 | 672 | ||
646 | switch (prop) | 673 | switch (prop) |
647 | { | 674 | { |
648 | case "B": | 675 | case "B": |
@@ -717,7 +744,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
717 | else if (cap[0].ToLower() != "both") | 744 | else if (cap[0].ToLower() != "both") |
718 | return; | 745 | return; |
719 | string type = cap[1].ToLower(); | 746 | string type = cap[1].ToLower(); |
720 | 747 | ||
721 | if (end) | 748 | if (end) |
722 | { | 749 | { |
723 | switch (type) | 750 | switch (type) |
@@ -760,7 +787,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
760 | nextLine = nextLine.Remove(0, 9); | 787 | nextLine = nextLine.Remove(0, 9); |
761 | nextLine = nextLine.Trim(); | 788 | nextLine = nextLine.Trim(); |
762 | int hex = 0; | 789 | int hex = 0; |
763 | 790 | ||
764 | Color newColor; | 791 | Color newColor; |
765 | if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) | 792 | if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) |
766 | { | 793 | { |
@@ -790,6 +817,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
790 | } | 817 | } |
791 | } | 818 | } |
792 | 819 | ||
820 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x) | ||
821 | { | ||
822 | line = line.Remove(0, startLength); | ||
823 | string[] parts = line.Split(partsDelimiter); | ||
824 | if (parts.Length > 0) | ||
825 | { | ||
826 | string xVal = parts[0].Trim(); | ||
827 | x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture); | ||
828 | } | ||
829 | } | ||
830 | |||
793 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) | 831 | private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) |
794 | { | 832 | { |
795 | line = line.Remove(0, startLength); | 833 | line = line.Remove(0, startLength); |
@@ -861,4 +899,4 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
861 | return null; | 899 | return null; |
862 | } | 900 | } |
863 | } | 901 | } |
864 | } \ No newline at end of file | 902 | } |