本文整理汇总了C#中XFillMode类的典型用法代码示例。如果您正苦于以下问题:C# XFillMode类的具体用法?C# XFillMode怎么用?C# XFillMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XFillMode类属于命名空间,在下文中一共展示了XFillMode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XGraphicsPath
/// <summary>
/// Initializes a new instance of the <see cref="XGraphicsPath"/> class.
/// </summary>
public XGraphicsPath(PointF[] points, byte[] types, XFillMode fillMode)
{
#if GDI
this.gdipPath = new GraphicsPath(points, types, (FillMode)fillMode);
#endif
#if WPF
this.pathGeometry = new PathGeometry();
this.pathGeometry.FillRule = FillRule.EvenOdd;
#endif
}
示例2: XGraphicsPath
/// <summary>
/// Initializes a new instance of the <see cref="XGraphicsPath"/> class.
/// </summary>
public XGraphicsPath(PointF[] points, byte[] types, XFillMode fillMode)
{
#if GDI
try
{
Lock.EnterGdiPlus();
_gdipPath = new GraphicsPath(points, types, (FillMode)fillMode);
}
finally { Lock.ExitGdiPlus(); }
#endif
#if WPF // Is true only in Hybrid build.
_pathGeometry = new PathGeometry();
_pathGeometry.FillRule = FillRule.EvenOdd;
#endif
}
示例3: CreatePolygonGeometry
/// <summary>
/// Creates a path geometry form a polygon.
/// </summary>
public static PathGeometry CreatePolygonGeometry(System.Windows.Point[] points, XFillMode fillMode, bool closed)
{
PolyLineSegment seg = new PolyLineSegment();
int count = points.Length;
// For correct drawing the start point of the segment must not be the same as the first point
for (int idx = 1; idx < count; idx++)
seg.Points.Add(new System.Windows.Point(points[idx].X, points[idx].Y));
seg.IsStroked = true;
PathFigure fig = new PathFigure();
fig.StartPoint = new System.Windows.Point(points[0].X, points[0].Y);
fig.Segments.Add(seg);
fig.IsClosed = closed;
PathGeometry geo = new PathGeometry();
geo.FillRule = fillMode == XFillMode.Winding ? FillRule.Nonzero : FillRule.EvenOdd;
geo.Figures.Add(fig);
return geo;
}
示例4: DrawPolygon
/// <summary>
/// Draws a polygon defined by an array of points.
/// </summary>
public void DrawPolygon(XBrush brush, XPoint[] points, XFillMode fillmode)
{
if (brush == null)
throw new ArgumentNullException("brush");
if (points == null)
throw new ArgumentNullException("points");
if (points.Length < 2)
throw new ArgumentException("points", PSSR.PointArrayAtLeast(2));
if (this.drawGraphics)
{
#if GDI
if (this.targetContext == XGraphicTargetContext.GDI)
this.gfx.FillPolygon(brush.RealizeGdiBrush(), MakePointFArray(points), (FillMode)fillmode);
#endif
#if WPF
if (this.targetContext == XGraphicTargetContext.WPF)
{
this.dc.DrawGeometry(brush.RealizeWpfBrush(), null, GeometryHelper.CreatePolygonGeometry(MakePointArray(points), fillmode, true));
}
#endif
}
if (this.renderer != null)
this.renderer.DrawPolygon(null, brush, points, fillmode);
}
示例5: DrawClosedCurve
/// <summary>
/// Draws a closed cardinal spline defined by an array of points.
/// </summary>
public void DrawClosedCurve(XPen pen, XBrush brush, PointF[] points, XFillMode fillmode, double tension)
{
DrawClosedCurve(pen, brush, MakeXPointArray(points), fillmode, tension);
}
示例6: XGraphicsPath
/// <summary>
/// Initializes a new instance of the <see cref="XGraphicsPath"/> class.
/// </summary>
public XGraphicsPath(PointF[] points, byte[] types, XFillMode fillMode)
{
this.gdipPath = new GraphicsPath(points, types, (FillMode)fillMode);
}
示例7: DrawClosedCurve
/// <summary>
/// Draws a closed cardinal spline defined by an array of points.
/// </summary>
public void DrawClosedCurve(XPen pen, XBrush brush, XPoint[] points, XFillMode fillmode, double tension)
{
if (pen == null && brush == null)
throw new ArgumentNullException("pen and brush", PSSR.NeedPenOrBrush);
if (this.drawGraphics)
{
this.gfx.FillClosedCurve(brush.RealizeGdiBrush(), MakePointFArray(points), (FillMode)fillmode, (float)tension);
// The fillmode is not used by DrawClosedCurve
this.gfx.DrawClosedCurve(pen.RealizeGdiPen(), MakePointFArray(points), (float)tension, (FillMode)fillmode);
}
if (this.renderer != null)
this.renderer.DrawClosedCurve(pen, brush, points, tension, fillmode);
}
示例8: DrawPolygon
/// <summary>
/// Draws a polygon defined by an array of points.
/// </summary>
public void DrawPolygon(XPen pen, XBrush brush, XPoint[] points, XFillMode fillmode)
{
if (pen == null && brush == null)
throw new ArgumentNullException("pen and brush", PSSR.NeedPenOrBrush);
if (points == null)
throw new ArgumentNullException("points");
if (points.Length < 2)
throw new ArgumentException("points", PSSR.PointArrayAtLeast(2));
if (this.drawGraphics)
{
PointF[] pts = MakePointFArray(points);
this.gfx.FillPolygon(brush.RealizeGdiBrush(), pts, (FillMode)fillmode);
this.gfx.DrawPolygon(pen.RealizeGdiPen(), pts);
}
if (this.renderer != null)
this.renderer.DrawPolygon(pen, brush, points, fillmode);
}
示例9: DrawPolygon
// ----- DrawPolygon --------------------------------------------------------------------------
public void DrawPolygon(XPen pen, XBrush brush, XPoint[] points, XFillMode fillmode)
{
Realize(pen, brush);
int count = points.Length;
if (points.Length < 2)
throw new ArgumentException("points", PSSR.PointArrayAtLeast(2));
const string format = Config.SignificantFigures4;
AppendFormatPoint("{0:" + format + "} {1:" + format + "} m\n", points[0].X, points[0].Y);
for (int idx = 1; idx < count; idx++)
AppendFormatPoint("{0:" + format + "} {1:" + format + "} l\n", points[idx].X, points[idx].Y);
AppendStrokeFill(pen, brush, fillmode, true);
}
示例10: AppendStrokeFill
void AppendStrokeFill(XPen pen, XBrush brush, XFillMode fillMode, bool closePath)
{
if (closePath)
this.content.Append("h ");
if (fillMode == XFillMode.Winding)
{
if (pen != null && brush != null)
this.content.Append("B\n");
else if (pen != null)
this.content.Append("S\n");
else
this.content.Append("f\n");
}
else
{
if (pen != null && brush != null)
this.content.Append("B*\n");
else if (pen != null)
this.content.Append("S\n");
else
this.content.Append("f*\n");
}
}
示例11: DrawPolygon
// ----- DrawPolygon --------------------------------------------------------------------------
public void DrawPolygon(XPen pen, XBrush brush, XPoint[] points, XFillMode fillmode)
{
Realize(pen, brush);
int count = points.Length;
if (points.Length < 2)
throw new ArgumentException("points", PSSR.PointArrayAtLeast(2));
AppendFormat("{0:0.####} {1:0.####} m\n", points[0].X, points[0].Y);
for (int idx = 1; idx < count; idx++)
AppendFormat("{0:0.####} {1:0.####} l\n", points[idx].X, points[idx].Y);
AppendStrokeFill(pen, brush, fillmode, true);
}
示例12: DrawClosedCurve
// ----- DrawClosedCurve ----------------------------------------------------------------------
public void DrawClosedCurve(XPen pen, XBrush brush, XPoint[] points, double tension, XFillMode fillmode)
{
int count = points.Length;
if (count == 0)
return;
if (count < 2)
throw new ArgumentException("Not enough points", "points");
// Simply tried out. Not proofed why it is correct.
tension /= 3;
Realize(pen, brush);
AppendFormat("{0:0.####} {1:0.####} m\n", points[0].X, points[0].Y);
if (count == 2)
{
// Just draws a line...
AppendCurveSegment(points[0], points[0], points[1], points[1], tension);
}
else
{
AppendCurveSegment(points[count - 1], points[0], points[1], points[2], tension);
for (int idx = 1; idx < count - 2; idx++)
AppendCurveSegment(points[idx - 1], points[idx], points[idx + 1], points[idx + 2], tension);
AppendCurveSegment(points[count - 3], points[count - 2], points[count - 1], points[0], tension);
AppendCurveSegment(points[count - 2], points[count - 1], points[0], points[1], tension);
}
AppendStrokeFill(pen, brush, fillmode, true);
}
示例13: CreatePolyLineSegment
/// <summary>
/// Creates a path geometry from a polygon.
/// </summary>
public static PolyLineSegment CreatePolyLineSegment(SysPoint[] points, XFillMode fillMode, bool closed)
{
PolyLineSegment seg = new PolyLineSegment();
int count = points.Length;
// For correct drawing the start point of the segment must not be the same as the first point.
for (int idx = 1; idx < count; idx++)
seg.Points.Add(new SysPoint(points[idx].X, points[idx].Y));
#if !SILVERLIGHT && !NETFX_CORE
seg.IsStroked = true;
#endif
return seg;
}