本文整理匯總了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();
}
示例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: FinishShape
protected static void FinishShape (PdfContentByte contentByte)
{
contentByte.FillStroke();
contentByte.ResetRGBColorFill();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}