import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; /** * This class is intended to help you convert from a standard format (either * JPEG or PNG into the image format that I use with the ImageEditor. It uses * calls of functions in the ImageEditor so when you run it you will have to * make sure one of the assignment jar files is in your classpath. Unfortunately * it also uses libraries that Together doesn't know about. On the Janus * machines you can compile it and execute it with the following commands. * * javac -classpath /users/mlewis/Local/HTML-Documents/CSCI1321-S03/Assn3/PAD2Assn3.jar:. Converter.java * * java -classpath /users/mlewis/Local/HTML-Documents/CSCI1321-S03/Assn3/PAD2Assn3.jar:. Converter [args] * * See the comments on main for what list of arguments you need to supply. * */ public class Converter { /** * This main is used to build a 2D array of images that are loaded from * file. It requires a number of arguments that tell it how many elements * it should put in the array. It then saves those images in the format * used by my image editor so that you can easily load them into your game. * The first two arguments are the output file name and the the number of * rows of images (length of the array for the first index). For each row, * you will provide at least two arguments. The first is the number of * columns in that row then that number of file names for the actual files * to import. * * For example, to read in one image only you could give the arguments * TreeBlock.pic 1 1 StaticImage.png * * To read in two rows, one with 2 images and one with 3 you could do * Ball.pic 2 2 Pop1.png Pop2.png 3 Bounce1.png Bounce2.png Bounce3.png * * These go in the place of [args] in the command line above. */ public static void main(String[] args) { int rows=Integer.parseInt(args[1]); BufferedImage[][] img=new BufferedImage[rows][]; int curArg=2; try { for(int i=0; i