Example #1
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");
        }
Example #2
0
        private static double[][] GetColorantArray(IccColorantEncoding colorantType)
        {
            switch (colorantType)
            {
            case IccColorantEncoding.EbuTech3213E:
                return(new[]
                {
                    new[] { 0.640, 0.330 },
                    new[] { 0.290, 0.600 },
                    new[] { 0.150, 0.060 },
                });

            case IccColorantEncoding.ItuRBt709_2:
                return(new[]
                {
                    new[] { 0.640, 0.330 },
                    new[] { 0.300, 0.600 },
                    new[] { 0.150, 0.060 },
                });

            case IccColorantEncoding.P22:
                return(new[]
                {
                    new[] { 0.625, 0.340 },
                    new[] { 0.280, 0.605 },
                    new[] { 0.155, 0.070 },
                });

            case IccColorantEncoding.SmpteRp145:
                return(new[]
                {
                    new[] { 0.630, 0.340 },
                    new[] { 0.310, 0.595 },
                    new[] { 0.155, 0.070 },
                });

            default:
                throw new ArgumentException("Unrecognized colorant encoding");
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccChromaticityTagDataEntry"/> class.
 /// </summary>
 /// <param name="colorantType">Colorant Type</param>
 /// <param name="tagSignature">Tag Signature</param>
 public IccChromaticityTagDataEntry(IccColorantEncoding colorantType, IccProfileTag tagSignature)
     : this(colorantType, GetColorantArray(colorantType), tagSignature)
 {
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IccChromaticityTagDataEntry"/> class.
 /// </summary>
 /// <param name="colorantType">Colorant Type</param>
 public IccChromaticityTagDataEntry(IccColorantEncoding colorantType)
     : this(colorantType, GetColorantArray(colorantType), IccProfileTag.Unknown)
 {
 }