Example #1
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();
        }
        /// <summary>
        /// Converts the fill rule.
        /// </summary>
        private static FillRule ConvertFillRule(GraphicFillRule graphicFillRule)
        {
            FillRule fillRule = FillRule.EvenOdd;

            switch (graphicFillRule)
            {
            case GraphicFillRule.EvenOdd:
                fillRule = FillRule.EvenOdd;
                break;

            case GraphicFillRule.NoneZero:
                fillRule = FillRule.Nonzero;
                break;
            }

            return(fillRule);
        }