aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
index 5949759..b4eda47 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
@@ -27,9 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging;
33 32
34namespace libTerrain 33namespace libTerrain
35{ 34{
@@ -48,7 +47,7 @@ namespace libTerrain
48 for (y = 0; y < bit.Height; y++) 47 for (y = 0; y < bit.Height; y++)
49 { 48 {
50 Color val = bit.GetPixel(x, y); 49 Color val = bit.GetPixel(x, y);
51 chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; 50 chan.map[x, y] = (((double) val.R + (double) val.G + (double) val.B)/3.0)/255.0;
52 } 51 }
53 } 52 }
54 53
@@ -57,21 +56,21 @@ namespace libTerrain
57 56
58 public void SaveImage(string filename) 57 public void SaveImage(string filename)
59 { 58 {
60 Channel outmap = this.Copy(); 59 Channel outmap = Copy();
61 outmap.Normalise(); 60 outmap.Normalise();
62 61
63 Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 62 Bitmap bit = new Bitmap(w, h, PixelFormat.Format24bppRgb);
64 int x, y; 63 int x, y;
65 for (x = 0; x < w; x++) 64 for (x = 0; x < w; x++)
66 { 65 {
67 for (y = 0; y < h; y++) 66 for (y = 0; y < h; y++)
68 { 67 {
69 int val = Math.Min(255, (int)(outmap.map[x,y] * 255)); 68 int val = Math.Min(255, (int) (outmap.map[x, y]*255));
70 Color col = Color.FromArgb(val,val,val); 69 Color col = Color.FromArgb(val, val, val);
71 bit.SetPixel(x, y, col); 70 bit.SetPixel(x, y, col);
72 } 71 }
73 } 72 }
74 bit.Save(filename); 73 bit.Save(filename);
75 } 74 }
76 } 75 }
77} 76} \ No newline at end of file