public override void Execute(EpsInterpreter interpreter) { var operandStack = interpreter.OperandStack; var op = operandStack.Pop(); if (op is ArrayOperand arrayOperand) { var matrix = OperandHelper.GetMatrix(arrayOperand); var transY = operandStack.PopRealValue(); var transX = operandStack.PopRealValue(); matrix.Invert(); var vector = matrix.Transform(new Vector(transX, transY)); operandStack.Push(new RealOperand(vector.X)); operandStack.Push(new RealOperand(vector.Y)); } else { var transY = OperandHelper.GetRealValue(op); var transX = operandStack.PopRealValue(); var ctm = interpreter.GraphicState.TransformationMatrix; var matrix = new Matrix(ctm.M11, ctm.M12, ctm.M21, ctm.M22, ctm.OffsetX, ctm.OffsetY); matrix.Invert(); var vector = matrix.Transform(new Point(transX, transY)); operandStack.Push(new RealOperand(vector.X)); operandStack.Push(new RealOperand(vector.Y)); } }
public override void Execute(EpsInterpreter interpreter) { var operandStack = interpreter.OperandStack; var op = operandStack.Pop(); if (op is ArrayOperand arrayOperand) { var matrix = OperandHelper.GetMatrix(arrayOperand); var transY = operandStack.PopRealValue(); var transX = operandStack.PopRealValue(); var point = matrix.Transform(new Point(transX, transY)); operandStack.Push(new RealOperand(point.X)); operandStack.Push(new RealOperand(point.Y)); } else { var transY = OperandHelper.GetRealValue(op); var transX = operandStack.PopRealValue(); var ctm = interpreter.GraphicState.TransformationMatrix; var point = ctm.Transform(new Point(transX, transY)); operandStack.Push(new RealOperand(point.X)); operandStack.Push(new RealOperand(point.Y)); } }
public override void Execute(EpsInterpreter interpreter) { var array = interpreter.OperandStack.PopArray(); var matrix = OperandHelper.GetMatrix(array); interpreter.GraphicState.TransformationMatrix = matrix; }
/// <summary> /// init /// </summary> public void Init(EpsInterpreter interpreter, DictionaryOperand patternDict) { var shadingDict = patternDict.Dictionary.GetDictionary(EpsKeys.Shading); shading = ShadingActivator.CreateShading(interpreter, shadingDict); var matrixArray = patternDict.Dictionary.GetArray(EpsKeys.Matrix); matrix = OperandHelper.GetMatrix(matrixArray); }
public override void Execute(EpsInterpreter interpreter) { var array = interpreter.OperandStack.PopArray(); var matrix = OperandHelper.GetMatrix(array); GraphicsState graphicState = interpreter.GraphicState; var ctm = graphicState.TransformationMatrix; ctm = matrix * ctm; graphicState.TransformationMatrix = ctm; }
public override void Execute(EpsInterpreter interpreter) { var operandStack = interpreter.OperandStack; var op = operandStack.Pop(); if (op is ArrayOperand arrayOperand) { var matrix = OperandHelper.GetMatrix(arrayOperand); var scaleY = operandStack.PopRealValue(); var scaleX = operandStack.PopRealValue(); matrix.Scale(scaleX, scaleY); var array = new ArrayOperand(); array.Values.Add(new OperandProxy(new RealOperand(matrix.M11))); array.Values.Add(new OperandProxy(new RealOperand(matrix.M12))); array.Values.Add(new OperandProxy(new RealOperand(matrix.M21))); array.Values.Add(new OperandProxy(new RealOperand(matrix.M22))); array.Values.Add(new OperandProxy(new RealOperand(matrix.OffsetX))); array.Values.Add(new OperandProxy(new RealOperand(matrix.OffsetY))); operandStack.Push(array); } else { var scaleY = OperandHelper.GetRealValue(op); var scaleX = operandStack.PopRealValue(); GraphicsState graphicState = interpreter.GraphicState; var ctm = graphicState.TransformationMatrix; ctm.Scale(scaleX, scaleY); graphicState.TransformationMatrix = ctm; } }