示例#1
0
        internal static CurveSegment GetCurve(byte[] iccData, int idx)
        {
            //Tag signature (4 bytes) (plus 4 bytes reserved)
            CurveSegment          curve;
            CurveSegmentSignature t = (CurveSegmentSignature)HighEndianReader.GetUint32(iccData, idx);

            if (t == CurveSegmentSignature.FormulaCurve)
            {
                curve = new FormulaCurveElement();
                curve.GetCurveData(iccData, idx + 8, false);

                return(curve);
            }
            else if
            (t == CurveSegmentSignature.SampledCurve)
            {
                curve = new SampledCurveElement();
                curve.GetCurveData(iccData, idx + 8, false);
                return(curve);
            }
            else
            {
                throw new CorruptProfileException("CurveSegment");
            }
        }
示例#2
0
文件: Curves.cs 项目: vavavr00m/NCM
        /// <summary>
        /// Creates a new instance of the <see cref="CurveSegment"/> class
        /// </summary>
        /// <param name="Signature">The signature of this segment</param>
        protected CurveSegment(CurveSegmentSignature Signature)
        {
            if (!Enum.IsDefined(typeof(CurveSegmentSignature), Signature))
            {
                throw new ArgumentException($"{nameof(Signature)} value is not of a defined Enum value");
            }

            this.Signature = Signature;
        }
示例#3
0
        internal static CurveSegment GetCurve(int idx)
        {
            //Tag signature (4 bytes) (plus 4 bytes reserved)
            CurveSegmentSignature t = (CurveSegmentSignature)Helper.GetUInt32(idx);

            if (t == CurveSegmentSignature.FormulaCurve)
            {
                return(new FormulaCurveElement(idx + 8));
            }
            else if (t == CurveSegmentSignature.SampledCurve)
            {
                return(new SampledCurveElement(idx + 8));
            }
            else
            {
                throw new CorruptProfileException("CurveSegment");
            }
        }