Skip to content

Instantly share code, notes, and snippets.

@MrPowerGamerBR
Created December 16, 2015 23:00
Show Gist options
  • Select an option

  • Save MrPowerGamerBR/5771cfea01f4eed3442e to your computer and use it in GitHub Desktop.

Select an option

Save MrPowerGamerBR/5771cfea01f4eed3442e to your computer and use it in GitHub Desktop.
SimCity 2000 printing image output to a complete city image.
package me.mrpowergamerbr.powersc2kjoiner;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class SC2KJoiner {
public static void main(String[] args) throws IOException {
System.out.println("Joining Files...");
/*
* Cria uma imagem vazia
*/
BufferedImage finalImg = new BufferedImage(7000, 5644,
BufferedImage.TYPE_INT_RGB);
Graphics2D graph = (Graphics2D) finalImg.getGraphics();
int pngNum = 0;
int x = 0;
int y = 0;
int times = 1;
int twist = 0;
File dir = new File("C:\\Users\\User\\Documents\\SCJointer");
File[] directoryListing = dir.listFiles();
if (directoryListing != null) {
for (File child : directoryListing) {
if (child.getName().endsWith(".png")) {
pngNum++;
System.out.println("[PowerSC2KJoiner] PNG " + pngNum + " - " + twist);
BufferedImage img = ImageIO.read(child);
img = img.getSubimage(32, 24, 935, 1363);
graph.drawImage(img, x, y, 935, 1363, null);
twist++;
// x = x + 1000;
y = y + 1363;
if (twist == 4) {
twist = 0;
x = x + 935;
y = 0;
}
if (times == 3) {
twist = 0;
x = x + 935;
y = 0;
}
if (times == 6) {
twist = 0;
x = x + 935;
y = 0;
}
times++;
}
}
} else {
}
ImageIO.write(finalImg, "PNG", new File("C:\\Users\\User\\Documents\\SCJointer\\finished.png"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment