void RenderAlternatePath(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 20);

      XPen pen = new XPen(XColors.Navy, 2.5);

      // Alternate fill mode
      XGraphicsPath path = new XGraphicsPath();
      path.FillMode = XFillMode.Alternate;
      path.AddLine(10, 130, 10, 40);
      path.AddBeziers(new XPoint[]{new XPoint(10, 40), new XPoint(30, 0), new XPoint(40, 20), new XPoint(60, 40), 
                                   new XPoint(80, 60), new XPoint(100, 60), new XPoint(120, 40)});
      path.AddLine(120, 40, 120, 130);
      path.CloseFigure();
      path.AddEllipse(40, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Draws an alternating and a winding path.
    /// </summary>
    void DrawPathAlternateAndWinding(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawPath (alternate / winding)");

      XPen pen = new XPen(XColors.Navy, 2.5);

      // Alternate fill mode
      XGraphicsPath path = new XGraphicsPath();
      path.FillMode = XFillMode.Alternate;
      path.AddLine(10, 130, 10, 40);
      path.AddBeziers(new XPoint[]{new XPoint(10, 40), new XPoint(30, 0), new XPoint(40, 20), new XPoint(60, 40), 
                                   new XPoint(80, 60), new XPoint(100, 60), new XPoint(120, 40)});
      path.AddLine(120, 40, 120, 130);
      path.CloseFigure();
      path.AddEllipse(40, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);

      // Winding fill mode
      path = new XGraphicsPath();
      path.FillMode = XFillMode.Winding;
      path.AddLine(130, 130, 130, 40);
      path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40), 
                                   new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
      path.AddLine(240, 40, 240, 130);
      path.CloseFigure();
      path.AddEllipse(160, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);

      EndBox(gfx);
    }
    void RenderWindingPath(XGraphics gfx)
    {
      gfx.TranslateTransform(15, 150);

      XPen pen = new XPen(XColors.Navy, 2.5);

      // Winding fill mode
      XGraphicsPath path = new XGraphicsPath();
      path = new XGraphicsPath();
      path.FillMode = XFillMode.Winding;
      path.AddLine(130, 130, 130, 40);
      path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40), 
                                   new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
      path.AddLine(240, 40, 240, 130);
      path.CloseFigure();
      path.AddEllipse(160, 80, 50, 40);
      gfx.DrawPath(pen, XBrushes.DarkOrange, path);
    }