From 7d5a21ddbf738c51197a98bef11a52ceb85fe907 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 29 Jun 2008 19:21:43 +0000
Subject: * Allow terrains to be loaded and saved from streams as well as
directly to and from files * Should be making use of this in the next
revisions
---
.../Environment/Modules/World/Terrain/FileLoaders/PNG.cs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
(limited to 'OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs')
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs
index b893f70..cf95486 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs
@@ -24,8 +24,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
using System.Drawing;
using System.Drawing.Imaging;
+using System.IO;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
@@ -38,6 +40,18 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
colours.Save(filename, ImageFormat.Png);
}
+
+ ///
+ /// Exports a stream using a System.Drawing exporter.
+ ///
+ /// The target stream
+ /// The terrain channel being saved
+ public override void SaveStream(Stream stream, ITerrainChannel map)
+ {
+ Bitmap colours = CreateGrayscaleBitmapFromMap(map);
+
+ colours.Save(stream, ImageFormat.Png);
+ }
public override string ToString()
{
--
cgit v1.1