/// <summary>
 /// Initializes a new instance of the <see cref="IccUcrBgTagDataEntry"/> class.
 /// </summary>
 /// <param name="ucrCurve">UCR (under color removal) curve values</param>
 /// <param name="bgCurve">BG (black generation) curve values</param>
 /// <param name="description">Description of the used UCR and BG method</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccUcrBgTagDataEntry(ushort[] ucrCurve, ushort[] bgCurve, string description, IccProfileTag tagSignature)
     : base(IccTypeSignature.UcrBg, tagSignature)
 {
     this.UcrCurve    = ucrCurve ?? throw new ArgumentNullException(nameof(ucrCurve));
     this.BgCurve     = bgCurve ?? throw new ArgumentNullException(nameof(bgCurve));
     this.Description = description ?? throw new ArgumentNullException(nameof(description));
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccNamedColor2TagDataEntry"/> class.
 /// </summary>
 /// <param name="colors">The named colors</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccNamedColor2TagDataEntry(IccNamedColor[] colors, IccProfileTag tagSignature)
     : this(0, null, null, colors, tagSignature)
 {
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IccNamedColor2TagDataEntry"/> class.
        /// </summary>
        /// <param name="vendorFlags">Vendor specific flags</param>
        /// <param name="prefix">Prefix</param>
        /// <param name="suffix">Suffix</param>
        /// <param name="colors">The named colors</param>
        /// <param name="tagSignature">Tag Signature</param>
        public IccNamedColor2TagDataEntry(int vendorFlags, string prefix, string suffix, IccNamedColor[] colors, IccProfileTag tagSignature)
            : base(IccTypeSignature.NamedColor2, tagSignature)
        {
            //Guard.NotNull(colors, nameof(colors));

            int coordinateCount = 0;

            if (colors.Length > 0)
            {
                coordinateCount = colors[0].DeviceCoordinates?.Length ?? 0;

                //   Guard.IsFalse(colors.Any(t => (t.DeviceCoordinates?.Length ?? 0) != coordinateCount), nameof(colors), "Device coordinate count must be the same for all colors");
            }

            this.VendorFlags     = vendorFlags;
            this.CoordinateCount = coordinateCount;
            this.Prefix          = prefix;
            this.Suffix          = suffix;
            this.Colors          = colors;
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccTextTagDataEntry"/> class.
 /// </summary>
 /// <param name="text">The Text</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccTextTagDataEntry(string text, IccProfileTag tagSignature)
     : base(IccTypeSignature.Text, tagSignature)
 {
     this.Text = text ?? throw new ArgumentNullException(nameof(text));
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccLut8TagDataEntry"/> class.
 /// </summary>
 /// <param name="inputValues">Input LUT</param>
 /// <param name="clutValues">CLUT</param>
 /// <param name="outputValues">Output LUT</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccLut8TagDataEntry(IccLut[] inputValues, IccClut clutValues, IccLut[] outputValues, IccProfileTag tagSignature)
     : this(IdentityMatrix, inputValues, clutValues, outputValues, tagSignature)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IccScreeningTagDataEntry"/> class.
        /// </summary>
        /// <param name="flags">Screening flags</param>
        /// <param name="channels">Channel information</param>
        /// <param name="tagSignature">Tag Signature</param>
        public IccScreeningTagDataEntry(IccScreeningFlag flags, IccScreeningChannel[] channels, IccProfileTag tagSignature)
            : base(IccTypeSignature.Screening, tagSignature)
        {
            Guard.NotNull(channels, nameof(channels));

            this.Flags    = flags;
            this.Channels = channels;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccSignatureTagDataEntry"/> class.
 /// </summary>
 /// <param name="signatureData">The Signature</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccSignatureTagDataEntry(string signatureData, IccProfileTag tagSignature)
     : base(IccTypeSignature.Signature, tagSignature)
 {
     Guard.NotNull(signatureData, nameof(signatureData));
     this.SignatureData = signatureData;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccTextTagDataEntry"/> class.
 /// </summary>
 /// <param name="text">The Text</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccTextTagDataEntry(string text, IccProfileTag tagSignature)
     : base(IccTypeSignature.Text, tagSignature)
 {
     Guard.NotNull(text, nameof(text));
     this.Text = text;
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccParametricCurveTagDataEntry"/> class.
 /// </summary>
 /// <param name="curve">The Curve</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccParametricCurveTagDataEntry(IccParametricCurve curve, IccProfileTag tagSignature)
     : base(IccTypeSignature.ParametricCurve, tagSignature)
 {
     this.Curve = curve ?? throw new ArgumentNullException(nameof(curve));
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccMultiLocalizedUnicodeTagDataEntry"/> class.
 /// </summary>
 /// <param name="texts">Localized Text</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccMultiLocalizedUnicodeTagDataEntry(IccLocalizedString[] texts, IccProfileTag tagSignature)
     : base(IccTypeSignature.MultiLocalizedUnicode, tagSignature)
 {
     Guard.NotNull(texts, nameof(texts));
     this.Texts = texts;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccUInt64ArrayTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The array data</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccUInt64ArrayTagDataEntry(ulong[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.UInt64Array, tagSignature)
 {
     Guard.NotNull(data, nameof(data));
     this.Data = data;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccXyzTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The XYZ numbers</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccXyzTagDataEntry(Vector3[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.Xyz, tagSignature)
 {
     Guard.NotNull(data, nameof(data));
     this.Data = data;
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccProfileSequenceIdentifierTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">Profile Identifiers</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccProfileSequenceIdentifierTagDataEntry(IccProfileSequenceIdentifier[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.ProfileSequenceIdentifier, tagSignature)
 {
     Guard.NotNull(data, nameof(data));
     this.Data = data;
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccTagTableEntry"/> struct.
 /// </summary>
 /// <param name="signature">Signature of the tag</param>
 /// <param name="offset">Offset of entry in bytes</param>
 /// <param name="dataSize">Size of entry in bytes</param>
 public IccTagTableEntry(IccProfileTag signature, uint offset, uint dataSize)
 {
     this.Signature = signature;
     this.Offset    = offset;
     this.DataSize  = dataSize;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccTagDataEntry"/> class.
 /// </summary>
 /// <param name="signature">Type Signature</param>
 /// <param name="tagSignature">Tag Signature</param>
 protected IccTagDataEntry(IccTypeSignature signature, IccProfileTag tagSignature)
 {
     this.Signature    = signature;
     this.TagSignature = tagSignature;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IccLut16TagDataEntry"/> class.
        /// </summary>
        /// <param name="matrix">Conversion matrix (must be 3x3)</param>
        /// <param name="inputValues">Input LUT</param>
        /// <param name="clutValues">CLUT</param>
        /// <param name="outputValues">Output LUT</param>
        /// <param name="tagSignature">Tag Signature</param>
        public IccLut16TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutValues, IccLut[] outputValues, IccProfileTag tagSignature)
            : base(IccTypeSignature.Lut16, tagSignature)
        {
            Guard.NotNull(matrix, nameof(matrix));
            Guard.NotNull(inputValues, nameof(inputValues));
            Guard.NotNull(clutValues, nameof(clutValues));
            Guard.NotNull(outputValues, nameof(outputValues));

            bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3;
            Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three");

            this.Matrix = this.CreateMatrix(matrix);
            this.InputValues = inputValues;
            this.ClutValues = clutValues;
            this.OutputValues = outputValues;

            Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
            Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
        }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccProfileSequenceDescTagDataEntry"/> class.
 /// </summary>
 /// <param name="descriptions">Profile Descriptions</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccProfileSequenceDescTagDataEntry(IccProfileDescription[] descriptions, IccProfileTag tagSignature)
     : base(IccTypeSignature.ProfileSequenceDesc, tagSignature)
 {
     Guard.NotNull(descriptions, nameof(descriptions));
     this.Descriptions = descriptions;
 }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccScreeningTagDataEntry"/> class.
 /// </summary>
 /// <param name="flags">Screening flags</param>
 /// <param name="channels">Channel information</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccScreeningTagDataEntry(IccScreeningFlag flags, IccScreeningChannel[] channels, IccProfileTag tagSignature)
     : base(IccTypeSignature.Screening, tagSignature)
 {
     this.Flags    = flags;
     this.Channels = channels ?? throw new ArgumentNullException(nameof(channels));
 }
Beispiel #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IccLutAToBTagDataEntry"/> class.
        /// </summary>
        /// <param name="curveB">B Curve</param>
        /// <param name="matrix3x3">Two dimensional conversion matrix (3x3)</param>
        /// <param name="matrix3x1">One dimensional conversion matrix (3x1)</param>
        /// <param name="curveM">M Curve</param>
        /// <param name="clutValues">CLUT</param>
        /// <param name="curveA">A Curve</param>
        /// <param name="tagSignature">Tag Signature</param>
        public IccLutAToBTagDataEntry(
            IccTagDataEntry[] curveB,
            float[,] matrix3x3,
            float[] matrix3x1,
            IccTagDataEntry[] curveM,
            IccClut clutValues,
            IccTagDataEntry[] curveA,
            IccProfileTag tagSignature)
            : base(IccTypeSignature.LutAToB, tagSignature)
        {
            this.VerifyMatrix(matrix3x3, matrix3x1);
            this.VerifyCurve(curveA, nameof(curveA));
            this.VerifyCurve(curveB, nameof(curveB));
            this.VerifyCurve(curveM, nameof(curveM));

            this.Matrix3x3  = this.CreateMatrix3x3(matrix3x3);
            this.Matrix3x1  = this.CreateMatrix3x1(matrix3x1);
            this.CurveA     = curveA;
            this.CurveB     = curveB;
            this.CurveM     = curveM;
            this.ClutValues = clutValues;

            if (this.IsAClutMMatrixB())
            {
                Guard.IsTrue(this.CurveB.Length == 3, nameof(this.CurveB), $"{nameof(this.CurveB)} must have a length of three");
                Guard.IsTrue(this.CurveM.Length == 3, nameof(this.CurveM), $"{nameof(this.CurveM)} must have a length of three");
                Guard.MustBeBetweenOrEqualTo(this.CurveA.Length, 1, 15, nameof(this.CurveA));

                this.InputChannelCount  = curveA.Length;
                this.OutputChannelCount = 3;

                Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
                Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
            }
            else if (this.IsMMatrixB())
            {
                Guard.IsTrue(this.CurveB.Length == 3, nameof(this.CurveB), $"{nameof(this.CurveB)} must have a length of three");
                Guard.IsTrue(this.CurveM.Length == 3, nameof(this.CurveM), $"{nameof(this.CurveM)} must have a length of three");

                this.InputChannelCount = this.OutputChannelCount = 3;
            }
            else if (this.IsAClutB())
            {
                Guard.MustBeBetweenOrEqualTo(this.CurveA.Length, 1, 15, nameof(this.CurveA));
                Guard.MustBeBetweenOrEqualTo(this.CurveB.Length, 1, 15, nameof(this.CurveB));

                this.InputChannelCount  = curveA.Length;
                this.OutputChannelCount = curveB.Length;

                Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
                Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");
            }
            else if (this.IsB())
            {
                this.InputChannelCount = this.OutputChannelCount = this.CurveB.Length;
            }
            else
            {
                throw new ArgumentException("Invalid combination of values given");
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccMeasurementTagDataEntry"/> class.
 /// </summary>
 /// <param name="observer">Observer</param>
 /// <param name="xyzBacking">XYZ Backing values</param>
 /// <param name="geometry">Geometry</param>
 /// <param name="flare">Flare</param>
 /// <param name="illuminant">Illuminant</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccMeasurementTagDataEntry(IccStandardObserver observer, Vector3 xyzBacking, IccMeasurementGeometry geometry, float flare, IccStandardIlluminant illuminant, IccProfileTag tagSignature)
     : base(IccTypeSignature.Measurement, tagSignature)
 {
     this.Observer   = observer;
     this.XyzBacking = xyzBacking;
     this.Geometry   = geometry;
     this.Flare      = flare;
     this.Illuminant = illuminant;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccTextDescriptionTagDataEntry"/> class.
 /// </summary>
 /// <param name="ascii">ASCII text</param>
 /// <param name="unicode">Unicode text</param>
 /// <param name="scriptCode">ScriptCode text</param>
 /// <param name="unicodeLanguageCode">Unicode Language-Code</param>
 /// <param name="scriptCodeCode">ScriptCode Code</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccTextDescriptionTagDataEntry(string ascii, string unicode, string scriptCode, uint unicodeLanguageCode, ushort scriptCodeCode, IccProfileTag tagSignature)
     : base(IccTypeSignature.TextDescription, tagSignature)
 {
     this.Ascii               = ascii;
     this.Unicode             = unicode;
     this.ScriptCode          = scriptCode;
     this.UnicodeLanguageCode = unicodeLanguageCode;
     this.ScriptCodeCode      = scriptCodeCode;
 }
Beispiel #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccUnknownTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The raw data of the entry</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccUnknownTagDataEntry(byte[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.Unknown, tagSignature)
 {
     Guard.NotNull(data, nameof(data));
     this.Data = data;
 }
Beispiel #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccUInt16ArrayTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The array data</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccUInt16ArrayTagDataEntry(ushort[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.UInt16Array, tagSignature)
 {
     this.Data = data ?? throw new ArgumentNullException(nameof(data));
 }
Beispiel #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccDateTimeTagDataEntry"/> class.
 /// </summary>
 /// <param name="value">The DateTime value</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccDateTimeTagDataEntry(DateTime value, IccProfileTag tagSignature)
     : base(IccTypeSignature.DateTime, tagSignature)
 {
     this.Value = value;
 }
Beispiel #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IccLut8TagDataEntry"/> class.
        /// </summary>
        /// <param name="matrix">Conversion matrix (must be 3x3)</param>
        /// <param name="inputValues">Input LUT</param>
        /// <param name="clutValues">CLUT</param>
        /// <param name="outputValues">Output LUT</param>
        /// <param name="tagSignature">Tag Signature</param>
        public IccLut8TagDataEntry(float[,] matrix, IccLut[] inputValues, IccClut clutValues, IccLut[] outputValues, IccProfileTag tagSignature)
            : base(IccTypeSignature.Lut8, tagSignature)
        {
            Guard.NotNull(matrix, nameof(matrix));

            bool is3By3 = matrix.GetLength(0) == 3 && matrix.GetLength(1) == 3;

            Guard.IsTrue(is3By3, nameof(matrix), "Matrix must have a size of three by three");

            this.Matrix       = this.CreateMatrix(matrix);
            this.InputValues  = inputValues ?? throw new ArgumentNullException(nameof(inputValues));
            this.ClutValues   = clutValues ?? throw new ArgumentNullException(nameof(clutValues));
            this.OutputValues = outputValues ?? throw new ArgumentNullException(nameof(outputValues));

            Guard.IsTrue(this.InputChannelCount == clutValues.InputChannelCount, nameof(clutValues), "Input channel count does not match the CLUT size");
            Guard.IsTrue(this.OutputChannelCount == clutValues.OutputChannelCount, nameof(clutValues), "Output channel count does not match the CLUT size");

            Guard.IsFalse(inputValues.Any(t => t.Values.Length != 256), nameof(inputValues), "Input lookup table has to have a length of 256");
            Guard.IsFalse(outputValues.Any(t => t.Values.Length != 256), nameof(outputValues), "Output lookup table has to have a length of 256");
        }
Beispiel #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccFix16ArrayTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The array data</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccFix16ArrayTagDataEntry(float[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.S15Fixed16Array, tagSignature)
 {
     Guard.NotNull(data, nameof(data));
     this.Data = data;
 }
Beispiel #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccNamedColor2TagDataEntry"/> class.
 /// </summary>
 /// <param name="prefix">Prefix</param>
 /// <param name="suffix">Suffix</param>
 /// <param name="colors">The named colors</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccNamedColor2TagDataEntry(string prefix, string suffix, IccNamedColor[] colors, IccProfileTag tagSignature)
     : this(0, prefix, suffix, colors, tagSignature)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccXyzTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The XYZ numbers</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccXyzTagDataEntry(Vector3[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.Xyz, tagSignature)
 {
     this.Data = data ?? throw new ArgumentNullException(nameof(data));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccFix16ArrayTagDataEntry"/> class.
 /// </summary>
 /// <param name="data">The array data</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccFix16ArrayTagDataEntry(float[] data, IccProfileTag tagSignature)
     : base(IccTypeSignature.S15Fixed16Array, tagSignature)
 {
     this.Data = data ?? throw new ArgumentNullException(nameof(data));
 }
Beispiel #30
0
        private IccChromaticityTagDataEntry(IccColorantEncoding colorantType, double[][] channelValues, IccProfileTag tagSignature)
            : base(IccTypeSignature.Chromaticity, tagSignature)
        {
            //Guard.NotNull(channelValues, nameof(channelValues));
            //Guard.MustBeBetweenOrEqualTo(channelValues.Length, 1, 15, nameof(channelValues));

            this.ColorantType  = colorantType;
            this.ChannelValues = channelValues;

            int  channelLength   = channelValues[0].Length;
            bool channelsNotSame = channelValues.Any(t => t is null || t.Length != channelLength);
            //   Guard.IsFalse(channelsNotSame, nameof(channelValues), "The number of values per channel is not the same for all channels");
        }