Examples of PngChunkIhdr


Examples of ar.com.hjg.pngj.chunks.PngChunkIHDR

  @Override
  protected void postProcessChunk(ChunkReader chunkR) {
    super.postProcessChunk(chunkR);
    if (chunkR.getChunkRaw().id.equals(PngChunkIHDR.ID)) {
      PngChunkIHDR ch = new PngChunkIHDR(null);
      ch.parseFromRaw(chunkR.getChunkRaw());
      imageInfo = ch.createImageInfo();
      if (ch.isInterlaced())
        deinterlacer = new Deinterlacer(imageInfo);
      chunksList = new ChunksList(imageInfo);
    }
    if (chunkR.mode == ChunkReaderMode.BUFFER || includeNonBufferedChunks) {
      PngChunk chunk = chunkFactory.createChunk(chunkR.getChunkRaw(), getImageInfo());
View Full Code Here

Examples of ar.com.hjg.pngj.chunks.PngChunkIHDR

   */
  private void writeSignatureAndIHDR() {
    currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR;

    PngHelperInternal.writeBytes(os, PngHelperInternal.getPngIdSignature()); // signature
    PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo);
    // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
    ihdr.setCols(imgInfo.cols);
    ihdr.setRows(imgInfo.rows);
    ihdr.setBitspc(imgInfo.bitDepth);
    int colormodel = 0;
    if (imgInfo.alpha)
      colormodel += 0x04;
    if (imgInfo.indexed)
      colormodel += 0x01;
    if (!imgInfo.greyscale)
      colormodel += 0x02;
    ihdr.setColormodel(colormodel);
    ihdr.setCompmeth(0); // compression method 0=deflate
    ihdr.setFilmeth(0); // filter method (0)
    ihdr.setInterlaced(0); // we never interlace
    ihdr.createRawChunk().writeChunk(os);
    chunksList.getChunks().add(ihdr);
  }
View Full Code Here

Examples of ar.com.hjg.pngj.chunks.PngChunkIHDR

   */
  private void writeSignatureAndIHDR() {
    currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR;

    PngHelperInternal.writeBytes(os, PngHelperInternal.getPngIdSignature()); // signature
    PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo);
    // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
    ihdr.setCols(imgInfo.cols);
    ihdr.setRows(imgInfo.rows);
    ihdr.setBitspc(imgInfo.bitDepth);
    int colormodel = 0;
    if (imgInfo.alpha)
      colormodel += 0x04;
    if (imgInfo.indexed)
      colormodel += 0x01;
    if (!imgInfo.greyscale)
      colormodel += 0x02;
    ihdr.setColormodel(colormodel);
    ihdr.setCompmeth(0); // compression method 0=deflate
    ihdr.setFilmeth(0); // filter method (0)
    ihdr.setInterlaced(0); // we never interlace
    ihdr.createRawChunk().writeChunk(os);
    chunksList.getChunks().add(ihdr);
  }
View Full Code Here

Examples of ar.com.hjg.pngj.chunks.PngChunkIHDR

  @Override
  protected void postProcessChunk(ChunkReader chunkR) {
    super.postProcessChunk(chunkR);
    if (chunkR.getChunkRaw().id.equals(PngChunkIHDR.ID)) {
      PngChunkIHDR ch = new PngChunkIHDR(null);
      ch.parseFromRaw(chunkR.getChunkRaw());
      imageInfo = ch.createImageInfo();
      if (ch.isInterlaced())
        deinterlacer = new Deinterlacer(imageInfo);
      chunksList = new ChunksList(imageInfo);
    }
    if (chunkR.mode == ChunkReaderMode.BUFFER || includeNonBufferedChunks) {
      PngChunk chunk = chunkFactory.createChunk(chunkR.getChunkRaw(), getImageInfo());
View Full Code Here

Examples of org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr

                } else if (chunkType == ChunkType.tEXt.value) {
                    result.add(new PngChunkText(length, chunkType, crc, bytes));
                } else if (chunkType == ChunkType.zTXt.value) {
                    result.add(new PngChunkZtxt(length, chunkType, crc, bytes));
                } else if (chunkType == ChunkType.IHDR.value) {
                    result.add(new PngChunkIhdr(length, chunkType, crc, bytes));
                } else if (chunkType == ChunkType.PLTE.value) {
                    result.add(new PngChunkPlte(length, chunkType, crc, bytes));
                } else if (chunkType == ChunkType.pHYs.value) {
                    result.add(new PngChunkPhys(length, chunkType, crc, bytes));
                } else if (chunkType == ChunkType.IDAT.value) {
View Full Code Here

Examples of org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr

        if (chunks.size() > 1) {
            throw new ImageReadException("PNG contains more than one Header");
        }

        final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) chunks.get(0);

        return new Dimension(pngChunkIHDR.width, pngChunkIHDR.height);
    }
View Full Code Here

Examples of org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr

        final List<PngChunk> IHDRs = filterChunks(chunks, ChunkType.IHDR);
        if (IHDRs.size() != 1) {
            throw new ImageReadException("PNG contains more than one Header");
        }

        final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) IHDRs.get(0);

        boolean transparent = false;

        final List<PngChunk> tRNSs = filterChunks(chunks, ChunkType.tRNS);
        if (!tRNSs.isEmpty()) {
View Full Code Here

Examples of org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr

        final List<PngChunk> IHDRs = filterChunks(chunks, ChunkType.IHDR);
        if (IHDRs.size() != 1) {
            throw new ImageReadException("PNG contains more than one Header");
        }

        final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) IHDRs.get(0);

        final List<PngChunk> PLTEs = filterChunks(chunks, ChunkType.PLTE);
        if (PLTEs.size() > 1) {
            throw new ImageReadException("PNG contains more than one Palette");
        }
View Full Code Here

Examples of org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr

            if (getDebug()) {
                System.out.println("PNG contains more than one Header");
            }
            return false;
        }
        final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) IHDRs.get(0);
        pw.println("Color: " + pngChunkIHDR.colorType.name());

        pw.println("chunks: " + chunks.size());

        if ((chunks.isEmpty())) {
View Full Code Here

Examples of org.apache.sanselan.formats.png.chunks.PNGChunkIHDR

                else if (chunkType == tEXt)
                    result.add(new PNGChunktEXt(length, chunkType, CRC, bytes));
                else if (chunkType == zTXt)
                    result.add(new PNGChunkzTXt(length, chunkType, CRC, bytes));
                else if (chunkType == IHDR)
                    result.add(new PNGChunkIHDR(length, chunkType, CRC, bytes));
                else if (chunkType == PLTE)
                    result.add(new PNGChunkPLTE(length, chunkType, CRC, bytes));
                else if (chunkType == pHYs)
                    result.add(new PNGChunkpHYs(length, chunkType, CRC, bytes));
                else if (chunkType == IDAT)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.