return new ImageInfo(getCols(), getRows(), getBitspc(), alpha, grayscale, palette);
}
public void check() {
if (cols < 1 || rows < 1 || compmeth != 0 || filmeth != 0)
throw new PngjInputException("bad IHDR: col/row/compmethod/filmethod invalid");
if (bitspc != 1 && bitspc != 2 && bitspc != 4 && bitspc != 8 && bitspc != 16)
throw new PngjInputException("bad IHDR: bitdepth invalid");
if (interlaced < 0 || interlaced > 1)
throw new PngjInputException("bad IHDR: interlace invalid");
switch (colormodel) {
case 0:
break;
case 3:
if (bitspc == 16)
throw new PngjInputException("bad IHDR: bitdepth invalid");
break;
case 2:
case 4:
case 6:
if (bitspc != 8 && bitspc != 16)
throw new PngjInputException("bad IHDR: bitdepth invalid");
break;
default:
throw new PngjInputException("bad IHDR: invalid colormodel");
}
}