Hjg.Pngcs.PngReader.GetChunksList C# (CSharp) Method

GetChunksList() public method

Returns the ancillary chunks available
If the rows have not yet still been read, this includes only the chunks placed before the pixels (IDAT)
public GetChunksList ( ) : Hjg.Pngcs.Chunks.ChunksList
return Hjg.Pngcs.Chunks.ChunksList
        public ChunksList GetChunksList()
        {
            if (FirstChunksNotYetRead())
                ReadFirstChunks();
            return chunksList;
        }

Usage Example

Exemplo n.º 1
0
 /// <summary>
   /// copy chunks from reader - copy_mask : see ChunksToWrite.COPY_XXX
   /// If we are after idat, only considers those chunks after IDAT in PngReader
   /// TODO: this should be more customizable
   /// </summary>
   ///
   private void CopyChunks(PngReader reader, int copy_mask, bool onlyAfterIdat) {
       bool idatDone = CurrentChunkGroup >= ChunksList.CHUNK_GROUP_4_IDAT;
       if (onlyAfterIdat && reader.CurrentChunkGroup < ChunksList.CHUNK_GROUP_6_END) throw new PngjException("tried to copy last chunks but reader has not ended");
       foreach (PngChunk chunk in reader.GetChunksList().GetChunks()) {
           int group = chunk.ChunkGroup;
           if (group < ChunksList.CHUNK_GROUP_4_IDAT && idatDone)
               continue;
           bool copy = false;
           if (chunk.Crit) {
               if (chunk.Id.Equals(ChunkHelper.PLTE, StringComparison.InvariantCultureIgnoreCase)) {
                   if (ImgInfo.Indexed && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_PALETTE))
                       copy = true;
                   if (!ImgInfo.Greyscale && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALL))
                       copy = true;
               }
           } else { // ancillary
               bool text = chunk is PngChunkTextVar;
               bool safe = chunk.Safe;
               // notice that these if are not exclusive
               if (ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALL))
                   copy = true;
               if (safe && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALL_SAFE))
                   copy = true;
               if (chunk.Id.Equals(ChunkHelper.tRNS, StringComparison.InvariantCultureIgnoreCase)
                       && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_TRANSPARENCY))
                   copy = true;
               if (chunk.Id.Equals(ChunkHelper.pHYs, StringComparison.InvariantCultureIgnoreCase) && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_PHYS))
                   copy = true;
               if (text && ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_TEXTUAL))
                   copy = true;
               if (ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALMOSTALL)
                       && !(ChunkHelper.IsUnknown(chunk) || text || chunk.Id.Equals(ChunkHelper.hIST, StringComparison.InvariantCultureIgnoreCase) || chunk.Id.Equals(ChunkHelper.tIME, StringComparison.InvariantCultureIgnoreCase)))
                   copy = true;
               if (chunk is PngChunkSkipped)
                   copy = false;
           }
           if (copy)
             chunksList.Queue(PngChunk.CloneChunk(chunk, ImgInfo));
       }
   }
All Usage Examples Of Hjg.Pngcs.PngReader::GetChunksList