CurveTo() public method

public CurveTo ( float x2, float y2, float x3, float y3 ) : void
x2 float
y2 float
x3 float
y3 float
return void
示例#1
-6
 //copied this because of the moveTo
 public void Arc(float x1, float y1, float x2, float y2, float startAng, float extent, PdfContentByte cb)
 {
     List<float[]> ar = PdfContentByte.BezierArc(x1, y1, x2, y2, startAng, extent);
     if (ar.Count == 0)
         return;
     float[] pt = ar[0];
     //moveTo(pt[0], pt[1]);
     for (int k = 0; k < ar.Count; ++k)
     {
         pt = ar[k];
         cb.CurveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
     }
 }
示例#2
-8
        void DrawElement(PdfContentByte cb)
        {
            try
            {
                IList<PathItem> translatedItems = Translate(path.PathItems);

                //loop over the items in the path
                foreach (PathItem item in translatedItems)
                {
                    IList<float> numbers = item.Coordinates;

                    if (item.IsMoveTo())
                    {
                        cb.MoveTo(numbers[0], numbers[1]);
                    }
                    else if (item.IsLineTo())
                    {
                        cb.LineTo(numbers[0], numbers[1]);
                    }
                    else if (item.IsCubicBezier())
                    {
                        cb.CurveTo(numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5]);
                    }
                    else if (item.IsQuadraticBezier())
                    {
                        cb.CurveTo(numbers[0], numbers[1], numbers[2], numbers[3]);
                    }
                    else if (item.IsArcTo())
                    {
                        DrawArc(cb, numbers);
                    }
                    else if (item.IsClosePath())
                    {
                        cb.ClosePath();
                    }
                    else
                    {
                        //System.out.Println(item);
                    }
                }
            } catch {
                //TODO
            }
        }
示例#3
-8
// ---------------------------------------------------------------------------    
    /**
     * Draws a series of Bezier curves
     * @param cb the canvas to which the curves have to be drawn
     * @param x0 X coordinate of the start point
     * @param y0 Y coordinate of the start point
     * @param x1 X coordinate of the first control point
     * @param y1 Y coordinate of the first control point
     * @param x2 X coordinate of the second control point
     * @param y2 Y coordinate of the second control point
     * @param x3 X coordinate of the end point
     * @param y3 Y coordinate of the end point
     * @param distance the distance between the curves
     */
    public void createBezierCurves(PdfContentByte cb, float x0, float y0,
        float x1, float y1, float x2, float y2, float x3, 
        float y3, float distance) 
    {
      cb.MoveTo(x0, y0);
      cb.LineTo(x1, y1);
      cb.MoveTo(x2, y2);
      cb.LineTo(x3, y3);
      cb.MoveTo(x0, y0);
      cb.CurveTo(x1, y1, x2, y2, x3, y3);
      x0 += distance;
      x1 += distance;
      x2 += distance;
      x3 += distance;
      cb.MoveTo(x2, y2);
      cb.LineTo(x3, y3);
      cb.MoveTo(x0, y0);
      cb.CurveTo(x2, y2, x3, y3);
      x0 += distance;
      x1 += distance;
      x2 += distance;
      x3 += distance;
      cb.MoveTo(x0, y0);
      cb.LineTo(x1, y1);
      cb.MoveTo(x0, y0);
      cb.CurveTo(x1, y1, x3, y3);
      cb.Stroke();
    }
   // ---------------------------------------------------------------------------
   /**
    * Creates a path for circle using Bezier curvers.
    * The path can be constructed clockwise or counter-clockwise.
    * This method doesn't Fill or stroke the circle!
    * @param canvas    the canvas for which the path is constructed
    * @param x         the X coordinate of the center of the circle
    * @param y         the Y coordinate of the center of the circle
    * @param r         the radius
    * @param clockwise true if the circle has to be constructed clockwise
    */
   public static void CreateCircle(PdfContentByte canvas, float x, float y,
 float r, bool clockwise)
   {
       float b = 0.5523f;
         if (clockwise) {
       canvas.MoveTo(x + r, y);
       canvas.CurveTo(x + r, y - r * b, x + r * b, y - r, x, y - r);
       canvas.CurveTo(x - r * b, y - r, x - r, y - r * b, x - r, y);
       canvas.CurveTo(x - r, y + r * b, x - r * b, y + r, x, y + r);
       canvas.CurveTo(x + r * b, y + r, x + r, y + r * b, x + r, y);
         } else {
       canvas.MoveTo(x + r, y);
       canvas.CurveTo(x + r, y + r * b, x + r * b, y + r, x, y + r);
       canvas.CurveTo(x - r * b, y + r, x - r, y + r * b, x - r, y);
       canvas.CurveTo(x - r, y - r * b, x - r * b, y - r, x, y - r);
       canvas.CurveTo(x + r * b, y - r, x + r, y - r * b, x + r, y);
         }
   }