コード例 #1
0
        /// <summary>
        /// init
        /// </summary>
        /// <param name="functionDict"></param>
        public void Init(DictionaryOperand functionDict)
        {
            var domainArray    = functionDict.Dictionary.GetArray(EpsKeys.Domain);
            var functionsArray = functionDict.Dictionary.GetArray(EpsKeys.Functions);
            var encodeArray    = functionDict.Dictionary.GetArray(EpsKeys.Encode);

            var e0 = OperandHelper.GetRealValue(encodeArray.Values[0].Operand);
            var e1 = OperandHelper.GetRealValue(encodeArray.Values[1].Operand);

            // It doesn't make sense to revert only one function
            // we assume either none or all functions are reverted
            reverse = e0 > e1;

            var boundsArray = functionDict.Dictionary.GetArray(EpsKeys.Bounds);

            bounds = OperandHelper.GetRealValues(boundsArray);
            bounds.Insert(0, OperandHelper.GetRealValue(domainArray.Values[0].Operand));
            bounds.Add(OperandHelper.GetRealValue(domainArray.Values[1].Operand));

            functions = new List <IFunction>();

            for (int i = 0; i < functionsArray.Values.Count; i++)
            {
                var fDict    = (DictionaryOperand)functionsArray.Values[i].Operand;
                var function = FunctionActivator.CreateFunction(fDict);
                functions.Add(function);
            }
        }
コード例 #2
0
        /// <summary>
        /// init
        /// </summary>
        /// <param name="functionDict"></param>
        public void Init(DictionaryOperand functionDict)
        {
            var domainArray = functionDict.Dictionary.GetArray(EpsKeys.Domain);
            var c0Array     = functionDict.Dictionary.GetArray(EpsKeys.C0);
            var c1Array     = functionDict.Dictionary.GetArray(EpsKeys.C1);

            //var rangeArray = functionDict.Dictionary.GetArray(EpsKeys.Range);
            //var n = functionDict.Dictionary.GetInteger(EpsKeys.N);

            domain0 = OperandHelper.GetRealValue(domainArray.Values[0].Operand);
            domain1 = OperandHelper.GetRealValue(domainArray.Values[1].Operand);

            c0 = OperandHelper.GetRealValues(c0Array);
            c1 = OperandHelper.GetRealValues(c1Array);
        }
コード例 #3
0
        /// <summary>
        /// Init
        /// </summary>
        public void Init(EpsInterpreter interpreter, DictionaryOperand shadingDict)
        {
            var colorSpaceOperand = shadingDict.Dictionary.Find(EpsKeys.ColorSpace);

            colorSpace = ColorSpaceActivator.CreateColorSpace(interpreter, colorSpaceOperand);

            var functionDict = shadingDict.Dictionary.GetDictionary(EpsKeys.Function);

            function = FunctionActivator.CreateFunction(functionDict);

            var coordsArray = shadingDict.Dictionary.GetArray(EpsKeys.Coords);
            var coords      = OperandHelper.GetRealValues(coordsArray);

            coords0 = new Point(coords[0], coords[1]);
            coords1 = new Point(coords[2], coords[3]);
        }
コード例 #4
0
        /// <summary>
        /// init
        /// </summary>
        /// <param name="functionDict"></param>
        public void Init(DictionaryOperand functionDict)
        {
            var domainArray = functionDict.Dictionary.GetArray(EpsKeys.Domain);
            //var rangeArray = functionDict.Dictionary.GetArray(EpsKeys.Range);
            //var encodeArray = functionDict.Dictionary.GetArray(EpsKeys.Encode);
            var decodeArray   = functionDict.Dictionary.GetArray(EpsKeys.Decode);
            var sizeArray     = functionDict.Dictionary.GetArray(EpsKeys.Size);
            var dataSource    = functionDict.Dictionary.GetString(EpsKeys.DataSource);
            var bitsPerSample = functionDict.Dictionary.GetInteger(EpsKeys.BitsPerSample);

            domain0 = OperandHelper.GetRealValue(domainArray.Values[0].Operand);
            domain1 = OperandHelper.GetRealValue(domainArray.Values[1].Operand);

            var decodes = OperandHelper.GetRealValues(decodeArray);
            var size    = (IntegerOperand)sizeArray.Values[0].Operand;
            var data    = RelativeSamplesDecoder.Decode(dataSource, bitsPerSample.Value);

            int valuesPerSample = data.Count / size.Value;

            c0 = GetSample(data, 0, valuesPerSample, decodes);
            c1 = GetSample(data, (data.Count - valuesPerSample), valuesPerSample, decodes);
        }