/// <summary> Construct a header from a complete ICCProfile</summary> /// <param name="byte">[] -- holds ICCProfile contents /// </param> public ICCProfileHeader(byte[] data) { dwProfileSize = ICCProfile.getInt(data, offProfileSize); dwCMMTypeSignature = ICCProfile.getInt(data, offCMMTypeSignature); dwProfileClass = ICCProfile.getInt(data, offProfileClass); dwColorSpaceType = ICCProfile.getInt(data, offColorSpaceType); dwPCSType = ICCProfile.getInt(data, offPCSType); dwProfileSignature = ICCProfile.getInt(data, offProfileSignature); dwPlatformSignature = ICCProfile.getInt(data, offPlatformSignature); dwCMMFlags = ICCProfile.getInt(data, offCMMFlags); dwDeviceManufacturer = ICCProfile.getInt(data, offDeviceManufacturer); dwDeviceModel = ICCProfile.getInt(data, offDeviceModel); dwDeviceAttributes1 = ICCProfile.getInt(data, offDeviceAttributesReserved); dwDeviceAttributesReserved = ICCProfile.getInt(data, offDeviceAttributesReserved); dwRenderingIntent = ICCProfile.getInt(data, offRenderingIntent); dwCreatorSig = ICCProfile.getInt(data, offCreatorSig); profileVersion = ICCProfile.getICCProfileVersion(data, offProfileVersion); dateTime = ICCProfile.getICCDateTime(data, offDateTime); PCSIlluminant = ICCProfile.getXYZNumber(data, offPCSIlluminant); for (int i = 0; i < reserved.Length; ++i) { reserved[i] = data[offReserved + i]; } }
/// <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; } }
/// <summary> Ued by subclass initialization to store the state common to all tags</summary> /// <param name="signature">tag being created /// </param> /// <param name="data">byte array containg embedded tag data /// </param> /// <param name="offset">to tag data in the array /// </param> /// <param name="count">size of tag data in bytes /// </param> protected internal ICCTag(int signature, byte[] data, int offset, int count) { this.signature = signature; this.data = data; this.offset = offset; this.count = count; this.type = ICCProfile.getInt(data, offset); }
/// <summary> Construct this tag from its constituant parts</summary> /// <param name="signature">tag id /// </param> /// <param name="data">array of bytes /// </param> /// <param name="offset">to data in the data array /// </param> /// <param name="length">of data in the data array /// </param> protected internal ICCCurveType(int signature, byte[] data, int offset, int length) : base(signature, data, offset, offset + 2 * ICCProfile.int_size) { type = ICCProfile.getInt(data, offset); reserved = ICCProfile.getInt(data, offset + ICCProfile.int_size); nEntries = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size); entry_Renamed_Field = new int[nEntries]; for (int i = 0; i < nEntries; ++i) { entry_Renamed_Field[i] = ICCProfile.getShort(data, offset + 3 * ICCProfile.int_size + i * ICCProfile.short_size) & 0xFFFF; } }
/// <summary> Factory method for creating a tag of a specific type.</summary> /// <param name="signature">tag to create /// </param> /// <param name="data">byte array containg embedded tag data /// </param> /// <param name="offset">to tag data in the array /// </param> /// <param name="count">size of tag data in bytes /// </param> /// <returns> specified ICCTag /// </returns> public static ICCTag createInstance(int signature, byte[] data, int offset, int count) { int type = ICCProfile.getInt(data, offset); if (type == kdwTextDescType) { return(new ICCTextDescriptionType(signature, data, offset, count)); } else if (type == kdwTextType) { return(new ICCTextType(signature, data, offset, count)); } else if (type == kdwXYZType) { return(new ICCXYZType(signature, data, offset, count)); } else if (type == kdwXYZTypeReverse) { return(new ICCXYZTypeReverse(signature, data, offset, count)); } else if (type == kdwCurveType) { return(new ICCCurveType(signature, data, offset, count)); } else if (type == kdwCurveTypeReverse) { return(new ICCCurveTypeReverse(signature, data, offset, count)); } else if (type == kdwMeasurementType) { return(new ICCMeasurementType(signature, data, offset, count)); } else if (type == kdwSignatureType) { return(new ICCSignatureType(signature, data, offset, count)); } else if (type == kdwViewType) { return(new ICCViewType(signature, data, offset, count)); } else if (type == kdwDataType) { return(new ICCDataType(signature, data, offset, count)); } else { var bytes = BitConverter.GetBytes(type); throw new System.ArgumentException("bad tag type: " + System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length) + "(" + type + ")"); } }
/// <summary> Construct this tag from its constituant parts</summary> /// <param name="signature">tag id /// </param> /// <param name="data">array of bytes /// </param> /// <param name="offset">to data in the data array /// </param> /// <param name="length">of data in the data array /// </param> protected internal ICCTextDescriptionType(int signature, byte[] data, int offset, int length) : base(signature, data, offset, length) { type = ICCProfile.getInt(data, offset); offset += ICCProfile.int_size; reserved = ICCProfile.getInt(data, offset); offset += ICCProfile.int_size; size = ICCProfile.getInt(data, offset); offset += ICCProfile.int_size; ascii = new byte[size - 1]; Array.Copy(data, offset, ascii, 0, size - 1); }
/// <summary>Analyze the box content. </summary> internal void readBox() { byte[] bfr = new byte[14]; in_Renamed.seek(dataStart); in_Renamed.readFully(bfr, 0, 14); height = ICCProfile.getInt(bfr, 0); width = ICCProfile.getInt(bfr, 4); nc = ICCProfile.getShort(bfr, 8); bpc = (short)(bfr[10] & 0x00ff); c = (short)(bfr[11] & 0x00ff); unk = bfr[12] == 0 ? true : false; ipr = bfr[13] == 1 ? true : false; }
/// <summary> Construct this tag from its constituant parts</summary> /// <param name="signature">tag id /// </param> /// <param name="data">array of bytes /// </param> /// <param name="offset">to data in the data array /// </param> /// <param name="length">of data in the data array /// </param> protected internal ICCTextType(int signature, byte[] data, int offset, int length) : base(signature, data, offset, length) { type = ICCProfile.getInt(data, offset); offset += ICCProfile.int_size; reserved = ICCProfile.getInt(data, offset); offset += ICCProfile.int_size; int size = 0; while (data[offset + size] != 0) { ++size; } ascii = new byte[size]; Array.Copy(data, offset, ascii, 0, size); }
/// <summary> Construct a JP2Box from an input image.</summary> /// <param name="in">RandomAccessIO jp2 image /// </param> /// <param name="boxStart">offset to the start of the box in the image /// </param> /// <exception cref="IOException,">ColorSpaceException /// </exception> public JP2Box(RandomAccessIO in_Renamed, int boxStart) { byte[] boxHeader = new byte[16]; this.in_Renamed = in_Renamed; this.boxStart = boxStart; this.in_Renamed.seek(this.boxStart); this.in_Renamed.readFully(boxHeader, 0, 8); this.dataStart = boxStart + 8; this.length = ICCProfile.getInt(boxHeader, 0); this.boxEnd = boxStart + length; if (length == 1) { throw new ColorSpaceException("extended length boxes not supported"); } }
/// <summary> Construct this tag from its constituant parts</summary> /// <param name="signature">tag id /// </param> /// <param name="data">array of bytes /// </param> /// <param name="offset">to data in the data array /// </param> /// <param name="length">of data in the data array /// </param> protected internal ICCXYZType(int signature, byte[] data, int offset, int length) : base(signature, data, offset, length) { x = ICCProfile.getInt(data, offset + 2 * ICCProfile.int_size); y = ICCProfile.getInt(data, offset + 3 * ICCProfile.int_size); z = ICCProfile.getInt(data, offset + 4 * ICCProfile.int_size); }