Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjException


  }

  @Override
  public ChunkRaw createRawChunk() {
    if (key == null || key.trim().length() == 0)
      throw new PngjException("Text chunk key must be non empty");
    byte[] b = ChunkHelper.toBytes(key + "\0" + val);
    ChunkRaw chunk = createEmptyChunk(b.length, false);
    chunk.data = b;
    return chunk;
  }
View Full Code Here


  }

  @Override
  public void parseFromRaw(ChunkRaw c) {
    if (c.len != 32)
      throw new PngjException("bad chunk " + c);
    whitex = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 0));
    whitey = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 4));
    redx = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 8));
    redy = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 12));
    greenx = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 16));
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw c) {
    if (c.len != 1)
      throw new PngjException("bad chunk length " + c);
    intent = PngHelperInternal.readInt1fromByte(c.data, 0);
  }
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw c) {
    if (c.len != getCLen())
      throw new PngjException("bad chunk length " + c);
    if (imgInfo.greyscale) {
      graysb = PngHelperInternal.readInt1fromByte(c.data, 0);
      if (imgInfo.alpha)
        alphasb = PngHelperInternal.readInt1fromByte(c.data, 1);
    } else {
View Full Code Here

    return other;
  }

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

    graysb = gray;
  }

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

    return graysb;
  }

  public void setAlphasb(int a) {
    if (!imgInfo.alpha)
      throw new PngjException("only images with alpha support this");
    alphasb = a;
  }
View Full Code Here

    alphasb = a;
  }

  public int getAlphasb() {
    if (!imgInfo.alpha)
      throw new PngjException("only images with alpha support this");
    return alphasb;
  }
View Full Code Here

   * Set rgb values
   *
   */
  public void setRGB(int r, int g, int b) {
    if (imgInfo.greyscale || imgInfo.indexed)
      throw new PngjException("only rgb or rgba images support this");
    redsb = r;
    greensb = g;
    bluesb = b;
  }
View Full Code Here

    bluesb = b;
  }

  public int[] getRGB() {
    if (imgInfo.greyscale || imgInfo.indexed)
      throw new PngjException("only rgb or rgba images support this");
    return new int[] { redsb, greensb, bluesb };
  }
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.