Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjException


    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

  }

  @Override
  public void parseFromRaw(ChunkRaw chunk) {
    if (chunk.len != 7)
      throw new PngjException("bad chunk " + chunk);
    year = PngHelperInternal.readInt2fromBytes(chunk.data, 0);
    mon = PngHelperInternal.readInt1fromByte(chunk.data, 2);
    day = PngHelperInternal.readInt1fromByte(chunk.data, 3);
    hour = PngHelperInternal.readInt1fromByte(chunk.data, 4);
    min = PngHelperInternal.readInt1fromByte(chunk.data, 5);
View Full Code Here

   * it. However if that not check for already written chunks.
   */
  public void queueChunk(final PngChunk c, boolean lazyOverwrite) {
    ChunksListForWrite cl = getChunkListW();
    if (readonly)
      throw new PngjException("cannot set chunk : readonly metadata");
    if (lazyOverwrite) {
      ChunkHelper.trimList(cl.getQueuedChunks(), new ChunkPredicate() {
        public boolean match(PngChunk c2) {
          return ChunkHelper.equivalent(c, c2);
        }
View Full Code Here

   * @param compress
   * @return Returns the created-queued chunks, just in case you want to examine, touch it
   */
  public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress) {
    if (compress && !useLatin1)
      throw new PngjException("cannot compress non latin text");
    PngChunkTextVar c;
    if (useLatin1) {
      if (compress) {
        c = new PngChunkZTXT(chunkList.imageInfo);
      } else {
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");
    red = r;
    green = g;
    blue = b;
  }
View Full Code Here

    blue = b;
  }

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