Exemple #1
0
        public void ReadProfile_NoEntries()
        {
            IccReader reader = this.CreateReader();

            IccProfile output = reader.Read(IccTestDataProfiles.Header_Random_Array);

            Assert.Equal(0, output.Entries.Length);
            Assert.NotNull(output.Header);

            IccProfileHeader header   = output.Header;
            IccProfileHeader expected = IccTestDataProfiles.Header_Random_Read;

            Assert.Equal(header.Class, expected.Class);
            Assert.Equal(header.CmmType, expected.CmmType);
            Assert.Equal(header.CreationDate, expected.CreationDate);
            Assert.Equal(header.CreatorSignature, expected.CreatorSignature);
            Assert.Equal(header.DataColorSpace, expected.DataColorSpace);
            Assert.Equal(header.DeviceAttributes, expected.DeviceAttributes);
            Assert.Equal(header.DeviceManufacturer, expected.DeviceManufacturer);
            Assert.Equal(header.DeviceModel, expected.DeviceModel);
            Assert.Equal(header.FileSignature, expected.FileSignature);
            Assert.Equal(header.Flags, expected.Flags);
            Assert.Equal(header.Id, expected.Id);
            Assert.Equal(header.PcsIlluminant, expected.PcsIlluminant);
            Assert.Equal(header.PrimaryPlatformSignature, expected.PrimaryPlatformSignature);
            Assert.Equal(header.ProfileConnectionSpace, expected.ProfileConnectionSpace);
            Assert.Equal(header.RenderingIntent, expected.RenderingIntent);
            Assert.Equal(header.Size, expected.Size);
            Assert.Equal(header.Version, expected.Version);
        }
Exemple #2
0
        /// <summary>
        /// Reads an ICC profile
        /// </summary>
        /// <param name="data">The raw ICC data</param>
        /// <returns>The read ICC profile</returns>
        public IccProfile Read(byte[] data)
        {
            Guard.NotNull(data, nameof(data));
            Guard.IsTrue(data.Length >= 128, nameof(data), "Data length must be at least 128 to be a valid ICC profile");

            var reader = new IccDataReader(data);
            IccProfileHeader header = this.ReadHeader(reader);

            IccTagDataEntry[] tagData = this.ReadTagData(reader);

            return(new IccProfile(header, tagData));
        }