Ejemplo n.º 1
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var operandStack = interpreter.OperandStack;

            var topOperand   = operandStack.Pop();
            var graphicState = interpreter.GraphicState;
            var ctm          = graphicState.CurrentTransformationMatrix;
            var geometry     = new GraphicPathGeometry();

            switch (topOperand)
            {
            case IntegerOperand integerOperand:
            case RealOperand realOperand:
            {
                var height = OperandHelper.GetRealValue(topOperand);
                var width  = operandStack.PopRealValue();
                var y      = operandStack.PopRealValue();
                var x      = operandStack.PopRealValue();

                AddRectangle(geometry, x, y, width, height, ctm);
                break;
            }

            case ArrayOperand arrayOperand:
            {
                for (int i = 0; i < arrayOperand.Values.Count; i += 4)
                {
                    var x      = OperandHelper.GetRealValue(arrayOperand.Values[i].Operand);
                    var y      = OperandHelper.GetRealValue(arrayOperand.Values[i + 1].Operand);
                    var height = OperandHelper.GetRealValue(arrayOperand.Values[i + 2].Operand);
                    var width  = OperandHelper.GetRealValue(arrayOperand.Values[i + 3].Operand);

                    AddRectangle(geometry, x, y, width, height, ctm);
                }
                break;
            }

            case StringOperand stringOperand:
            {
                var values = HomogeneousNumberArrayDecoder.Decode(stringOperand);

                for (int i = 0; i < values.Count; i += 4)
                {
                    var x      = values[i];
                    var y      = values[i + 1];
                    var height = values[i + 2];
                    var width  = values[i + 3];

                    AddRectangle(geometry, x, y, width, height, ctm);
                }

                break;
            }
            }

            ClipHelper.SetClip(interpreter, geometry);
            interpreter.ResetCurrentGeometry();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build up a path from the current geometry and the current fill
        /// </summary>
        public static void Fill(EpsInterpreter interpreter, GraphicFillRule fillRule)
        {
            GraphicsState graphicState = interpreter.GraphicState;

            graphicState.CurrentGeometry.FillRule = fillRule;
            var path = new GraphicPath();

            path.Geometry = graphicState.CurrentGeometry;

            path.FillBrush      = graphicState.FillBrush.GetBrush(graphicState.CurrentGeometry.Bounds);
            path.ColorPrecision = graphicState.FillBrush.ColorPrecision;

            interpreter.GraphicGroup.Children.Add(path);
            interpreter.ResetCurrentGeometry();
        }
Ejemplo n.º 3
0
        public override void Execute(EpsInterpreter interpreter)
        {
            GraphicsState graphicState = interpreter.GraphicState;

            var path = new GraphicPath();

            path.Geometry = graphicState.CurrentGeometry;

            path.StrokeBrush      = graphicState.FillBrush.GetBrush(graphicState.CurrentGeometry.Bounds);
            path.StrokeThickness  = graphicState.LineWidth;
            path.StrokeDashes     = graphicState.Dashes;
            path.StrokeDashOffset = graphicState.DashOffset;
            path.StrokeLineCap    = graphicState.LineCap;
            path.StrokeLineJoin   = graphicState.LineJoin;
            path.StrokeMiterLimit = graphicState.MiterLimit;

            path.ColorPrecision = graphicState.FillBrush.ColorPrecision;

            interpreter.GraphicGroup.Childreen.Add(path);
            interpreter.ResetCurrentGeometry();
        }
Ejemplo n.º 4
0
 public override void Execute(EpsInterpreter interpreter)
 {
     ClipHelper.SetClip(interpreter, interpreter.GraphicState.CurrentGeometry);
     interpreter.ResetCurrentGeometry();
 }
Ejemplo n.º 5
0
 public override void Execute(EpsInterpreter interpreter)
 {
     interpreter.ResetCurrentGeometry();
 }