Beispiel #1
0
        /// <summary>
        /// Writes a <see cref="IccResponseCurve"/>
        /// </summary>
        /// <param name="value">The curve to write</param>
        /// <returns>The number of bytes written</returns>
        public int WriteResponseCurve(IccResponseCurve value)
        {
            int count    = this.WriteUInt32((uint)value.CurveType);
            int channels = value.XyzValues.Length;

            foreach (IccResponseNumber[] responseArray in value.ResponseArrays)
            {
                count += this.WriteUInt32((uint)responseArray.Length);
            }

            foreach (Vector3 xyz in value.XyzValues)
            {
                count += this.WriteXyzNumber(xyz);
            }

            foreach (IccResponseNumber[] responseArray in value.ResponseArrays)
            {
                foreach (IccResponseNumber response in responseArray)
                {
                    count += this.WriteResponseNumber(response);
                }
            }

            return(count);
        }
        /// <summary>
        /// Reads a <see cref="IccResponseCurveSet16TagDataEntry"/>
        /// </summary>
        /// <returns>The read entry</returns>
        public IccResponseCurveSet16TagDataEntry ReadResponseCurveSet16TagDataEntry()
        {
            int    start           = this.currentIndex - 8; // 8 is the tag header size
            ushort channelCount    = this.ReadUInt16();
            ushort measurmentCount = this.ReadUInt16();

            uint[] offset = new uint[measurmentCount];
            for (int i = 0; i < measurmentCount; i++)
            {
                offset[i] = this.ReadUInt32();
            }

            IccResponseCurve[] curves = new IccResponseCurve[measurmentCount];
            for (int i = 0; i < measurmentCount; i++)
            {
                this.currentIndex = (int)(start + offset[i]);
                curves[i]         = this.ReadResponseCurve(channelCount);
            }

            return(new IccResponseCurveSet16TagDataEntry(curves));
        }