|
|
@ -1,6 +1,7 @@
|
|
|
|
package eu.jonahbauer.raytracing.render;
|
|
|
|
package eu.jonahbauer.raytracing.render;
|
|
|
|
|
|
|
|
|
|
|
|
import eu.jonahbauer.raytracing.render.canvas.Canvas;
|
|
|
|
import eu.jonahbauer.raytracing.render.canvas.Canvas;
|
|
|
|
|
|
|
|
import eu.jonahbauer.raytracing.render.canvas.Image;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.*;
|
|
|
@ -10,6 +11,7 @@ import java.nio.file.Path;
|
|
|
|
import java.util.zip.CRC32;
|
|
|
|
import java.util.zip.CRC32;
|
|
|
|
import java.util.zip.CheckedOutputStream;
|
|
|
|
import java.util.zip.CheckedOutputStream;
|
|
|
|
import java.util.zip.DeflaterOutputStream;
|
|
|
|
import java.util.zip.DeflaterOutputStream;
|
|
|
|
|
|
|
|
import java.util.zip.InflaterInputStream;
|
|
|
|
|
|
|
|
|
|
|
|
public enum ImageFormat {
|
|
|
|
public enum ImageFormat {
|
|
|
|
PPM {
|
|
|
|
PPM {
|
|
|
@ -93,7 +95,7 @@ public enum ImageFormat {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var bytes = baos.toByteArray();
|
|
|
|
var bytes = baos.toByteArray();
|
|
|
|
data.writeInt(bytes.length);
|
|
|
|
data.writeInt(bytes.length - 4); // don't include type in length
|
|
|
|
data.write(bytes);
|
|
|
|
data.write(bytes);
|
|
|
|
data.writeInt((int) crc.getChecksum().getValue());
|
|
|
|
data.writeInt((int) crc.getChecksum().getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|