Package ar.com.hjg.pngj

Examples of ar.com.hjg.pngj.PngjException


  }

  @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


   * 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

   * @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

    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

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.