hey guys...
those methods in the class ImageOut create a FileOutputStream, but does not close it...
Code:
public static void write(Image image, String format, String dest, boolean writeAlpha) throws SlickException {
try {
write(image, format, new FileOutputStream(dest), writeAlpha);
} catch (IOException e) {
throw new SlickException("Unable to write to the destination: "+dest, e);
}
}
public static void write(Image image, String dest, boolean writeAlpha) throws SlickException {
try {
int ext = dest.lastIndexOf('.');
if (ext < 0) {
throw new SlickException("Unable to determine format from: "+dest);
}
String format = dest.substring(ext+1);
write(image, format, new FileOutputStream(dest), writeAlpha);
} catch (IOException e) {
throw new SlickException("Unable to write to the destination: "+dest, e);
}
}
the ImageIOWriter implementation uses the javax.imageio.ImageIO.write() method to store the image. copy from javadoc:
Quote:
* <p> This method <em>does not</em> close the provided
* <code>OutputStream</code> after the write operation has completed;
* it is the responsibility of the caller to close the stream, if desired.
thus, the created image cannot be opened until the program is closed due to this bug...
And I would suggest to use a Thread for the IO operation. its not possible to use a thread outside the library because until the image is rendered, the GLRenderer is used in the same thread, but the IO operation is handled inside this method...
greetz ben