コード例 #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;
			}
		}
コード例 #2
0
        /// <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];
            }
        }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <summary>Return the string rep of this tag. </summary>
 public override System.String ToString()
 {
     System.Text.StringBuilder rep = new System.Text.StringBuilder("[").Append(base.ToString()).Append(eol);
     rep.Append("num entries = " + System.Convert.ToString(nEntries) + eol);
     rep.Append("data length = " + System.Convert.ToString(entry_Renamed_Field.Length) + eol);
     for (int i = 0; i < nEntries; ++i)
     {
         rep.Append(ICCProfile.toHexString(entry_Renamed_Field[i]) + eol);
     }
     return(rep.Append("]").ToString());
 }
コード例 #5
0
 /// <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;
     }
 }
コード例 #6
0
        /// <summary>Write to a file. </summary>
        //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)
        {
            byte[] xb = ICCProfile.setLong(x);
            byte[] yb = ICCProfile.setLong(y);
            byte[] zb = ICCProfile.setLong(z);

            // CONVERSION PROBLEM?
            raf.Write(xb, ICCProfile.int_size, 0);
            raf.Write(yb, ICCProfile.int_size, 0);
            raf.Write(zb, ICCProfile.int_size, 0);
        }
コード例 #7
0
        /// <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 + ")");
            }
        }
コード例 #8
0
        /// <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;
        }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
ファイル: ICCTextType.cs プロジェクト: TsengSR/libremetaverse
        /// <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);
        }
コード例 #11
0
        /// <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");
            }
        }
コード例 #12
0
        /// <summary>Analyze the box content. </summary>
        private void readBox()
        {
            byte[] bfr = new byte[8];

            in_Renamed.seek(dataStart);
            in_Renamed.readFully(bfr, 0, 2);
            ndefs = ICCProfile.getShort(bfr, 0) & 0x0000ffff;

            int offset = dataStart + 2;

            in_Renamed.seek(offset);
            for (int i = 0; i < ndefs; ++i)
            {
                in_Renamed.readFully(bfr, 0, 6);
                int   channel     = ICCProfile.getShort(bfr, 0);
                int[] channel_def = new int[3];
                channel_def[0] = getCn(bfr);
                channel_def[1] = getTyp(bfr);
                channel_def[2] = getAsoc(bfr);
                definitions[(System.Int32)channel_def[0]] = channel_def;
            }
        }
コード例 #13
0
 /* Return the component mapped to the channel. */
 public int getCMP(int channel)
 {
     byte[] mapping = (byte[])map[channel];
     return(ICCProfile.getShort(mapping, 0) & 0x0000ffff);
 }
コード例 #14
0
 /// <summary>Return the associated channel from the record.</summary>
 private int getAsoc(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 4));
 }
コード例 #15
0
 /// <summary>Return the channel type from the record.</summary>
 private int getTyp(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 2));
 }
コード例 #16
0
 /// <summary>Return the channel from the record.</summary>
 private int getCn(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 0));
 }
コード例 #17
0
ファイル: PaletteBox.cs プロジェクト: TsengSR/libremetaverse
        /// <summary>Analyze the box content. </summary>
        internal void  readBox()
        {
            byte[] bfr = new byte[4];
            int    i, j, b, m;

            //int entry;

            // Read the number of palette entries and columns per entry.
            in_Renamed.seek((int)dataStart);
            in_Renamed.readFully(bfr, 0, 3);
            nentries = ICCProfile.getShort(bfr, 0) & 0x0000ffff;
            ncolumns = bfr[2] & 0x0000ffff;

            // Read the bitdepths for each column
            bitdepth = new short[ncolumns];
            bfr      = new byte[ncolumns];
            in_Renamed.readFully(bfr, 0, ncolumns);
            for (i = 0; i < ncolumns; ++i)
            {
                bitdepth[i] = (short)(bfr[i] & 0x00fff);
            }

            entries = new int[nentries * ncolumns][];

            bfr = new byte[2];
            for (i = 0; i < nentries; ++i)
            {
                entries[i] = new int[ncolumns];

                for (j = 0; j < ncolumns; ++j)
                {
                    int  bd     = getBitDepth(j);
                    bool signed = isSigned(j);

                    switch (getEntrySize(j))
                    {
                    case 1:                              // 8 bit entries
                        in_Renamed.readFully(bfr, 0, 1);
                        b = bfr[0];
                        break;


                    case 2:                              // 16 bits
                        in_Renamed.readFully(bfr, 0, 2);
                        b = ICCProfile.getShort(bfr, 0);
                        break;


                    default:
                        throw new ColorSpaceException("palettes greater than 16 bits deep not supported");
                    }

                    if (signed)
                    {
                        // Do sign extension if high bit is set.
                        if ((b & (1 << (bd - 1))) == 0)
                        {
                            // high bit not set.
                            m             = (1 << bd) - 1;
                            entries[i][j] = m & b;
                        }
                        else
                        {
                            // high bit set.
                            // CONVERSION PROBLEM?
                            m             = unchecked ((int)(0xffffffff << bd));
                            entries[i][j] = m | b;
                        }
                    }
                    else
                    {
                        // Clear all high bits.
                        m             = (1 << bd) - 1;
                        entries[i][j] = m & b;
                    }
                }
            }
        }
コード例 #18
0
 private int getCMP(byte[] mapping)
 {
     return(ICCProfile.getShort(mapping, 0) & 0x0000ffff);
 }
コード例 #19
0
 /// <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);
 }