Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjException


  }

  @Override
  public void parseFromRaw(ChunkRaw chunk) {
    if (chunk.len != 9)
      throw new PngjException("bad chunk length " + chunk);
    pixelsxUnitX = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
    if (pixelsxUnitX < 0)
      pixelsxUnitX += 0x100000000L;
    pixelsxUnitY = PngHelperInternal.readInt4fromBytes(chunk.data, 4);
    if (pixelsxUnitY < 0)
View Full Code Here


  public PngChunk getQueuedById1(final String id, final String innerid, final boolean failIfMultiple) {
    List<? extends PngChunk> list = getQueuedById(id, innerid);
    if (list.isEmpty())
      return null;
    if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple()))
      throw new PngjException("unexpected multiple chunks id=" + id);
    return list.get(list.size() - 1);
  }
View Full Code Here

  public PngChunk getById1(final String id, final String innerid, final boolean failIfMultiple) {
    List<? extends PngChunk> list = getById(id, innerid);
    if (list.isEmpty())
      return null;
    if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple()))
      throw new PngjException("unexpected multiple chunks id=" + id);
    return list.get(list.size() - 1);
  }
View Full Code Here

      shovelInToOut(in, out);
      in.close();
      out.close();
      return outb.toByteArray();
    } catch (Exception e) {
      throw new PngjException(e);
    }
  }
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw c) {
    if (!imgInfo.indexed)
      throw new PngjException("only indexed images accept a HIST chunk");
    int nentries = c.data.length / 2;
    hist = new int[nentries];
    for (int i = 0; i < hist.length; i++) {
      hist[i] = PngHelperInternal.readInt2fromBytes(c.data, i * 2);
    }
View Full Code Here

  }

  @Override
  public ChunkRaw createRawChunk() {
    if (!imgInfo.indexed)
      throw new PngjException("only indexed images accept a HIST chunk");
    ChunkRaw c = null;
    c = createEmptyChunk(hist.length * 2, true);
    for (int i = 0; i < hist.length; i++) {
      PngHelperInternal.writeInt2tobytes(hist[i], c.data, i * 2);
    }
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw chunk) {
    if (chunk.len != 9)
      throw new PngjException("bad chunk length " + chunk);
    posX = PngHelperInternal.readInt4fromBytes(chunk.data, 0);
    if (posX < 0)
      posX += 0x100000000L;
    posY = PngHelperInternal.readInt4fromBytes(chunk.data, 4);
    if (posY < 0)
View Full Code Here

    this.len = len;
    this.id = id;
    this.idbytes = ChunkHelper.toBytes(id);
    for (int i = 0; i < 4; i++) {
      if (idbytes[i] < 65 || idbytes[i] > 122 || (idbytes[i] > 90 && idbytes[i] < 97))
        throw new PngjException("Bad id chunk: must be ascii letters " + id);
    }
    if (alloc)
      allocData();
  }
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw chunk) {
    if (chunk.len != 1)
      throw new PngjException("bad chunk length " + chunk);
    mode = chunk.data[0];
  }
View Full Code Here

  }

  @Override
  public void parseFromRaw(ChunkRaw c) {
    if (c.len != 13)
      throw new PngjException("Bad IDHR len " + c.len);
    ByteArrayInputStream st = c.getAsByteStream();
    cols = PngHelperInternal.readInt4(st);
    rows = PngHelperInternal.readInt4(st);
    // bit depth: number of bits per channel
    bitspc = PngHelperInternal.readByte(st);
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.