Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjInputException


    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");
    }
  }
View Full Code Here


    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");
    }
  }
View Full Code Here

TOP

Related Classes of ar.com.hjg.pngj.PngjInputException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.