public override byte[] GetBytes() { byte[] bytes = new byte[13]; ByteUtils.GetBytes(Width).CopyTo(bytes, 0); ByteUtils.GetBytes(Height).CopyTo(bytes, 4); bytes[8] = BitDepth; bytes[9] = ColourType; bytes[10] = CompressionMethod; bytes[11] = FilterMethod; bytes[12] = InterlaceMethod; return(bytes); }
/// <summary> /// Return chunk as a byte array /// </summary> /// <returns>whole data chunk, as byte array</returns> public byte[] GetBytes() { UpdateData(); UpdateLength(); UpdateCrc(); byte[] bytes = new byte[Length + 12]; Array.Copy(ByteUtils.GetBytes(Length), 0, bytes, 0, 4); Array.Copy(Type.Type, 0, bytes, 4, 4); Array.Copy(data, 0, bytes, 8, Length); Array.Copy(ByteUtils.GetBytes(CRC), 0, bytes, Length + 8, 4); return(bytes); }
public override string ToString() { StringBuilder ret = new StringBuilder(); ret.Append(Length); ret.Append(' '); foreach (byte b in Type.Type) { ret.Append((char)b); } ret.Append(' '); foreach (byte b in Data) { ret.Append(b); } ret.Append(' '); foreach (byte b in ByteUtils.GetBytes(CRC)) { ret.Append(b.ToString("X2")); } return(ret.ToString()); }
public override byte[] GetBytes() { return(ByteUtils.GetBytes(gamma)); }