petite/src/wombat/scheme/libraries/ImageAPI.java
public static void writeImage(String dir, ImageData img, String filename) throws IOException {
		RenderedImage ri = new BufferedImage(img.Width, img.Height, BufferedImage.TYPE_INT_RGB);
		((BufferedImage) ri).setRGB(0, 0, img.Width, img.Height, img.Data, 0, img.Width);

		if (!new File(filename).isAbsolute())
			filename = new File(dir, filename).getCanonicalPath();
		
		File file = new File(filename);
		
		String[] parts = file.getName().split("\\.");
		ImageIO.write(ri, parts[parts.length - 1], file);
	}
/**
	 * Write the given [r,g,b,a] buffer to an image.
	 * @param dir The directory to read from.
	 * @param data The image to write. The first two values are the width and height.
	 * @param filename The file to write to.
	 * @throws IOException If we cannot write the image.
	 */
Write the given [r,g,b,a] buffer to an image.
@param dir The directory to read from.
@param data The image to write. The first two values are the width and height.
@param filename The file to write to.
@throws IOException If we cannot write the image.
Write the given [ r g b a ] buffer to an image . @param dir The directory to read from . @param data The image to write . The first two values are the width and height . @param filename The file to write to . @throws IOException If we cannot write the image .
public static void writeImage(String dir, ImageData img, String filename) throws IOException {
		RenderedImage ri = new BufferedImage(img.Width, img.Height, BufferedImage.TYPE_INT_RGB);
		((BufferedImage) ri).setRGB(0, 0, img.Width, img.Height, img.Data, 0, img.Width);
		if (!new File(filename).isAbsolute())
			filename = new File(dir, filename).getCanonicalPath();
		File file = new File(filename);
		String[] parts = file.getName().split("\\.");
		ImageIO.write(ri, parts[parts.length - 1], file);
	}
public static void writeImage ( String dir , ImageData img , String filename ) throws IOException { RenderedImage ri = new BufferedImage ( img . Width , img . Height , BufferedImage . TYPE_INT_RGB ) ; ( ( BufferedImage ) ri ) . setRGB ( 0 , 0 , img . Width , img . Height , img . Data , 0 , img . Width ) ; if ( ! new File ( filename ) . isAbsolute ( ) ) filename = new File ( dir , filename ) . getCanonicalPath ( ) ; File file = new File ( filename ) ; String [ ] parts = file . getName ( ) . split ( "\\." ) ; ImageIO . write ( ri , parts [ parts . length - 1 ] , file ) ; }
Write the given [r,g,b,a] buffer to an image.
Write the given [ r g b a ] buffer to an image .