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


C# PdfContentByte.FillStroke方法代碼示例

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


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

示例1: DrawRectangles

// ---------------------------------------------------------------------------    
    /**
     * Draws three rectangles
     * @param canvas
     */
    public void DrawRectangles(PdfContentByte canvas) {
      canvas.SaveState();
      canvas.SetGrayFill(0.9f);
      canvas.Rectangle(33, 592, 72, 72);
      canvas.Rectangle(263, 406, 72, 72);
      canvas.Rectangle(491, 168, 72, 72);
      canvas.FillStroke();
      canvas.RestoreState();
    }    
開發者ID:,項目名稱:,代碼行數:14,代碼來源:

示例2: Render

        /// <summary>
        /// Renders the object in a document using a <see cref="PdfContentByte"/> by invoking the <see cref="Render(ContentWriter, Vector2D)"/> method.
        /// This method can be overridden in derived classes to specify rendering.
        /// </summary>
        /// <param name="cb">The <see cref="PdfContentByte"/> used for rendering.</param>
        /// <param name="offset">The calculated offset for the rendered item.</param>
        protected internal virtual void Render(PdfContentByte cb, Vector2D offset)
        {
            using (var writer = new ContentWriter(cb))
            {
                var stroke = this as StrokeObject;
                var fill = this as FillObject;

                bool hasstroke = stroke?.BorderColor.HasValue ?? false;
                bool hasfill = fill?.FillColor.HasValue ?? false;

                if (hasstroke)
                {
                    cb.SetLineWidth((float)stroke.BorderWidth.Value(UnitsOfMeasure.Points));
                    cb.SetColorStroke(new Color(stroke.BorderColor.Value));
                }
                if (hasfill)
                    cb.SetColorFill(new Color(fill.FillColor.Value));

                Render(writer, offset);

                if (hasstroke && hasfill)
                {
                    if (writer.CloseShape)
                        cb.ClosePathFillStroke();
                    else
                        cb.FillStroke();
                }
                else if (hasstroke)
                {
                    if (writer.CloseShape)
                        cb.ClosePathStroke();
                    else
                        cb.Stroke();
                }
                else if (hasfill)
                    cb.Fill();
            }
        }
開發者ID:deaddog,項目名稱:DeadDog.PDF,代碼行數:44,代碼來源:LeafObject.cs

示例3: FinishShape

		protected static void FinishShape (PdfContentByte contentByte)
		{
			contentByte.FillStroke();
			contentByte.ResetRGBColorFill();
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:5,代碼來源:BaseShape.cs

示例4: DrawRectangle

 // ---------------------------------------------------------------------------    
 /**
  * Draws a rectangle
  * @param content the direct content layer
  * @param width the width of the rectangle
  * @param height the height of the rectangle
  */
 public static void DrawRectangle(
   PdfContentByte content, float width, float height)
 {
     content.SaveState();
     PdfGState state = new PdfGState();
     state.FillOpacity = 0.6f;
     content.SetGState(state);
     content.SetRGBColorFill(0xFF, 0xFF, 0xFF);
     content.SetLineWidth(3);
     content.Rectangle(0, 0, width, height);
     content.FillStroke();
     content.RestoreState();
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:20,代碼來源:Layers.cs

示例5: PictureBackdrop

 /**
  * Prints a square and fills half of it with a gray rectangle.
  *
  * @param x
  * @param y
  * @param cb
  * @throws Exception
  */
 private void PictureBackdrop(float x, float y, PdfContentByte cb,
     PdfWriter writer) {
     PdfShading axial = PdfShading.SimpleAxial(writer, x, y, x + 200, y,
         BaseColor.YELLOW, BaseColor.RED);
     PdfShadingPattern axialPattern = new PdfShadingPattern(axial);
     cb.SetShadingFill(axialPattern);
     cb.SetColorStroke(BaseColor.BLACK);
     cb.SetLineWidth(2);
     cb.Rectangle(x, y, 200, 200);
     cb.FillStroke();
 }
開發者ID:smartleos,項目名稱:itextsharp,代碼行數:19,代碼來源:PdfA2CheckerTest.cs

示例6: ColorRectangle

 public virtual void ColorRectangle(PdfContentByte canvas,
     BaseColor color, float x, float y, float width, float height) {
     canvas.SaveState();
     canvas.SetColorFill(color);
     canvas.Rectangle(x, y, width, height);
     canvas.FillStroke();
     canvas.RestoreState();
 }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:8,代碼來源:LabColorSpaceTest.cs

示例7: CreateSquares

// ---------------------------------------------------------------------------    
    /**
     * Draws a row of squares.
     * @param canvas the canvas to which the squares have to be drawn
     * @param x      X coordinate to position the row
     * @param y      Y coordinate to position the row
     * @param side   the side of the square
     * @param gutter the space between the squares
     */
    public void CreateSquares(PdfContentByte canvas,
      float x, float y, float side, float gutter) {
      canvas.SaveState();
      canvas.SetColorStroke(new GrayColor(0.2f));
      canvas.SetColorFill(new GrayColor(0.9f));
      canvas.MoveTo(x, y);
      canvas.LineTo(x + side, y);
      canvas.LineTo(x + side, y + side);
      canvas.LineTo(x, y + side);
      canvas.Stroke();
      x = x + side + gutter;
      canvas.MoveTo(x, y);
      canvas.LineTo(x + side, y);
      canvas.LineTo(x + side, y + side);
      canvas.LineTo(x, y + side);
      canvas.ClosePathStroke();
      x = x + side + gutter;
      canvas.MoveTo(x, y);
      canvas.LineTo(x + side, y);
      canvas.LineTo(x + side, y + side);
      canvas.LineTo(x, y + side);
      canvas.Fill();
      x = x + side + gutter;
      canvas.MoveTo(x, y);
      canvas.LineTo(x + side, y);
      canvas.LineTo(x + side, y + side);
      canvas.LineTo(x, y + side);
      canvas.FillStroke();
      x = x + side + gutter;
      canvas.MoveTo(x, y);
      canvas.LineTo(x + side, y);
      canvas.LineTo(x + side, y + side);
      canvas.LineTo(x, y + side);
      canvas.ClosePathFillStroke();
      canvas.RestoreState();
    }
開發者ID:,項目名稱:,代碼行數:45,代碼來源:

示例8: CreateStarsAndCircles

// ---------------------------------------------------------------------------    
    /**
     * Draws a row of stars and circles.
     * @param canvas the canvas to which the shapes have to be drawn
     * @param x      X coordinate to position the row
     * @param y      Y coordinate to position the row
     * @param radius the radius of the circles
     * @param gutter the space between the shapes
     */
    public static void CreateStarsAndCircles(PdfContentByte canvas,
        float x, float y, float radius, float gutter) 
    {
      canvas.SaveState();
      canvas.SetColorStroke(new GrayColor(0.2f));
      canvas.SetColorFill(new GrayColor(0.9f));
      CreateStar(canvas, x, y);
      CreateCircle(canvas, x + radius, y - 70, radius, true);
      CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
      canvas.Fill();
      x += 2 * radius + gutter;
      CreateStar(canvas, x, y);
      CreateCircle(canvas, x + radius, y - 70, radius, true);
      CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
      canvas.EoFill();
      x += 2 * radius + gutter;
      CreateStar(canvas, x, y);
      canvas.NewPath();
      CreateCircle(canvas, x + radius, y - 70, radius, true);
      CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
      x += 2 * radius + gutter;
      CreateStar(canvas, x, y);
      CreateCircle(canvas, x + radius, y - 70, radius, true);
      CreateCircle(canvas, x + radius, y - 70, radius / 2, false);
      canvas.FillStroke();
      x += 2 * radius + gutter;
      CreateStar(canvas, x, y);
      CreateCircle(canvas, x + radius, y - 70, radius, true);
      CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
      canvas.EoFillStroke();
      canvas.RestoreState();
    }
開發者ID:,項目名稱:,代碼行數:41,代碼來源:

示例9: Close

        public void Close(PdfContentByte cb, IDictionary<String, String> css)
        {
            //default is true for both
            String fillValue;
            String strokeValue;

            bool fill = (!css.TryGetValue("fill", out fillValue) || fillValue == null || !fillValue.Equals("none"));
            bool stroke = (!css.TryGetValue("stroke", out strokeValue) || strokeValue == null || !strokeValue.Equals("none"));

            if (fill && stroke) {
                cb.FillStroke();
            } else if (fill) {
                cb.Fill();
            } else if (stroke) {
                cb.Stroke();
            }
        }
開發者ID:,項目名稱:,代碼行數:17,代碼來源:


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