- Joined
- Jul 7, 2010
- Messages
- 3,882
- Trophies
- 2
- Location
- /dev/random
- Website
- www.gudenau.net
- XP
- 5,426
- Country
Hmm. Could you check to make sure you are creating splash.bin properly? Not sure what else could be causing garbage graphics.
Code:
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import javax.imageio.ImageIO;
public class SplashConvert {
public static void main(String[] args) throws Throwable{
System.out.println(args[0]);
System.out.println(args[1]);
BufferedImage image = ImageIO.read(new File(args[0]));
FileOutputStream out = new FileOutputStream(new File(args[1]));
int[] data = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, image.getWidth());
byte[] buffer = new byte[data.length * 3];
for(int i = 0; i < data.length; i++){
buffer[i*3] = (byte) (data[i] & 0x000000FF);
buffer[i*3+1] = (byte) ((data[i]>>8) & 0x000000FF);
buffer[i*3+2] = (byte) ((data[i]>>16) & 0x000000FF);
}
out.write(buffer);
out.close();
}
}