本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.ClosePathStroke方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.ClosePathStroke方法的具體用法?C# PdfContentByte.ClosePathStroke怎麽用?C# PdfContentByte.ClosePathStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfContentByte
的用法示例。
在下文中一共展示了PdfContentByte.ClosePathStroke方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawTimeTable
// ---------------------------------------------------------------------------
/**
* Draws the time table for a day at the film festival.
* @param directcontent a canvas to which the time table has to be drawn.
*/
protected void DrawTimeTable(PdfContentByte directcontent)
{
directcontent.SaveState();
directcontent.SetLineWidth(1.2f);
float llx, lly, urx, ury;
llx = OFFSET_LEFT;
lly = OFFSET_BOTTOM;
urx = OFFSET_LEFT + WIDTH;
ury = OFFSET_BOTTOM + HEIGHT;
directcontent.MoveTo(llx, lly);
directcontent.LineTo(urx, lly);
directcontent.LineTo(urx, ury);
directcontent.LineTo(llx, ury);
directcontent.ClosePath();
directcontent.Stroke();
llx = OFFSET_LOCATION;
lly = OFFSET_BOTTOM;
urx = OFFSET_LOCATION + WIDTH_LOCATION;
ury = OFFSET_BOTTOM + HEIGHT;
directcontent.MoveTo(llx, lly);
directcontent.LineTo(urx, lly);
directcontent.LineTo(urx, ury);
directcontent.LineTo(llx, ury);
directcontent.ClosePathStroke();
directcontent.SetLineWidth(1);
directcontent.MoveTo(
OFFSET_LOCATION + WIDTH_LOCATION / 2, OFFSET_BOTTOM
);
directcontent.LineTo(
OFFSET_LOCATION + WIDTH_LOCATION / 2, OFFSET_BOTTOM + HEIGHT
);
float y;
for (int i = 1; i < LOCATIONS; i++)
{
y = OFFSET_BOTTOM + (i * HEIGHT_LOCATION);
if (i == 2 || i == 6)
{
directcontent.MoveTo(OFFSET_LOCATION, y);
directcontent.LineTo(OFFSET_LOCATION + WIDTH_LOCATION, y);
}
else
{
directcontent.MoveTo(OFFSET_LOCATION + WIDTH_LOCATION / 2, y);
directcontent.LineTo(OFFSET_LOCATION + WIDTH_LOCATION, y);
}
directcontent.MoveTo(OFFSET_LEFT, y);
directcontent.LineTo(OFFSET_LEFT + WIDTH, y);
}
directcontent.Stroke();
directcontent.RestoreState();
}
示例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();
}
}
示例3: 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();
}