//public MultiLocalizedUnicodeTag(bool isPlaceHolder)
        //{
        //    IsPlaceHolder = isPlaceHolder;
        //}
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            if (!IsPlaceHolder)
            {
                //Number of records (4 bytes)
                RecordCount = (int)HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
                //Record size (has to be 12 as for V4.3) (4 bytes)
                RecordSize = (int)HighEndianReader.GetUint32(iccData, index + 4, IsLittleEndian);
                //Records
                LanguageCode = new string[RecordCount];
                CountryCode  = new string[RecordCount];
                StringLength = new int[RecordCount];
                StringOffset = new int[RecordCount];
                //int end = idx + 8 + RecordCount * RecordSize; int c = 0;

                for (int i = 0; i < RecordCount; i++)
                {
                    int dataEntryPoint = index + 8 + RecordSize * i;
                    LanguageCode[i] = HighEndianReader.GetASCII(iccData, dataEntryPoint, 2);
                    //Country Code (2 bytes)
                    CountryCode[i] = HighEndianReader.GetASCII(iccData, dataEntryPoint + 2, 2);
                    //Record string length (4 bytes)
                    StringLength[i] = (int)HighEndianReader.GetUint32(iccData, dataEntryPoint + 4, IsLittleEndian);
                    //Record offset (4 bytes)
                    StringOffset[i] = (int)HighEndianReader.GetUint32(iccData, dataEntryPoint + 8, IsLittleEndian);;
                }
                //The strings
                Text = new LocalizedString[RecordCount];
                for (int i = 0; i < RecordCount; i++)
                {
                    Text[i] = new LocalizedString(LanguageCode[i], CountryCode[i], iccData, index - 8 + StringOffset[i], StringLength[i]);
                }
            }
        }
예제 #2
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Count, specifying number of structures in the array (4 bytes)
            NumberCount = (int)HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
            //Positions table for profile identifiers
            PositionTable = new PositionNumber[NumberCount];
            int dataEntryPoint = 0;;

            for (int i = 0; i < NumberCount; i++)
            {
                dataEntryPoint   = index + 4 + 8 * i;
                PositionTable[i] = new PositionNumber(iccData, i, IsLittleEndian);
            }
            //Profile ID (16 bytes)
            dataEntryPoint += 8;
            ProfileID       = HighEndianReader.GetProfileID(iccData, dataEntryPoint);
            dataEntryPoint += 16;
            //Profile description
            ProfileDescription = new MultiLocalizedUnicodeTag()
            {
                IsPlaceHolder = false
            };
            ProfileDescription.GetTagData(iccData, dataEntryPoint, header);
            //ICCTagData t = new ICCTagData();
        }
예제 #3
0
        internal static CurveSegment GetCurve(byte[] iccData, int idx)
        {
            //Tag signature (4 bytes) (plus 4 bytes reserved)
            CurveSegment          curve;
            CurveSegmentSignature t = (CurveSegmentSignature)HighEndianReader.GetUint32(iccData, idx);

            if (t == CurveSegmentSignature.FormulaCurve)
            {
                curve = new FormulaCurveElement();
                curve.GetCurveData(iccData, idx + 8, false);

                return(curve);
            }
            else if
            (t == CurveSegmentSignature.SampledCurve)
            {
                curve = new SampledCurveElement();
                curve.GetCurveData(iccData, idx + 8, false);
                return(curve);
            }
            else
            {
                throw new CorruptProfileException("CurveSegment");
            }
        }
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Number of channels (2 bytes)
            ChannelCount = HighEndianReader.GetUInt16(iccData, index, IsLittleEndian);
            //Count of measurement types (2 bytes)
            MeasurmentTypesCount = HighEndianReader.GetUInt16(iccData, index + 2, IsLittleEndian);
            //Offsets (4 bytes each)
            Offset = new int[MeasurmentTypesCount];
            int dataEntryPoint;

            for (int i = 0; i < MeasurmentTypesCount; i++)
            {
                dataEntryPoint = index + 4 + i * 4;
                Offset[i]      = (int)HighEndianReader.GetUint32(iccData, dataEntryPoint, IsLittleEndian);
            }
            //int end = idx + 4 + 4 * MeasurmentTypesCount; int c = 0;
            //for (int i = idx + 4; i < end; i += 4) { Offset[c] = (int)Helper.GetUInt32(i); c++; }
            //Response curve structures
            Curves = new ResponseCurve[MeasurmentTypesCount];
            for (int i = 0; i < MeasurmentTypesCount; i++)
            {
                dataEntryPoint = index - 8 + Offset[i];
                Curves[i]      = new ResponseCurve(iccData, dataEntryPoint, ChannelCount, IsLittleEndian);
            }
        }
        private static void GetCurve(byte[] iccData, int Offset, ref ICCTagData[] data, int idx, int InputChannelCount)
        {
            //Signature (4 bytes + 4 bytes reserved)
            TypeSignature t = (TypeSignature)HighEndianReader.GetUint32(iccData, Offset, BitConverter.IsLittleEndian);

            if (t != TypeSignature.curve && t != TypeSignature.parametricCurve)
            {
                return;
            }
            //Curve
            data = new ICCTagData[InputChannelCount];
            int end = idx + Offset;

            for (int i = 0; i < InputChannelCount; i++)
            {
                if (t == TypeSignature.curve)
                {
                    data[i] = new CurveTag();
                    data[i].GetTagData(iccData, idx, null);
                    //end = ((CurveTag)data[i]).end;
                }
                else if (t == TypeSignature.parametricCurve)
                {
                    data[i] = new ParametricCurveTag();
                    data[i].GetTagData(iccData, idx, null);
                    //end = ((ParametricCurveTagDataEntry)data[i]).end;
                }
                end += (end % 4) + 8;
            }
        }
예제 #6
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Number of input channels (2 bytes)
            InputChannelCount = HighEndianReader.GetUInt16(iccData, index);
            //Number of output channels (2 bytes)
            OutputChannelCount = HighEndianReader.GetUInt16(iccData, index + 2);
            //Number of processing elements (4 bytes)
            ProcessingElementCount = (int)HighEndianReader.GetUint32(iccData, index + 4);
            //Process element positions table (8 bytes each)
            PositionTable = new PositionNumber[ProcessingElementCount];
            //int end = idx + 8 + 8 * ProcessingElementCount; int c = 0;

            for (int i = 0; i < ProcessingElementCount; i++)
            {
                int dataEntryPoint = index + 8 + 8 * i;
                PositionTable[i] = new PositionNumber(iccData, dataEntryPoint);
            }

            //for (int i = idx + 8; i < end; i += 8) { PositionTable[c] = new PositionNumber(i); c++; }
            //Data
            Data = new MultiProcessElement[ProcessingElementCount];
            for (int i = 0; i < ProcessingElementCount; i++)
            {
                Data[i] = MultiProcessElement.CreateElement(iccData, PositionTable[i].Offset);
            }
        }
 public override void GetTagData(byte[] iccData, int index, ICCHeader header)
 {
     UnnomalizedIlluminant = new XYZNumber(iccData, index, IsLittleEndian);
     //Un-normalized CIEXYZ values for surround (12 bytes)
     UnnomalizedSurround = new XYZNumber(iccData, index + 12, IsLittleEndian);
     //Standard illuminant (4 bytes)
     Illuminant = (StandardIlluminant)HighEndianReader.GetUint32(iccData, index + 24, IsLittleEndian);
 }
 public override void GetTagData(byte[] iccData, int index, ICCHeader header)
 {
     ColorantCount  = HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
     ColorantNumber = new byte[ColorantCount];
     for (int i = 1; i < ColorantCount; i++)
     {
         int startIndex = index + 4 + i;
         ColorantNumber[i] = iccData[startIndex];
     }
 }
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            int arrayNumber = (int)(dataSize - 8) / 4;

            Data = new UInt32[arrayNumber];
            for (int i = 0; i < arrayNumber; i++)
            {
                int dataIndex = index + i * 4;
                Data[i] = HighEndianReader.GetUint32(iccData, dataIndex, IsLittleEndian);
            }
        }
예제 #10
0
        internal static MultiProcessElement CreateElement(byte[] iccData, int idx, bool isLittleEndian = false)
        {
            //Tag signature (byte position 0 to 3) (4 to 7 are zero)
            multiProcessElementSignature t = (multiProcessElementSignature)HighEndianReader.GetUint32(iccData, idx);
            //Number of input channels (2 bytes)
            ushort InputChannelCount = HighEndianReader.GetUInt16(iccData, idx + 8);
            //Number of output channels (2 bytes)
            ushort OutputChannelCount = HighEndianReader.GetUInt16(iccData, idx + 10, isLittleEndian);

            return(GetElement(t, iccData, idx + 12, InputChannelCount, OutputChannelCount));
        }
예제 #11
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            DescriptionCount = (int)HighEndianReader.GetUint32(iccData, index);
            //Profile description structures
            Descriptions = new ProfileDescription[DescriptionCount];
            int end = index + 4;

            for (int i = 0; i < DescriptionCount; i++)
            {
                Descriptions[i] = new ProfileDescription(iccData, end, header); end = Descriptions[i].end;
            }
        }
 public override void GetTagData(byte[] iccData, int index, ICCHeader header)
 {
     Observer = (StandardObserver)HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
     //nCIEXYZ tristimulus values for measurement backing
     XYZBacking = new XYZNumber(iccData, index + 4, IsLittleEndian);
     //Measurement geometry (4 bytes)
     Geometry = (MeasurementGeometry)HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
     //Measurement flare (4 bytes)
     Flare = HighEndianReader.GetU16Fixed16NumberToDouble(iccData, index + 24, IsLittleEndian);
     //Standard illuminant (4 bytes)
     Illuminant = (StandardIlluminant)HighEndianReader.GetUint32(iccData, index + 24, IsLittleEndian);
 }
예제 #13
0
 public override void GetCurveData(byte[] iccData, int index, bool isLittleEndian)
 {
     //The number of entries (4 bytes)
     EntryCount = (int)HighEndianReader.GetUint32(iccData, index, BitConverter.IsLittleEndian);
     //Curve entries (4 bytes each)
     CurveEntries = new double[EntryCount];
     end          = index + 4 + 4 * EntryCount;
     for (int i = 0; i < EntryCount; i++)
     {
         int dataEntryPoint = index + 4 + i * 4;
         CurveEntries[i] = HighEndianReader.GetFloat32(iccData, dataEntryPoint, BitConverter.IsLittleEndian);
     }
     LengthInByte = EntryCount * 4 + 4;
 }
 public override void GetTagData(byte[] iccData, int index, ICCHeader header)
 {
     ColorantCount = HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
     //Number of the colorant to be printed first
     ColorantData = new ColorantData[ColorantCount];
     for (int i = 0; i < ColorantCount; i++)
     {
         //Colorant name (32 bytes)
         int    startIndex = index + 4 + i * 38;
         string name       = HighEndianReader.GetASCII(iccData, startIndex, 32);
         //PCS values (6 bytes (2 bytes each))
         ushort pcs1 = HighEndianReader.GetUInt16(iccData, startIndex + 32, IsLittleEndian);
         ushort pcs2 = HighEndianReader.GetUInt16(iccData, startIndex + 34, IsLittleEndian);
         ushort pcs3 = HighEndianReader.GetUInt16(iccData, startIndex + 36, IsLittleEndian);
     }
 }
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            //Number of Input Channels (1 byte)
            InputChannelCount = iccData[index];
            //Number of Output Channels (1 byte)
            OutputChannelCount = iccData[index + 1];
            //Reserved for padding (2 bytes)
            //Offset to first "B" curve (4 bytes)
            BCurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 4, IsLittleEndian);
            //Offset to matrix (4 bytes)
            MatrixOffset = (int)HighEndianReader.GetUint32(iccData, index + 8, IsLittleEndian);
            MCurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 12, IsLittleEndian);
            //Offset to CLUT (4 bytes)
            CLUTOffset = (int)HighEndianReader.GetUint32(iccData, index + 16, IsLittleEndian);
            //Offset to first "A" curve (4 bytes)
            ACurveOffset = (int)HighEndianReader.GetUint32(iccData, index + 20, IsLittleEndian);

            //Curves
            if (BCurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveB, index, InputChannelCount);
            }
            if (MCurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveM, index, InputChannelCount);
            }
            if (CLUTOffset != 0)
            {
                CLUTValues = CLUT.GetCLUT(iccData, index - 8 + CLUTOffset, false, InputChannelCount, OutputChannelCount);
            }
            if (ACurveOffset != 0)
            {
                GetCurve(iccData, ACurveOffset, ref curveA, index, InputChannelCount);
            }

            //Matrix
            if (MatrixOffset != 0)
            {
                int i = MatrixOffset + index - 8;
                //Matrix 3x3 (4 bytes each)
                Matrix3x3 = HighEndianReader.GetMatrix(iccData, 3, 3, i, false, IsLittleEndian);
                //Matrix 3x1 (4 bytes each)
                Matrix3x1 = HighEndianReader.GetMatrix(iccData, 3, i + 36, false, IsLittleEndian);
            }
        }
 public override void GetTagData(byte[] iccData, int index, ICCHeader header)
 {
     CurvePointCount = HighEndianReader.GetUint32(iccData, index, IsLittleEndian);
     CurveData       = new double[CurvePointCount];
     if (CurvePointCount == 1)
     {
         CurveData[0] = HighEndianReader.GetU8Fixed8NumberToDouble(iccData, index + 4, IsLittleEndian);
         //end = index + 6;
     }
     else
     {
         for (int i = 0; i < CurvePointCount; i++)
         {
             int startIndex = index + 4 + 2 * i;
             CurveData[i] = HighEndianReader.GetUInt16(iccData, startIndex, IsLittleEndian) / 65535d;
         }
         //int c = 0; end = (idx + 4) + (int)CurvePointCount * 2;
     }
 }
예제 #17
0
        public override void GetTagData(byte[] iccData, int index, ICCHeader header)
        {
            VendorSpecFlag = iccData.Get(index, index + 4);
            //VendorSpecFlag =  new byte[] { ICCProfile.DataBytes[idx], ICCProfile.DataBytes[idx + 1], ICCProfile.DataBytes[idx + 2], ICCProfile.DataBytes[idx + 3] };
            //Count of named colours (4 bytes)
            NamedColorCount = (int)HighEndianReader.GetUint32(iccData, index + 4, IsLittleEndian);
            //Number of device coordinates (4 bytes)
            DeviceCoordinateCount = (int)HighEndianReader.GetUint32(iccData, index + 8, IsLittleEndian);
            //Prefix for each colour name
            Prefix = HighEndianReader.GetASCII(iccData, index + 12, 32);
            //Suffix for each colour name
            Suffix = HighEndianReader.GetASCII(iccData, index + 44, 32);
            //Colors
            NamedColors = new NamedColor[NamedColorCount];

            for (int i = 0; i < NamedColorCount; i++)
            {
                int dataEntryIndex = index + 76 + (38 + 2 * DeviceCoordinateCount) * i;
                NamedColors[i] = new NamedColor(iccData, dataEntryIndex, DeviceCoordinateCount, IsLittleEndian);;
            }
        }
        internal ResponseCurve(byte[] iccData, int idx, int ChannelCount, bool isLittleEndian)
        {
            int dataEntryPoint = 0;

            //Measurement unit signature (4 bytes)
            CurveType = (CurveMeasurementEncodings)HighEndianReader.GetUint32(iccData, idx, isLittleEndian);
            //Counts of measurements in response arrays
            MeasurmentCounts = new int[ChannelCount];
            //int end = idx + 4 + 4 * ChannelCount; int c = 0;
            //for (int i = idx + 4; i < end; i += 4)
            //{ MeasurmentCounts[c] = (int)Helper.GetUInt32(i); c++; }

            for (int i = 0; i < ChannelCount; i++)
            {
                dataEntryPoint      = idx + 4 + i * 4;
                MeasurmentCounts[i] = (int)HighEndianReader.GetUint32(iccData, dataEntryPoint, isLittleEndian);
            }
            //PCSXYZ values
            XYZvalues = new XYZNumber[ChannelCount];
            for (int i = 0; i < ChannelCount; i++)
            {
                dataEntryPoint = idx + 4 + ChannelCount * 4 + i * 4;
                XYZvalues[i]   = new XYZNumber(iccData, dataEntryPoint, isLittleEndian);
            }
            //int start = end; end += 12 * ChannelCount; c = 0;
            //for (int i = start; i < end; i += 12) { XYZvalues[c] = new XYZNumber(i); c++; }
            //Response arrays
            int p = MeasurmentCounts.Sum();

            ResponseArrays = new Response16Number[p];
            for (int i = 0; i < p; i++)
            {
                dataEntryPoint   += 8;
                ResponseArrays[i] = new Response16Number(iccData, dataEntryPoint, isLittleEndian);
            }
            //start = end; end += 8 * p; c = 0;
            //for (int i = start; i < end; i += 8) { ResponseArrays[c] = new Response16Number(i); c++; }
        }
예제 #19
0
 public ProfileDescription(byte[] iccData, int index, ICCHeader header)
 {
     DeviceManufacturer = HighEndianReader.GetUint32(iccData, index);
     //Device model signature (4 bytes)
     DeviceModel = HighEndianReader.GetUint32(iccData, index + 4);
     //Device attributes (8 bytes)
     DeviceAttributes = new DeviceAttribute(iccData, index + 8);
     //Device technology information (4 bytes)
     TechnologyInformation = (TagSignature)HighEndianReader.GetUint32(iccData, index + 16);
     //Displayable description of device manufacturer (profile's deviceMfgDescTag)
     DeviceManufacturerInfo = new MultiLocalizedUnicodeTag()
     {
         IsPlaceHolder = header.DeviceManufacturer == 0
     };
     DeviceManufacturerInfo.GetTagData(iccData, index + 20, header);
     //Displayable description of device model (profile's deviceModelDescTag)
     DeviceModelInfo = new MultiLocalizedUnicodeTag()
     {
         IsPlaceHolder = header.DeviceModel == 0
     };
     DeviceModelInfo.GetTagData(iccData, DeviceManufacturerInfo.LengthInByte + index + 20, header);
     //end = DeviceModelInfo.end;
 }
 internal PositionNumber(byte[] iccData, int index, bool isLittleEndian = false)
 {
     this.Offset = (int)HighEndianReader.GetUint32(iccData, index, isLittleEndian);
     this.Size   = (int)HighEndianReader.GetUint32(iccData, index + 4, isLittleEndian);
 }