Exemplo n.º 1
0
        private void WriteHeader(IccDataWriter writer, IccProfileHeader header)
        {
            writer.SetIndex(0);

            writer.WriteUInt32(writer.Length);
            writer.WriteAsciiString(header.CmmType, 4, false);
            writer.WriteVersionNumber(header.Version);
            writer.WriteUInt32((uint)header.Class);
            writer.WriteUInt32((uint)header.DataColorSpace);
            writer.WriteUInt32((uint)header.ProfileConnectionSpace);
            writer.WriteDateTime(header.CreationDate);
            writer.WriteAsciiString("acsp");
            writer.WriteUInt32((uint)header.PrimaryPlatformSignature);
            writer.WriteInt32((int)header.Flags);
            writer.WriteUInt32(header.DeviceManufacturer);
            writer.WriteUInt32(header.DeviceModel);
            writer.WriteInt64((long)header.DeviceAttributes);
            writer.WriteUInt32((uint)header.RenderingIntent);
            writer.WriteXyzNumber(header.PcsIlluminant);
            writer.WriteAsciiString(header.CreatorSignature, 4, false);

            IccProfileId id = IccProfile.CalculateHash(writer.GetData());

            writer.WriteProfileId(id);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IccProfileSequenceIdentifier"/> struct.
        /// </summary>
        /// <param name="id">ID of the profile</param>
        /// <param name="description">Description of the profile</param>
        public IccProfileSequenceIdentifier(IccProfileId id, IccLocalizedString[] description)
        {
            Guard.NotNull(description, nameof(description));

            this.Id          = id;
            this.Description = description;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Writes a profile ID
 /// </summary>
 /// <param name="value">The value to write</param>
 /// <returns>the number of bytes written</returns>
 public int WriteProfileId(IccProfileId value)
 {
     return(this.WriteUInt32(value.Part1)
            + this.WriteUInt32(value.Part2)
            + this.WriteUInt32(value.Part3)
            + this.WriteUInt32(value.Part4));
 }
        /// <summary>
        /// Reads a <see cref="IccProfileSequenceIdentifierTagDataEntry"/>
        /// </summary>
        /// <returns>The read entry</returns>
        public IccProfileSequenceIdentifierTagDataEntry ReadProfileSequenceIdentifierTagDataEntry()
        {
            int  start = this.currentIndex - 8; // 8 is the tag header size
            uint count = this.ReadUInt32();

            IccPositionNumber[] table = new IccPositionNumber[count];
            for (int i = 0; i < count; i++)
            {
                table[i] = this.ReadPositionNumber();
            }

            IccProfileSequenceIdentifier[] entries = new IccProfileSequenceIdentifier[count];
            for (int i = 0; i < count; i++)
            {
                this.currentIndex = (int)(start + table[i].Offset);
                IccProfileId id = this.ReadProfileId();
                this.ReadCheckTagDataEntryHeader(IccTypeSignature.MultiLocalizedUnicode);
                IccMultiLocalizedUnicodeTagDataEntry description = this.ReadMultiLocalizedUnicodeTagDataEntry();
                entries[i] = new IccProfileSequenceIdentifier(id, description.Texts);
            }

            return(new IccProfileSequenceIdentifierTagDataEntry(entries));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IccProfileSequenceIdentifier"/> struct.
 /// </summary>
 /// <param name="id">ID of the profile</param>
 /// <param name="description">Description of the profile</param>
 public IccProfileSequenceIdentifier(IccProfileId id, IccLocalizedString[] description)
 {
     this.Id          = id;
     this.Description = description ?? throw new ArgumentNullException(nameof(description));
 }