public DecodedPNGData(IdatChunk idatChunk, IhdrChunk ihdrChunk, PlteChunk plteChunk, string decodedIdat, string unfilteredDatastreamString, string filteredDatastreamString, byte[] unfilteredIdatDatastream, int scanlineLenght) { IdatChunk = idatChunk; IhdrChunk = ihdrChunk; PlteChunk = plteChunk; DecodedIdat = decodedIdat; UnfilteredDatastreamString = unfilteredDatastreamString; FilteredDatastreamString = filteredDatastreamString; UnfilteredIdatDatastream = unfilteredIdatDatastream; ScanlineLenght = scanlineLenght; }
internal DecodedPNGData DecodeByteArray(byte[] arrayByte) { IdatChunk idatChunk = ReadIdatChunk(arrayByte); PlteChunk plteChunk = ReadPlteChunk(arrayByte); IhdrChunk ihdrChunk = ReadIhdrChunk(arrayByte); int scanlineLenght = CalculateScanlineLenght(ihdrChunk); byte[] unfilteredIdatDatastream = UnfilterImageDatastream(scanlineLenght, idatChunk, ihdrChunk); string decodedBytes = PrintBytesToString(arrayByte, 8); string decodedAscii = PrintBytesToAsciiString(arrayByte); string decodedIdat = PrintBytesToString(idatChunk.DatastreamBytes, scanlineLenght); string unfilteredDatastreamString = PrintBytesToString(unfilteredIdatDatastream, scanlineLenght - 1); string filteredDatastreamString = PrintBytesToString(idatChunk.DatastreamBytes, scanlineLenght); return(new DecodedPNGData(idatChunk, ihdrChunk, plteChunk, decodedIdat, unfilteredDatastreamString, filteredDatastreamString, unfilteredIdatDatastream, scanlineLenght)); }
private void _read() { _len = m_io.ReadU4be(); _type = System.Text.Encoding.GetEncoding("UTF-8").GetString(m_io.ReadBytes(4)); switch (Type) { case "iTXt": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new InternationalTextChunk(io___raw_body, this, m_root); break; } case "gAMA": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new GamaChunk(io___raw_body, this, m_root); break; } case "tIME": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new TimeChunk(io___raw_body, this, m_root); break; } case "PLTE": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new PlteChunk(io___raw_body, this, m_root); break; } case "bKGD": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new BkgdChunk(io___raw_body, this, m_root); break; } case "pHYs": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new PhysChunk(io___raw_body, this, m_root); break; } case "tEXt": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new TextChunk(io___raw_body, this, m_root); break; } case "cHRM": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new ChrmChunk(io___raw_body, this, m_root); break; } case "sRGB": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new SrgbChunk(io___raw_body, this, m_root); break; } case "zTXt": { __raw_body = m_io.ReadBytes(Len); var io___raw_body = new KaitaiStream(__raw_body); _body = new CompressedTextChunk(io___raw_body, this, m_root); break; } default: { _body = m_io.ReadBytes(Len); break; } } _crc = m_io.ReadBytes(4); }