當前位置: 首頁>>代碼示例>>C#>>正文


C# PdfContentByte.CurveTo方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.CurveTo方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.CurveTo方法的具體用法?C# PdfContentByte.CurveTo怎麽用?C# PdfContentByte.CurveTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PdfContentByte的用法示例。


在下文中一共展示了PdfContentByte.CurveTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateCircle

   // ---------------------------------------------------------------------------
   /**
    * 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);
         }
   }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:29,代碼來源:PathConstructionAndPainting.cs

示例2: DrawElement

        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
            }
        }
開發者ID:,項目名稱:,代碼行數:44,代碼來源:

示例3: createBezierCurves

// ---------------------------------------------------------------------------    
    /**
     * 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();
    }
開發者ID:,項目名稱:,代碼行數:42,代碼來源:

示例4: Arc

 //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]);
     }
 }
開發者ID:,項目名稱:,代碼行數:14,代碼來源:


注:本文中的iTextSharp.text.pdf.PdfContentByte.CurveTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。