Package ar.com.hjg.pngj.chunks

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


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

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

  @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

TOP

Related Classes of ar.com.hjg.pngj.chunks.PngChunkIHDR

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.