Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjException


    return new int[] {red, green, blue};
  }

  public int getRGB888() {
    if (imgInfo.greyscale || imgInfo.indexed)
      throw new PngjException("only rgb or rgba images support this");
    return (red << 16) | (green << 8) | blue;
  }
View Full Code Here


    return (red << 16) | (green << 8) | blue;
  }

  public void setGray(int g) {
    if (!imgInfo.greyscale)
      throw new PngjException("only grayscale images support this");
    gray = g;
  }
View Full Code Here

    gray = g;
  }

  public int getGray() {
    if (!imgInfo.greyscale)
      throw new PngjException("only grayscale images support this");
    return gray;
  }
View Full Code Here

  /**
   * WARNING: non deep copy
   */
  public void setPalletteAlpha(int[] palAlpha) {
    if (!imgInfo.indexed)
      throw new PngjException("only indexed images support this");
    paletteAlpha = palAlpha;
  }
View Full Code Here

  /**
   * to use when only one pallete index is set as totally transparent
   */
  public void setIndexEntryAsTransparent(int palAlphaIndex) {
    if (!imgInfo.indexed)
      throw new PngjException("only indexed images support this");
    paletteAlpha = new int[] {palAlphaIndex + 1};
    for (int i = 0; i < palAlphaIndex; i++)
      paletteAlpha[i] = 255;
    paletteAlpha[palAlphaIndex] = 0;
  }
View Full Code Here

  public void parseFromRaw(ChunkRaw chunk) {
    int pos0 = ChunkHelper.posNullByte(chunk.data);
    profileName = ChunkHelper.toString(chunk.data, 0, pos0);
    int comp = (chunk.data[pos0 + 1] & 0xff);
    if (comp != 0)
      throw new PngjException("bad compression for ChunkTypeICCP");
    int compdatasize = chunk.data.length - (pos0 + 2);
    compressedProfile = new byte[compdatasize];
    System.arraycopy(chunk.data, pos0 + 2, compressedProfile, 0, compdatasize);
  }
View Full Code Here

   * @param gray
   */
  public void setGray(int gray) {
    invalidateRaw();
    if (!imgInfo.greyscale)
      throw new PngjException("only gray images support this");
    this.gray = gray;
  }
View Full Code Here

    this.gray = gray;
  }

  public int getGray() {
    if (!imgInfo.greyscale)
      throw new PngjException("only gray images support this");
    return gray;
  }
View Full Code Here

   *
   */
  public void setPaletteIndex(int i) {
    invalidateRaw();
    if (!imgInfo.indexed)
      throw new PngjException("only indexed (pallete) images support this");
    this.paletteIndex = i;
  }
View Full Code Here

    this.paletteIndex = i;
  }

  public int getPaletteIndex() {
    if (!imgInfo.indexed)
      throw new PngjException("only indexed (pallete) images support this");
    return paletteIndex;
  }
View Full Code Here

TOP

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

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.