diff --git a/src/be/woubuc/wurmunlimited/wurmmapgen/FileManager.java b/src/be/woubuc/wurmunlimited/wurmmapgen/FileManager.java index 01629df..a764184 100644 --- a/src/be/woubuc/wurmunlimited/wurmmapgen/FileManager.java +++ b/src/be/woubuc/wurmunlimited/wurmmapgen/FileManager.java @@ -2,20 +2,11 @@ import org.apache.commons.io.FileUtils; -import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Iterator; - -import javax.imageio.IIOImage; -import javax.imageio.ImageIO; -import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; -import javax.imageio.plugins.jpeg.JPEGImageWriteParam; -import javax.imageio.stream.ImageOutputStream; public class FileManager { @@ -71,20 +62,6 @@ public void unload() throws IOException { System.out.println(" OK Directory deleted"); } - public void saveToFile(BufferedImage newImg, File file) throws IOException { - ImageWriter writer = null; - Iterator iter = ImageIO.getImageWritersByFormatName("png"); - if (iter.hasNext()) { - writer = (ImageWriter)iter.next(); - } - ImageOutputStream ios = ImageIO.createImageOutputStream(file); - writer.setOutput(ios); - ImageWriteParam param = new JPEGImageWriteParam(java.util.Locale.getDefault()); - param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ; - param.setCompressionQuality(1f); - writer.write(null, new IIOImage( newImg, null, null ), param); - } - /** * Describes a Wurm Unlimited SQLite db file */ diff --git a/src/be/woubuc/wurmunlimited/wurmmapgen/TemplateHandler.java b/src/be/woubuc/wurmunlimited/wurmmapgen/TemplateHandler.java index 7a16518..9f1aeb8 100644 --- a/src/be/woubuc/wurmunlimited/wurmmapgen/TemplateHandler.java +++ b/src/be/woubuc/wurmunlimited/wurmmapgen/TemplateHandler.java @@ -3,7 +3,10 @@ import com.samskivert.mustache.Mustache; import org.apache.commons.io.FileUtils; -import java.io.*; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; import java.util.HashMap; import java.util.Map; diff --git a/src/be/woubuc/wurmunlimited/wurmmapgen/TileMapGenerator.java b/src/be/woubuc/wurmunlimited/wurmmapgen/TileMapGenerator.java index fbea96b..5994937 100644 --- a/src/be/woubuc/wurmunlimited/wurmmapgen/TileMapGenerator.java +++ b/src/be/woubuc/wurmunlimited/wurmmapgen/TileMapGenerator.java @@ -1,7 +1,16 @@ package be.woubuc.wurmunlimited.wurmmapgen; -import java.awt.Color; -import java.awt.Graphics2D; +import com.wurmonline.mesh.MeshIO; +import com.wurmonline.mesh.Tiles; +import com.wurmonline.mesh.Tiles.Tile; + +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.plugins.jpeg.JPEGImageWriteParam; +import javax.imageio.stream.ImageOutputStream; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -11,23 +20,10 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.stream.IntStream; -import com.wurmonline.mesh.MeshIO; -import com.wurmonline.mesh.Tiles; -import com.wurmonline.mesh.Tiles.Tile; - -import javax.imageio.IIOImage; -import javax.imageio.ImageIO; -import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; -import javax.imageio.plugins.jpeg.JPEGImageWriteParam; -import javax.imageio.stream.ImageOutputStream; - public class TileMapGenerator { private ExecutorService executor;