/// <summary> /// GetColor /// </summary> public Color GetColor(List <double> values) { var colorValues = new List <double>(); var index = LimitIndexToBoundaries((int)values[0]); var numberColorValues = baseColorSpace.GetNumberOfValuesPerColor(); if (!useProcedure) { index *= numberColorValues; for (int i = 0; i < numberColorValues; i++) { colorValues.Add(hexString[index + i] / 255.0); } } else { var operandStack = interpreter.OperandStack; var intOp = new IntegerOperand(index); operandStack.Push(intOp); interpreter.Execute(tintTransformationProcedure); for (int i = 0; i < numberColorValues; i++) { var real = operandStack.PopRealValue(); colorValues.Add(real); } colorValues.Reverse(); } return(baseColorSpace.GetColor(colorValues)); }
/// <summary> /// Convert the given values to the destination color space values /// </summary> private List <double> ConvertValuesToAlternativeColorSpaceValues(List <double> values) { var operandStack = interpreter.OperandStack; foreach (var val in values) { var realOp = new RealOperand(val); operandStack.Push(realOp); } interpreter.Execute(tintTransformationProcedure); var newValues = new List <double>(); for (int i = 0; i < alternativeColorSpace.GetNumberOfValuesPerColor(); i++) { var real = operandStack.PopRealValue(); newValues.Add(real); } newValues.Reverse(); return(values); }
public override void Execute(EpsInterpreter interpreter) { if (!IsExecutable) { interpreter.OperandStack.Push(Copy()); } else { var name = new NameOperand(this.Value); var op = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name); if (op != null) { interpreter.Execute(op); } } }
/// <summary> /// Execute the operands /// </summary> /// <param name="interpreter"></param> public override void Execute(EpsInterpreter interpreter) { if (!IsExecutable || interpreter.BreakCurrentLoop) { return; } foreach (var op in Values) { interpreter.Execute(op.Operand); if (interpreter.BreakCurrentLoop) { break; } } }