An ICC profile contains a 128-byte header followed by a variable number of tags contained in a tag table. Each tag is a structured block of ints. The tags share a common format on disk starting with a signature, an offset to the tag data, and a length of the tag data. The tag data itself is found at the given offset in the file and consists of a tag type int, followed by a reserved int, followed by a data block, the structure of which is unique to the tag type.

This class is the abstract super class of all tags. It models that part of the structure which is common among tags of all types.

It also contains the definitions of the various tag types.

Example #1
0
		/// <summary> Ctor used by factory method.</summary>
		/// <param name="byte">raw tag data
		/// </param>
		protected internal ICCTagTable(byte[] data)
		{
            tagCount = ICCProfile.getInt(data, offTagCount);
			
			int offset = offTags;
			for (int i = 0; i < tagCount; ++i)
			{
                int signature = ICCProfile.getInt(data, offset);
                int tagOffset = ICCProfile.getInt(data, offset + ICCProfile.int_size);
                int length = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size);
				trios.Add(new Triplet(signature, tagOffset, length));
				offset += 3 * ICCProfile.int_size;
			}
			
			
			System.Collections.IEnumerator Enum = trios.GetEnumerator();
			//UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
			while (Enum.MoveNext())
			{
				//UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
				Triplet trio = (Triplet) Enum.Current;
				ICCTag tag = ICCTag.createInstance(trio.signature, data, trio.offset, trio.count);
				System.Object tempObject;
				tempObject = this[(System.Int32) tag.signature];
				this[(System.Int32) tag.signature] = tag;
				System.Object generatedAux2 = tempObject;
			}
		}
Example #2
0
		/// <summary> Representation of a tag table</summary>
		/// <returns> String
		/// </returns>
		//UPGRADE_NOTE: The equivalent of method 'java.util.Hashtable.toString' is not an override method. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1143'"
		public override System.String ToString()
		{
			System.Text.StringBuilder rep = new System.Text.StringBuilder("[ICCTagTable containing " + tagCount + " tags:");
			System.Text.StringBuilder body = new System.Text.StringBuilder("  ");
			System.Collections.IEnumerator keys = Keys.GetEnumerator();
			//UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
			while (keys.MoveNext())
			{
				//UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
				System.Int32 key = (System.Int32) keys.Current;
				ICCTag tag = (ICCTag) this[key];
				body.Append(eol).Append(tag.ToString());
			}
			rep.Append(ColorSpace.indent("  ", body));
			return rep.Append("]").ToString();
		}
Example #3
0
		/// <summary> Output the table to a disk</summary>
		/// <param name="raf">RandomAccessFile which receives the table.
		/// </param>
		/// <exception cref="IOException">
		/// </exception>
		//UPGRADE_TODO: Class 'java.io.RandomAccessFile' was converted to 'System.IO.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioRandomAccessFile'"
		public virtual void  write(System.IO.FileStream raf)
		{
			
			int ntags = trios.Count;
			
			int countOff = ICCProfileHeader.size;
			int tagOff = countOff + ICCProfile.int_size;
			int dataOff = tagOff + 3 * ntags * ICCProfile.int_size;
			
			raf.Seek(countOff, System.IO.SeekOrigin.Begin);
			System.IO.BinaryWriter temp_BinaryWriter;
			temp_BinaryWriter = new System.IO.BinaryWriter(raf);
			temp_BinaryWriter.Write((System.Int32) ntags);
			
			int currentTagOff = tagOff;
			int currentDataOff = dataOff;
			
			System.Collections.IEnumerator enum_Renamed = trios.GetEnumerator();
			//UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
			while (enum_Renamed.MoveNext())
			{
				//UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
				Triplet trio = (Triplet) enum_Renamed.Current;
				ICCTag tag = (ICCTag) this[(System.Int32) trio.signature];
				
				raf.Seek(currentTagOff, System.IO.SeekOrigin.Begin);
				System.IO.BinaryWriter temp_BinaryWriter2;
				temp_BinaryWriter2 = new System.IO.BinaryWriter(raf);
				temp_BinaryWriter2.Write((System.Int32) tag.signature);
				System.IO.BinaryWriter temp_BinaryWriter3;
				temp_BinaryWriter3 = new System.IO.BinaryWriter(raf);
				temp_BinaryWriter3.Write((System.Int32) currentDataOff);
				System.IO.BinaryWriter temp_BinaryWriter4;
				temp_BinaryWriter4 = new System.IO.BinaryWriter(raf);
				temp_BinaryWriter4.Write((System.Int32) tag.count);
				currentTagOff += 3 * CSJ2K.Icc.Tags.ICCTagTable.Triplet.size;
				
				raf.Seek(currentDataOff, System.IO.SeekOrigin.Begin);
				raf.Write(tag.data, tag.offset, tag.count);
				currentDataOff += tag.count;
			}
		}