diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs index d6430cd..f25b29b 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs | |||
@@ -26,8 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Drawing; | 29 | using System.Drawing; |
30 | using System.Drawing.Imaging; | ||
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 33 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
@@ -46,6 +46,15 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
46 | throw new NotImplementedException(); | 46 | throw new NotImplementedException(); |
47 | } | 47 | } |
48 | 48 | ||
49 | public void SaveFile(string filename, ITerrainChannel map) | ||
50 | { | ||
51 | Bitmap colours = CreateBitmapFromMap(map); | ||
52 | |||
53 | colours.Save(filename, ImageFormat.Jpeg); | ||
54 | } | ||
55 | |||
56 | #endregion | ||
57 | |||
49 | public override string ToString() | 58 | public override string ToString() |
50 | { | 59 | { |
51 | return "JPEG"; | 60 | return "JPEG"; |
@@ -70,20 +79,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
70 | for (int x = 0; x < map.Width; x++) | 79 | for (int x = 0; x < map.Width; x++) |
71 | { | 80 | { |
72 | // 512 is the largest possible height before colours clamp | 81 | // 512 is the largest possible height before colours clamp |
73 | int colorindex = (int)(Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); | 82 | int colorindex = (int) (Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); |
74 | bmp.SetPixel(x, map.Height - y - 1, colours[colorindex]); | 83 | bmp.SetPixel(x, map.Height - y - 1, colours[colorindex]); |
75 | } | 84 | } |
76 | } | 85 | } |
77 | return bmp; | 86 | return bmp; |
78 | } | 87 | } |
79 | |||
80 | public void SaveFile(string filename, ITerrainChannel map) | ||
81 | { | ||
82 | Bitmap colours = CreateBitmapFromMap(map); | ||
83 | |||
84 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | } | 88 | } |
89 | } | 89 | } \ No newline at end of file |