/// <summary> /// Writes a <see cref="IccResponseCurveSet16TagDataEntry"/> /// </summary> /// <param name="value">The entry to write</param> /// <returns>The number of bytes written</returns> public int WriteResponseCurveSet16TagDataEntry(IccResponseCurveSet16TagDataEntry value) { long start = this.dataStream.Position - 8; int count = this.WriteUInt16(value.ChannelCount); count += this.WriteUInt16((ushort)value.Curves.Length); // Jump over position table long tablePosition = this.dataStream.Position; this.dataStream.Position += value.Curves.Length * 4; uint[] offset = new uint[value.Curves.Length]; for (int i = 0; i < value.Curves.Length; i++) { offset[i] = (uint)(this.dataStream.Position - start); count += this.WriteResponseCurve(value.Curves[i]); count += this.WritePadding(); } // Write position table long lpos = this.dataStream.Position; this.dataStream.Position = tablePosition; count += this.WriteArray(offset); this.dataStream.Position = lpos; return(count); }
internal void ReadResponseCurveSet16TagDataEntry(byte[] data, IccResponseCurveSet16TagDataEntry expected) { IccDataReader reader = CreateReader(data); IccResponseCurveSet16TagDataEntry output = reader.ReadResponseCurveSet16TagDataEntry(); Assert.Equal(expected, output); }
internal void WriteResponseCurveSet16TagDataEntry(byte[] expected, IccResponseCurveSet16TagDataEntry data) { IccDataWriter writer = CreateWriter(); writer.WriteResponseCurveSet16TagDataEntry(data); byte[] output = writer.GetData(); Assert.Equal(expected, output); }