本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.ClosePathFillStroke方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.ClosePathFillStroke方法的具體用法?C# PdfContentByte.ClosePathFillStroke怎麽用?C# PdfContentByte.ClosePathFillStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.ClosePathFillStroke方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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();
}
}
示例2: DrawUpperRectangle
public static Point DrawUpperRectangle(PdfContentByte content, Rectangle pageRect, float barSize)
{
content.SaveState();
var state = new PdfGState {FillOpacity = FillOpacity};
content.SetGState(state);
content.SetColorFill(BaseColor.BLACK);
content.SetLineWidth(0);
var result = new Point(SideBorder + BorderPage,
pageRect.Height - (BorderPage + LeaderEdge + BarHeight + 1));
content.Rectangle(result.X, result.Y, barSize, BarHeight);
content.ClosePathFillStroke();
content.RestoreState();
return result;
}
示例3: DrawDiamont
/// <summary>
/// Draws the diamont.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
public static void DrawDiamont(PdfContentByte content, float x, float y)
{
content.SaveState();
var state = new PdfGState();
content.SetGState(state);
content.SetColorFill(BaseColor.BLACK);
content.MoveTo(x, y);
var sPoint = new Point(x, y);
var uMPoint = new Point(x + WPosMarkerMid, y + HPosMarkerMid);
var rPoint = new Point(uMPoint.X + WPosMarkerMid, uMPoint.Y - HPosMarkerMid);
var mPoint = new Point(rPoint.X - WPosMarkerMid, rPoint.Y - HPosMarkerMid);
DrawLines(content, uMPoint, rPoint, mPoint, sPoint);
content.ClosePathFillStroke();
content.RestoreState();
}
示例4: DrawBoxForCover
/// <summary>
/// Draws the box on the cover page that contains the date
/// </summary>
/// <param name="cb"></param>
/// <param name="doc"></param>
/// <param name="project"></param>
private void DrawBoxForCover(PdfContentByte cb, Document doc)
{
// set the colors
cb.SetColorStroke(_baseColor);
cb.SetColorFill(_baseColor);
// calculate the top left corner of the box
var x = doc.LeftMargin;
var y = doc.BottomMargin + 678;
var height = 60;
// move the cursor to starting position
cb.MoveTo(x, y);
// draw the top line
cb.LineTo(x + _pageWidth, y);
// draw the right line
cb.LineTo(x + _pageWidth, y - height);
// draw the bottom line
cb.LineTo(x, y - height);
// draw the left line
cb.LineTo(x, y);
cb.ClosePathFillStroke();
cb.Stroke();
// add the text inside the box
cb.BeginText();
cb.SetFontAndSize(_dateBaseFont, 26f);
cb.SetColorStroke(BaseColor.WHITE);
cb.SetColorFill(BaseColor.WHITE);
cb.SetTextMatrix(x + 10, y - 40);
cb.ShowText(string.Format("{0:MMMM dd, yyyy}", DateTime.Now));
cb.EndText();
}
示例5: 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();
}