diff options
author | MW | 2009-02-21 21:03:20 +0000 |
---|---|---|
committer | MW | 2009-02-21 21:03:20 +0000 |
commit | 52b2d8732ab36e4265014c67d0c40b24e0ded7a9 (patch) | |
tree | 44c82a28f42468a5ddd1221dbd0fbc114eee31c7 /OpenSim/Region | |
parent | More Grid server refactoring (diff) | |
download | opensim-SC-52b2d8732ab36e4265014c67d0c40b24e0ded7a9.zip opensim-SC-52b2d8732ab36e4265014c67d0c40b24e0ded7a9.tar.gz opensim-SC-52b2d8732ab36e4265014c67d0c40b24e0ded7a9.tar.bz2 opensim-SC-52b2d8732ab36e4265014c67d0c40b24e0ded7a9.tar.xz |
Applied patch from mantis #3217, which allows Dynamic Images of type RGB (so with no alpha value). Thanks BlueWall.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 7cee0cf..2ef89b7 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -229,6 +229,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
229 | alpha = temp; | 229 | alpha = temp; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | // Allow a bitmap w/o the alpha component to be created | ||
233 | else if (value.ToLower() == "false") { | ||
234 | alpha = 256; | ||
235 | } | ||
232 | break; | 236 | break; |
233 | case "bgcolour": | 237 | case "bgcolour": |
234 | int hex = 0; | 238 | int hex = 0; |
@@ -271,24 +275,36 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
271 | break; | 275 | break; |
272 | } | 276 | } |
273 | } | 277 | } |
274 | 278 | ||
275 | Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); | 279 | Bitmap bitmap; |
280 | |||
281 | if ( alpha == 256 ) | ||
282 | { | ||
283 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); | ||
284 | } | ||
285 | else { | ||
286 | |||
287 | bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); | ||
288 | } | ||
276 | 289 | ||
277 | Graphics graph = Graphics.FromImage(bitmap); | 290 | Graphics graph = Graphics.FromImage(bitmap); |
278 | 291 | ||
279 | // this is really just to save people filling the | 292 | // this is really just to save people filling the |
280 | // background color in their scripts, only do when fully opaque | 293 | // background color in their scripts, only do when fully opaque |
281 | if (alpha == 255) | 294 | if (alpha >= 255) |
282 | { | 295 | { |
283 | graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); | 296 | graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); |
284 | } | 297 | } |
285 | 298 | ||
286 | for (int w = 0; w < bitmap.Width; w++) | 299 | for (int w = 0; w < bitmap.Width; w++) |
287 | { | 300 | { |
288 | for (int h = 0; h < bitmap.Height; h++) | 301 | if (alpha <= 255) |
289 | { | 302 | { |
290 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | 303 | for (int h = 0; h < bitmap.Height; h++) |
291 | } | 304 | { |
305 | bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); | ||
306 | } | ||
307 | } | ||
292 | } | 308 | } |
293 | 309 | ||
294 | GDIDraw(data, graph); | 310 | GDIDraw(data, graph); |