fix checksum of IEND chunk
BIN
docs/cornell.png
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 441 KiB After Width: | Height: | Size: 441 KiB |
BIN
docs/simple.png
Before Width: | Height: | Size: 881 KiB After Width: | Height: | Size: 881 KiB |
BIN
docs/squares.png
Before Width: | Height: | Size: 620 KiB After Width: | Height: | Size: 620 KiB |
@ -41,6 +41,7 @@ public enum ImageFormat {
|
|||||||
private static final int IHDR_TYPE = 0x49484452;
|
private static final int IHDR_TYPE = 0x49484452;
|
||||||
private static final int IDAT_TYPE = 0x49444154;
|
private static final int IDAT_TYPE = 0x49444154;
|
||||||
private static final int IEND_TYPE = 0x49454E44;
|
private static final int IEND_TYPE = 0x49454E44;
|
||||||
|
private static final int IEND_CRC = 0xAE426082;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(@NotNull Canvas image, @NotNull OutputStream out) throws IOException {
|
public void write(@NotNull Canvas image, @NotNull OutputStream out) throws IOException {
|
||||||
@ -101,7 +102,7 @@ public enum ImageFormat {
|
|||||||
private void writeIEND(@NotNull Canvas image, @NotNull DataOutputStream data) throws IOException {
|
private void writeIEND(@NotNull Canvas image, @NotNull DataOutputStream data) throws IOException {
|
||||||
data.writeInt(0);
|
data.writeInt(0);
|
||||||
data.writeInt(IEND_TYPE);
|
data.writeInt(IEND_TYPE);
|
||||||
data.writeInt(0);
|
data.writeInt(IEND_CRC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoCloseDataOutputStream extends DataOutputStream {
|
private static class NoCloseDataOutputStream extends DataOutputStream {
|
||||||
|