Skip to content

Commit

Permalink
Removed unnecessary code and optimised imports
Browse files Browse the repository at this point in the history
  • Loading branch information
woubuc committed Dec 22, 2017
1 parent d752a2f commit 82c786e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
23 changes: 0 additions & 23 deletions src/be/woubuc/wurmunlimited/wurmmapgen/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<ImageWriter> 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
*/
Expand Down
5 changes: 4 additions & 1 deletion src/be/woubuc/wurmunlimited/wurmmapgen/TemplateHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
26 changes: 11 additions & 15 deletions src/be/woubuc/wurmunlimited/wurmmapgen/TileMapGenerator.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 82c786e

Please sign in to comment.