コード例 #1
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;
     }
 }
コード例 #2
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;
        }
コード例 #3
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;
            }
        }
コード例 #4
0
 /// <summary>Return the associated channel from the record.</summary>
 private int getAsoc(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 4));
 }
コード例 #5
0
 /// <summary>Return the channel type from the record.</summary>
 private int getTyp(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 2));
 }
コード例 #6
0
 /// <summary>Return the channel from the record.</summary>
 private int getCn(byte[] bfr)
 {
     return(ICCProfile.getShort(bfr, 0));
 }
コード例 #7
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;
                    }
                }
            }
        }
コード例 #8
0
 /* Return the component mapped to the channel. */
 public int getCMP(int channel)
 {
     byte[] mapping = (byte[])map[channel];
     return(ICCProfile.getShort(mapping, 0) & 0x0000ffff);
 }
コード例 #9
0
 private int getCMP(byte[] mapping)
 {
     return(ICCProfile.getShort(mapping, 0) & 0x0000ffff);
 }