protected override void ImprintPNG(byte[] data) { uint[] crcTable = null; uint crc = PNG.CRC32(PNG_IDAT_HEADER, 0, PNG_IDAT_HEADER.Length, 0, ref crcTable); crc = PNG.CRC32(data, 0, data.Length, crc, ref crcTable); byte[] crcb = BitConverter.GetBytes(crc); int IEND = 0; for (int i = 0; i < image.Chunks.Count; i++) { if (image.Chunks[i].Name == "IEND") { IEND = i; break; } } image.Chunks.Insert(IEND, new PNGChunk() { Name = "IDAT", Standard = true, Critical = true, CRC = crc, CRCBytes = new byte[4] { crcb[3], crcb[2], crcb[1], crcb[0] }, ValidCRC = true, Data = data }); }
protected override void ImprintPNG(byte[] data) { uint[] crcTable = null; uint crc = PNG.CRC32(PNG_TEXT_HEADER, 0, PNG_TEXT_HEADER.Length, 0, ref crcTable); crc = PNG.CRC32(data, 0, data.Length, crc, ref crcTable); byte[] crcb = BitConverter.GetBytes(crc); image.Chunks.Insert(1, new PNGChunk() { Name = "tEXt", Standard = false, Critical = false, CRC = crc, CRCBytes = new byte[4] { crcb[3], crcb[2], crcb[1], crcb[0] }, ValidCRC = true, Data = data }); }