Browse Source

Testing image reader

combat-2
MagicBot 1 year ago
parent
commit
cb2ed0c766
  1. 8
      src/engine/InterestManagement/HeightMap.java

8
src/engine/InterestManagement/HeightMap.java

@ -20,6 +20,7 @@ import engine.objects.Zone;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
@ -30,6 +31,7 @@ import java.nio.file.Paths;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.stream.Stream; import java.util.stream.Stream;
import static java.lang.Math.abs; import static java.lang.Math.abs;
@ -315,6 +317,11 @@ public class HeightMap {
// Load pixel data // Load pixel data
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("TGA");
while (readers.hasNext()) {
System.out.println("reader: " + readers.next());
}
try (Stream<Path> filePathStream = Files.walk(Paths.get(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/TARGA/"))) { try (Stream<Path> filePathStream = Files.walk(Paths.get(ConfigManager.DEFAULT_DATA_DIR + "heightmaps/TARGA/"))) {
filePathStream.forEach(filePath -> { filePathStream.forEach(filePath -> {
@ -323,6 +330,7 @@ public class HeightMap {
try { try {
BufferedImage heightmapImage = ImageIO.read(imageFile); BufferedImage heightmapImage = ImageIO.read(imageFile);
int width = heightmapImage.getWidth();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

Loading…
Cancel
Save