本文整理汇总了C#中PdfSharp.Drawing.XGraphics.DrawPath方法的典型用法代码示例。如果您正苦于以下问题:C# XGraphics.DrawPath方法的具体用法?C# XGraphics.DrawPath怎么用?C# XGraphics.DrawPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PdfSharp.Drawing.XGraphics
的用法示例。
在下文中一共展示了XGraphics.DrawPath方法的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: DrawPathAlternateAndWinding
/// <summary>
/// Draws an alternating and a winding path.
/// </summary>
void DrawPathAlternateAndWinding(XGraphics gfx, int number)
{
BeginBox(gfx, number, "DrawPath (alternate / winding)");
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);
// Winding fill mode
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);
EndBox(gfx);
}
示例10: DrawGlyphs
/// <summary>
/// Converts text to path.
/// </summary>
void DrawGlyphs(XGraphics gfx, int number)
{
BeginBox(gfx, number, "Draw Glyphs");
XGraphicsPath path = new XGraphicsPath();
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);
EndBox(gfx);
}
示例11: DrawText
static void DrawText(XGraphics gfx, XPen pen, XBrush brush)
{
XSize size = gfx.PageSize;
XGraphicsPath path = new XGraphicsPath();
path.AddString("PDFsharp",
new XFontFamily("Verdana"), XFontStyle.BoldItalic, 60,
new XRect(0, size.Height / 3.5, size.Width, 0), XStringFormats.Center);
gfx.DrawPath(new XPen(pen.Color, 3), brush, path);
}
示例12: Draw
public override void Draw(XGraphics graphics, Palette palette, DrawingContext context)
{
Random random = new Random(Name.GetHashCode());
var topLeft = InnerBounds.GetCorner(CompassPoint.NorthWest);
var topRight = InnerBounds.GetCorner(CompassPoint.NorthEast);
var bottomLeft = InnerBounds.GetCorner(CompassPoint.SouthWest);
var bottomRight = InnerBounds.GetCorner(CompassPoint.SouthEast);
var top = new LineSegment(topLeft, topRight);
var right = new LineSegment(topRight, bottomRight);
var bottom = new LineSegment(bottomRight, bottomLeft);
var left = new LineSegment(bottomLeft, topLeft);
context.LinesDrawn.Add(top);
context.LinesDrawn.Add(right);
context.LinesDrawn.Add(bottom);
context.LinesDrawn.Add(left);
var brush = context.Selected ? palette.BorderBrush : palette.FillBrush;
if (!Settings.DebugDisableLineRendering)
{
var path = palette.Path();
Drawing.AddLine(path, top, random);
Drawing.AddLine(path, right, random);
Drawing.AddLine(path, bottom, random);
Drawing.AddLine(path, left, random);
graphics.DrawPath(brush, path);
if (IsDark)
{
var state = graphics.Save();
graphics.IntersectClip(path);
brush = context.Selected ? palette.FillBrush : palette.BorderBrush;
graphics.DrawPolygon(brush, new PointF[] { topRight.ToPointF(), new PointF(topRight.X - Settings.DarknessStripeSize, topRight.Y), new PointF(topRight.X, topRight.Y + Settings.DarknessStripeSize) }, XFillMode.Alternate);
graphics.Restore(state);
}
graphics.DrawPath(palette.BorderPen, path);
}
var font = Settings.LargeFont;
brush = context.Selected ? palette.FillBrush : palette.LargeTextBrush;
Rect textBounds = InnerBounds;
textBounds.Inflate(-5, -5);
if (textBounds.Width > 0 && textBounds.Height > 0)
{
m_name.Draw(graphics, font, brush, textBounds.Position, textBounds.Size, XStringFormats.Center);
}
var expandedBounds = InnerBounds;
expandedBounds.Inflate(Settings.ObjectListOffsetFromRoom, Settings.ObjectListOffsetFromRoom);
var drawnObjectList = false;
font = Settings.SmallFont;
brush = palette.SmallTextBrush;
if (!string.IsNullOrEmpty(Objects))
{
XStringFormat format = new XStringFormat();
Vector pos = expandedBounds.GetCorner(m_objectsPosition);
if (!Drawing.SetAlignmentFromCardinalOrOrdinalDirection(format, m_objectsPosition))
{
// object list appears inside the room below its name
format.LineAlignment = XLineAlignment.Far;
format.Alignment = XStringAlignment.Near;
//format.Trimming = StringTrimming.EllipsisCharacter;
//format.FormatFlags = StringFormatFlags.LineLimit;
var height = InnerBounds.Height / 2 - font.Height / 2;
var bounds = new Rect(InnerBounds.Left + Settings.ObjectListOffsetFromRoom, InnerBounds.Bottom - height, InnerBounds.Width - Settings.ObjectListOffsetFromRoom, height - Settings.ObjectListOffsetFromRoom);
brush = context.Selected ? palette.FillBrush : brush;
if (bounds.Width > 0 && bounds.Height > 0)
{
m_objects.Draw(graphics, font, brush, bounds.Position, bounds.Size, format);
}
drawnObjectList = true;
}
else if (m_objectsPosition == CompassPoint.North || m_objectsPosition == CompassPoint.South)
{
pos.X += Settings.ObjectListOffsetFromRoom;
}
if (!drawnObjectList)
{
m_objects.Draw(graphics, font, brush, pos, Vector.Zero, format);
}
}
}
示例13: DrawLineCurveInternal
private static void DrawLineCurveInternal(XGraphics gfx, XPen pen, bool isStroked, ref XPoint pt1, ref XPoint pt2, double curvature, Core2D.Style.CurveOrientation orientation, Core2D.Shape.PointAlignment pt1a, Core2D.Shape.PointAlignment pt2a)
{
if (isStroked)
{
var path = new XGraphicsPath();
double p1x = pt1.X;
double p1y = pt1.Y;
double p2x = pt2.X;
double p2y = pt2.Y;
Core2D.Shapes.XLineExtensions.GetCurvedLineBezierControlPoints(orientation, curvature, pt1a, pt2a, ref p1x, ref p1y, ref p2x, ref p2y);
path.AddBezier(
pt1.X, pt1.Y,
p1x, p1y,
p2x, p2y,
pt2.X, pt2.Y);
gfx.DrawPath(pen, path);
}
}
示例14: DrawChevron
public static void DrawChevron(XGraphics graphics, PointF pos, float angle, float size, Brush fillBrush)
{
if (m_chevronPath == null)
{
var apex = new PointF(0.5f, 0);
var leftCorner = new PointF(-0.5f, 0.5f);
var rightCorner = new PointF(-0.5f, -0.5f);
m_chevronPath = new XGraphicsPath();
m_chevronPath.AddLine(apex, rightCorner);
m_chevronPath.AddLine(rightCorner, leftCorner);
m_chevronPath.AddLine(leftCorner, apex);
}
var state = graphics.Save();
graphics.TranslateTransform(pos.X, pos.Y);
graphics.RotateTransform(angle);
graphics.ScaleTransform(size, size);
graphics.DrawPath(fillBrush, m_chevronPath);
graphics.Restore(state);
}
示例15: Draw
public void Draw(XGraphics graphics, RectangleF rect, MapOptions options, XPen pen)
{
if (graphics == null)
throw new ArgumentNullException("graphics");
RectangleF bounds = TransformedBounds;
//graphics.DrawRectangle( new XPen(XColors.Yellow, 1), bounds.X, bounds.Y, bounds.Width, bounds.Height );
if (bounds.IntersectsWith(rect))
{
XGraphicsPath path = Path;
using (RenderUtil.SaveState(graphics))
{
XMatrix matrix = new XMatrix();
matrix.ScalePrepend(ScaleX, ScaleY);
matrix.TranslatePrepend(-OriginX, -OriginY);
graphics.MultiplyTransform(matrix, XMatrixOrder.Prepend);
graphics.DrawPath(pen, path);
}
}
}