本文整理匯總了C#中PdfSharp.Drawing.XGraphicsPath類的典型用法代碼示例。如果您正苦於以下問題:C# XGraphicsPath類的具體用法?C# XGraphicsPath怎麽用?C# XGraphicsPath使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
XGraphicsPath類屬於PdfSharp.Drawing命名空間,在下文中一共展示了XGraphicsPath類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RenderOpenPath
void RenderOpenPath(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.Navy, Math.PI);
pen.DashStyle = XDashStyle.Dash;
XGraphicsPath path = new XGraphicsPath();
path.AddLine(10, 120, 50, 60);
path.AddArc(50, 20, 110, 80, 180, 180);
path.AddLine(160, 60, 220, 100);
gfx.DrawPath(pen, path);
}
示例2: RenderPage
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
#if true__
XPen pen = new XPen(XColors.DarkGreen, 20);
gfx.DrawLine(pen, 0, 0, 1000, 1000);
#endif
XGraphicsPath path = new XGraphicsPath();
path.AddString("@", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 500, new XPoint(90, 60), XStringFormats.Default);
gfx.DrawPath(properties.Pen2.Pen, properties.Brush2.Brush, path);
}
示例3: DrawPathOpen
/// <summary>
/// Strokes an open path.
/// </summary>
void DrawPathOpen(XGraphics gfx, int number)
{
BeginBox(gfx, number, "DrawPath (open)");
XPen pen = new XPen(XColors.Navy, Math.PI);
pen.DashStyle = XDashStyle.Dash;
XGraphicsPath path = new XGraphicsPath();
path.AddLine(10, 120, 50, 60);
path.AddArc(50, 20, 110, 80, 180, 180);
path.AddLine(160, 60, 220, 100);
gfx.DrawPath(pen, path);
EndBox(gfx);
}
示例4: RenderAlternatePath
void RenderAlternatePath(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XPen pen = new XPen(XColors.Navy, 2.5);
// Alternate fill mode
XGraphicsPath path = new XGraphicsPath();
path.FillMode = XFillMode.Alternate;
path.AddLine(10, 130, 10, 40);
path.AddBeziers(new XPoint[]{new XPoint(10, 40), new XPoint(30, 0), new XPoint(40, 20), new XPoint(60, 40),
new XPoint(80, 60), new XPoint(100, 60), new XPoint(120, 40)});
path.AddLine(120, 40, 120, 130);
path.CloseFigure();
path.AddEllipse(40, 80, 50, 40);
gfx.DrawPath(pen, XBrushes.DarkOrange, path);
}
示例5: RenderPage
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
XGraphicsPath path = new XGraphicsPath();
path.AddLine(50, 150, 50, 100);
path.AddArc(50, 50, 100, 100, -180, 180);
path.AddLine(150, 70, 200, 70);
path.AddLine(200, 70, 200, 150);
path.CloseFigure();
XPen pen = new XPen(XColors.Red, 50);
path.Widen(pen, new XMatrix(), 3);
path.FillMode = this.properties.General.FillMode;
gfx.DrawPath(properties.Pen2.Pen, properties.Brush2.Brush, path);
}
示例6: RenderPage
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
DrawGridlines(gfx);
// Create a new graphical path
XGraphicsPath path = new XGraphicsPath();
XSize size = new XSize(90, 140);
double rotationAngle = 130;
path.AddArc(new XPoint(100, 100), new XPoint(200, 200), size, rotationAngle, false, System.Windows.Media.SweepDirection.Clockwise);
path.StartFigure();
path.AddArc(new XPoint(400, 100), new XPoint(500, 200), size, rotationAngle, false, System.Windows.Media.SweepDirection.Counterclockwise);
path.StartFigure();
path.AddArc(new XPoint(100, 300), new XPoint(200, 400), size, rotationAngle, true, System.Windows.Media.SweepDirection.Clockwise);
path.StartFigure();
path.AddArc(new XPoint(400, 300), new XPoint(500, 400), size, rotationAngle, true, System.Windows.Media.SweepDirection.Counterclockwise);
path.StartFigure();
#if DEBUG_
gfx.WriteComment("PathArcSegment");
#endif
gfx.DrawPath(XPens.Red, path);
}
示例7: RenderGlyphsPath
void RenderGlyphsPath(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XGraphicsPath path = new XGraphicsPath();
//path.AddString("Hello!", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 100, new XRect(0, 0, 250, 140),
// XStringFormat.Center);
path.AddString("Hello!", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 100, new XRect(0, 0, 250, 140), XStringFormats.Center);
gfx.DrawPath(new XPen(XColors.Purple, 2.3), XBrushes.DarkOrchid, path);
}
示例8: RenderPage
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
XGraphicsPath path = new XGraphicsPath();
path.AddLine(50, 150, 50, 100);
path.AddArc(50, 50, 100, 100, -180, 180);
path.AddLine(150, 70, 200, 70);
path.AddLine(200, 70, 200, 150);
path.CloseFigure();
path.Flatten(XMatrix.Identity, 0.1);
gfx.DrawPath(properties.Pen2.Pen, properties.Brush2.Brush, path);
}
示例9: RenderClipPath
void RenderClipPath(XGraphics gfx)
{
gfx.TranslateTransform(15, 20);
XGraphicsPath path = new XGraphicsPath();
path.AddString("Clip!", new XFontFamily("Verdana"), XFontStyle.Bold, 90, new XRect(0, 0, 250, 140),
XStringFormats.Center);
gfx.IntersectClip(path);
gfx.DrawRectangle(XBrushes.LightSalmon, new XRect(0, 0, 10000, 10000));
// Draw a beam of dotted lines
XPen pen = XPens.DarkRed.Clone();
pen.DashStyle = XDashStyle.Dot;
for (double r = 0; r <= 90; r += 0.5)
gfx.DrawLine(pen, 0, 0, 1000 * Math.Cos(r / 90 * Math.PI), 1000 * Math.Sin(r / 90 * Math.PI));
}
示例10: RenderWindingPath
void RenderWindingPath(XGraphics gfx)
{
gfx.TranslateTransform(15, 150);
XPen pen = new XPen(XColors.Navy, 2.5);
// Winding fill mode
XGraphicsPath path = new XGraphicsPath();
path = new XGraphicsPath();
path.FillMode = XFillMode.Winding;
path.AddLine(130, 130, 130, 40);
path.AddBeziers(new XPoint[]{new XPoint(130, 40), new XPoint(150, 0), new XPoint(160, 20), new XPoint(180, 40),
new XPoint(200, 60), new XPoint(220, 60), new XPoint(240, 40)});
path.AddLine(240, 40, 240, 130);
path.CloseFigure();
path.AddEllipse(160, 80, 50, 40);
gfx.DrawPath(pen, XBrushes.DarkOrange, path);
}
示例11: AddLine
public static void AddLine(XGraphicsPath path, LineSegment segment, Random random, bool straightEdges)
{
if (Settings.HandDrawn && !straightEdges)
{
var dx = segment.End.X - segment.Start.X;
var dy = segment.End.Y - segment.Start.Y;
var distance = (float) Math.Sqrt(dx*dx + dy*dy);
var points = random.Next(Math.Max(3, (int) (distance/15)), Math.Max(6, (int) (distance/8)));
var lines = points - 1;
var last = segment.Start;
for (var line = 0; line < lines; ++line)
{
Vector next;
if (line == 0)
{
next = last;
}
else if (line == lines - 1)
{
next = segment.End;
}
else
{
var fraction = line/(float) (lines - 1);
var x = segment.Start.X + (segment.End.X - segment.Start.X)*fraction;
var y = segment.Start.Y + (segment.End.Y - segment.Start.Y)*fraction;
x += random.Next(-1, 2);
y += random.Next(-1, 2);
next = new Vector(x, y);
}
path.AddLine(last.ToPointF(), next.ToPointF());
last = next;
}
}
else
{
path.AddLine(segment.Start.ToPointF(), segment.End.ToPointF());
}
}
示例12: RenderPage
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
// Create a new graphical path
XGraphicsPath path = new XGraphicsPath();
// Add the outline of the glyphs of the word 'Clip' to the path
path.AddString("Clip!", new XFontFamily("Times New Roman"), XFontStyle.BoldItalic, 250, new XPoint(30, 100), XStringFormats.Default);
#if DEBUG_
gfx.WriteComment("SetClip");
#endif
// Set the path as clip path
gfx.IntersectClip(path);
#if DEBUG_
gfx.WriteComment("Random lines");
#endif
// Draw some random lines to show that clipping happens
Random rnd = new Random(42);
for (int idx = 0; idx < 300; idx++)
gfx.DrawLine(properties.Pen2.Pen, rnd.Next(600), rnd.Next(500), rnd.Next(600), rnd.Next(500));
}
示例13: Render
internal void Render(XUnit x, XUnit y, XUnit width, XUnit height, RoundedCorner roundedCorner)
{
// If there is no rounded corner, we can use the usual Render method.
if (roundedCorner == RoundedCorner.None)
{
Render(x, y, width, height);
return;
}
if (_shading == null || _brush == null)
return;
XGraphicsPath path = new XGraphicsPath();
switch (roundedCorner)
{
case RoundedCorner.TopLeft:
path.AddArc(new XRect(x, y, width * 2, height * 2), 180, 90); // Error in CORE: _corePath.AddArc().
path.AddLine(new XPoint(x + width, y), new XPoint(x + width, y + height));
break;
case RoundedCorner.TopRight:
path.AddArc(new XRect(x - width, y, width * 2, height * 2), 270, 90); // Error in CORE: _corePath.AddArc().
path.AddLine(new XPoint(x + width, y + height), new XPoint(x, y + height));
break;
case RoundedCorner.BottomRight:
path.AddArc(new XRect(x - width, y - height, width * 2, height * 2), 0, 90); // Error in CORE: _corePath.AddArc().
path.AddLine(new XPoint(x, y + height), new XPoint(x, y));
break;
case RoundedCorner.BottomLeft:
path.AddArc(new XRect(x, y - height, width * 2, height * 2), 90, 90); // Error in CORE: _corePath.AddArc().
path.AddLine(new XPoint(x, y), new XPoint(x + width, y));
break;
}
path.CloseFigure();
_gfx.DrawPath(_brush, path);
}
示例14: IntersectClip
/// <summary>
/// Updates the clip region of this XGraphics to the intersection of the
/// current clip region and the specified rectangle.
/// </summary>
public void IntersectClip(XRect rect)
{
XGraphicsPath path = new XGraphicsPath();
path.AddRectangle(rect);
IntersectClip(path);
}
示例15: SetClip
public void SetClip(XGraphicsPath path, XCombineMode combineMode)
{
throw new InvalidOperationException("Function is obsolete. Use IntersectClip.");
// if (path == null)
// throw new ArgumentNullException("path");
// if (combineMode != XCombineMode.Replace && combineMode != XCombineMode.Intersect)
// throw new ArgumentException("Only XCombineMode.Replace and XCombineMode.Intersect are currently supported by PDFsharp.", "combineMode");
// if (this.drawGraphics)
// {
//#if GDI
// if (this.targetContext == XGraphicTargetContext.GDI)
// this.gfx.SetClip(path.gdipPath, (CombineMode)combineMode);
//#endif
//#if WPF
// if (this.targetContext == XGraphicTargetContext.GDI)
// GetType();
// //this.gfx.Transform = (Matrix)this.defaultViewMatrix;
//#endif
// }
//if (this.renderer != null)
// this.renderer.SetClip(path, combineMode);
}