diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs | 15 |
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 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | ||
33 | 32 | ||
34 | namespace libTerrain | 33 | namespace 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 |