private void writeHeader( final DataOutputStream stream, final int xsize, final int ysize, final int zsize, final boolean rle) throws IOException { // effects: outputs the 512-byte IRIS RGB header to STREAM, using xsize, // ysize, and depth as the dimensions of the image. NOTE that // the following defaults are used: // STORAGE = 1 (storage format = RLE) // BPC = 1 (# bytes/channel) // DIMENSION = 3 // PIXMIN = 0 // PIXMAX = 255 // IMAGENAME = <80 nulls> // COLORMAP = 0 // See ftp://ftp.sgi.com/pub/sgi/SGIIMAGESPEC for more details. // write out MAGIC, STORAGE, BPC stream.writeShort(474); stream.write((rle ? 1 : 0)); stream.write(1); // write out DIMENSION stream.writeShort(3); // write XSIZE, YSIZE, ZSIZE stream.writeShort(xsize); stream.writeShort(ysize); stream.writeShort(zsize); // write PIXMIN, PIXMAX stream.writeInt(0); stream.writeInt(255); // write DUMMY stream.writeInt(0); // write IMAGENAME for (int i = 0; i < 80; i++) stream.write(0); // write COLORMAP stream.writeInt(0); // write DUMMY (404 bytes) for (int i = 0; i < 404; i++) stream.write(0); }