当前位置: 首页>>代码示例>>C#>>正文


C# OxyPenLineJoin类代码示例

本文整理汇总了C#中OxyPenLineJoin的典型用法代码示例。如果您正苦于以下问题:C# OxyPenLineJoin类的具体用法?C# OxyPenLineJoin怎么用?C# OxyPenLineJoin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OxyPenLineJoin类属于命名空间,在下文中一共展示了OxyPenLineJoin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawLine

        public void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray,
                             OxyPenLineJoin lineJoin, bool aliased)
        {
            var e = new Polyline();
            if (stroke != null && thickness > 0)
            {
                e.Stroke = GetCachedBrush(stroke);

                switch (lineJoin)
                {
                    case OxyPenLineJoin.Round:
                        e.StrokeLineJoin = PenLineJoin.Round;
                        break;
                    case OxyPenLineJoin.Bevel:
                        e.StrokeLineJoin = PenLineJoin.Bevel;
                        break;
                    //  The default StrokeLineJoin is Miter
                }

                if (thickness != 1) // default values is 1
                    e.StrokeThickness = thickness;
                if (dashArray != null)
                    e.StrokeDashArray = new DoubleCollection(dashArray);
            }
            // pl.Fill = null;
            if (aliased)
                e.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);

            var pc = new PointCollection(points.Count);
            foreach (var p in points)
                pc.Add(ToPoint(p));
            e.Points = pc;

            Add(e);
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:35,代码来源:GeometryRenderContext.cs

示例2: DrawLine

 /// <summary>
 /// Draws a polyline.
 /// </summary>
 /// <param name="points">The points.</param>
 /// <param name="stroke">The stroke color.</param>
 /// <param name="thickness">The stroke thickness.</param>
 /// <param name="dashArray">The dash array.</param>
 /// <param name="lineJoin">The line join type.</param>
 /// <param name="aliased">if set to <c>true</c> the shape will be aliased.</param>
 public abstract void DrawLine(
     IList<ScreenPoint> points,
     OxyColor stroke,
     double thickness,
     double[] dashArray,
     OxyPenLineJoin lineJoin,
     bool aliased);
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:16,代码来源:RenderContextBase.cs

示例3: DrawLine

 /// <summary>
 /// Draws a polyline.
 /// </summary>
 /// <param name="points">The points.</param>
 /// <param name="stroke">The stroke color.</param>
 /// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param>
 /// <param name="dashArray">The dash array (in device independent units, 1/96 inch). Use <c>null</c> to get a solid line.</param>
 /// <param name="lineJoin">The line join type.</param>
 /// <param name="aliased">if set to <c>true</c> the shape will be aliased.</param>
 public void DrawLine(
     IList<ScreenPoint> points,
     OxyColor stroke,
     double thickness = 1,
     double[] dashArray = null,
     OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter,
     bool aliased = false)
 {
 }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:18,代码来源:EmptyRenderContext.cs

示例4: OxyPen

 /// <summary>
 /// Initializes a new instance of the <see cref="OxyPen"/> class.
 /// </summary>
 /// <param name="color">
 /// The color.
 /// </param>
 /// <param name="thickness">
 /// The thickness.
 /// </param>
 /// <param name="lineStyle">
 /// The line style.
 /// </param>
 /// <param name="lineJoin">
 /// The line join.
 /// </param>
 public OxyPen(
     OxyColor color,
     double thickness = 1.0,
     LineStyle lineStyle = LineStyle.Solid,
     OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter)
 {
     this.Color = color;
     this.Thickness = thickness;
     this.DashArray = LineStyleHelper.GetDashArray(lineStyle);
     this.LineStyle = lineStyle;
     this.LineJoin = lineJoin;
 }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:27,代码来源:OxyPen.cs

示例5: DrawLines

 public void DrawLines(IEnumerable<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray,
                      OxyPenLineJoin lineJoin, bool aliased)
 {
     var startPoint = new ScreenPoint();
     bool first = true;
     foreach (var p in points)
     {
         if (!first)
         {
             Add(new Line { X1 = startPoint.X, Y1 = startPoint.Y, X2 = p.X, Y2 = p.Y });
         }
         else
         {
             startPoint = p;
         }
         first = !first;
     }
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:18,代码来源:GeometryRenderContext.cs

示例6: DrawLine

        public void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray,
                             OxyPenLineJoin lineJoin, bool aliased)
        {
            var pen = CreatePen(stroke, thickness, dashArray, lineJoin);

            // todo: alias line
            //            if (aliased)
            //              .SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);

            var lp = new Point();
            int i = 0;
            foreach (var point in points)
            {
                var p = point.ToPoint();
                if (i > 0)
                {
                    dc.DrawLine(pen, lp, p);
                }
                i++;
                lp = p;
            }
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:22,代码来源:DrawingRenderContext.cs

示例7: CreatePen

 private static Pen CreatePen(OxyColor stroke, double thickness, double[] dashArray,
                              OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter)
 {
     if (stroke == null)
         return null;
     var pen = new Pen(stroke.ToBrush(), thickness);
     if (dashArray != null)
     {
         pen.DashStyle = new DashStyle(dashArray, 0);
     }
     switch (lineJoin)
     {
         case OxyPenLineJoin.Round:
             pen.LineJoin = PenLineJoin.Round;
             break;
         case OxyPenLineJoin.Bevel:
             pen.LineJoin = PenLineJoin.Bevel;
             break;
             //  The default LineJoin is Miter
     }
     return pen;
 }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:22,代码来源:DrawingRenderContext.cs

示例8: DrawLine

        /// <summary>
        /// The draw line.
        /// </summary>
        /// <param name="points">
        /// The points.
        /// </param>
        /// <param name="stroke">
        /// The stroke.
        /// </param>
        /// <param name="thickness">
        /// The thickness.
        /// </param>
        /// <param name="dashArray">
        /// The dash array.
        /// </param>
        /// <param name="lineJoin">
        /// The line join.
        /// </param>
        /// <param name="aliased">
        /// The aliased.
        /// </param>
        public void DrawLine(
            IList<ScreenPoint> points,
            OxyColor stroke,
            double thickness,
            double[] dashArray,
            OxyPenLineJoin lineJoin,
            bool aliased)
        {
            var e = new Polyline();
            this.SetStroke(e, stroke, thickness, lineJoin, dashArray, aliased);

            var pc = new PointCollection();
            foreach (ScreenPoint p in points)
            {
                pc.Add(p.ToPoint(aliased));
            }

            e.Points = pc;

            this.Add(e);
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:42,代码来源:MetroRenderContext.cs

示例9: SetStroke

        /// <summary>
        /// Sets the stroke of the specified shape.
        /// </summary>
        /// <param name="shape">The shape.</param>
        /// <param name="stroke">The stroke.</param>
        /// <param name="thickness">The thickness.</param>
        /// <param name="lineJoin">The line join.</param>
        /// <param name="dashArray">The dash array.</param>
        /// <param name="aliased">aliased if set to <c>true</c>.</param>
        private void SetStroke(
            Shape shape,
            OxyColor stroke,
            double thickness,
            OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter,
            IEnumerable<double> dashArray = null,
            bool aliased = false)
        {
            if (stroke.IsVisible() && thickness > 0)
            {
                shape.Stroke = this.GetCachedBrush(stroke);

                switch (lineJoin)
                {
                    case OxyPenLineJoin.Round:
                        shape.StrokeLineJoin = PenLineJoin.Round;
                        break;
                    case OxyPenLineJoin.Bevel:
                        shape.StrokeLineJoin = PenLineJoin.Bevel;
                        break;

                    // The default StrokeLineJoin is Miter
                }

                shape.StrokeThickness = thickness;

                if (dashArray != null)
                {
                    shape.StrokeDashArray = CreateDashArrayCollection(dashArray);
                }

                if (aliased)
                {
                    // shape.UseLayoutRounding = aliased;
                }
            }
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:46,代码来源:SilverlightRenderContext.cs

示例10: DrawPolygon

        public void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness = 1, double[] dashArray = null, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter, bool aliased = false)
        {
            using (var paint = new Paint())
            {
                paint.AntiAlias = !aliased;
                paint.StrokeWidth = (float)thickness;
                using (var path = new Path())
                {
                    path.MoveTo((float)points[0].X, (float)points[0].Y);
                    for (int i = 1; i <= points.Count; i++)
                    {
                        path.LineTo((float)points[i % points.Count].X, (float)points[i % points.Count].Y);
                    }

                    if (fill != null)
                    {
                        paint.SetStyle(Paint.Style.Fill);
                        paint.Color = fill.ToColor();
                        canvas.DrawPath(path, paint);
                    }

                    if (stroke != null)
                    {
                        paint.SetStyle(Paint.Style.Stroke);
                        paint.Color = stroke.ToColor();
                        canvas.DrawPath(path, paint);
                    }
                }
            }
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:30,代码来源:CanvasRenderContext.cs

示例11: CreateStyle

        /// <summary>
        /// Creates a style.
        /// </summary>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The stroke thickness (in user units).</param>
        /// <param name="dashArray">The line dash array.</param>
        /// <param name="lineJoin">The line join type.</param>
        /// <returns>A style string.</returns>
        public string CreateStyle(
            OxyColor fill,
            OxyColor stroke,
            double thickness,
            double[] dashArray = null,
            OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter)
        {
            // http://oreilly.com/catalog/svgess/chapter/ch03.html
            var style = new StringBuilder();
            if (fill.IsInvisible())
            {
                style.AppendFormat("fill:none;");
            }
            else
            {
                style.AppendFormat("fill:{0};", this.ColorToString(fill));
                if (fill.A != 0xFF)
                {
                    style.AppendFormat(CultureInfo.InvariantCulture, "fill-opacity:{0};", fill.A / 255.0);
                }
            }

            if (stroke.IsInvisible())
            {
                style.AppendFormat("stroke:none;");
            }
            else
            {
                string formatString = "stroke:{0};stroke-width:{1:" + this.NumberFormat + "}";
                style.AppendFormat(CultureInfo.InvariantCulture, formatString, this.ColorToString(stroke), thickness);
                switch (lineJoin)
                {
                    case OxyPenLineJoin.Round:
                        style.AppendFormat(";stroke-linejoin:round");
                        break;
                    case OxyPenLineJoin.Bevel:
                        style.AppendFormat(";stroke-linejoin:bevel");
                        break;
                }

                if (stroke.A != 0xFF)
                {
                    style.AppendFormat(CultureInfo.InvariantCulture, ";stroke-opacity:{0}", stroke.A / 255.0);
                }

                if (dashArray != null && dashArray.Length > 0)
                {
                    style.Append(";stroke-dasharray:");
                    for (int i = 0; i < dashArray.Length; i++)
                    {
                        style.AppendFormat(
                            CultureInfo.InvariantCulture, "{0}{1}", i > 0 ? "," : string.Empty, dashArray[i]);
                    }
                }
            }

            return style.ToString();
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:67,代码来源:SvgWriter.cs

示例12: DrawPolygon

		public override void DrawPolygon (IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness, double[] dashArray, OxyPenLineJoin lineJoin, bool aliased)
		{
//			gctx.SetAllowsAntialiasing(aliased);

            if (fill != null)
			{
				ToColor(fill).SetFill();
				var path = new CGPath ();
	            path.AddLines(points.Select(p => ToPoint(p)).ToArray());
				path.CloseSubpath();
				gctx.AddPath(path);
	            gctx.DrawPath (CGPathDrawingMode.Fill);
			}

            if (stroke != null && thickness > 0)
			{
				SetAttributes (null, stroke, thickness);

				gctx.SetLineCap(ToLine(lineJoin));

	            var path = new CGPath ();


	            path.AddLines(points.Select(p => ToPoint(p)).ToArray());
				path.CloseSubpath();
				gctx.AddPath(path);
	            gctx.DrawPath (CGPathDrawingMode.Stroke);
			}
		}
开发者ID:acremean,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:29,代码来源:MonoTouchRenderContext.cs

示例13: DrawLine

		public override void DrawLine (IList<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray, OxyPenLineJoin lineJoin, bool aliased)
		{
			if (stroke == null || thickness <= 0)
            {
                return;
            }

//			gctx.SetAllowsAntialiasing(aliased);

			gctx.SetLineCap(ToLine(lineJoin));

			SetAttributes (null, stroke, thickness);

            var path = new CGPath ();

            path.AddLines(points.Select(p => ToPoint(p)).ToArray());


            gctx.AddPath (path);
            gctx.DrawPath (CGPathDrawingMode.Stroke);
		}
开发者ID:acremean,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:21,代码来源:MonoTouchRenderContext.cs

示例14: DrawPolygons

        /// <summary>
        /// The draw polygons.
        /// </summary>
        /// <param name="polygons">
        /// The polygons.
        /// </param>
        /// <param name="fill">
        /// The fill.
        /// </param>
        /// <param name="stroke">
        /// The stroke.
        /// </param>
        /// <param name="thickness">
        /// The thickness.
        /// </param>
        /// <param name="dashArray">
        /// The dash array.
        /// </param>
        /// <param name="lineJoin">
        /// The line join.
        /// </param>
        /// <param name="aliased">
        /// The aliased.
        /// </param>
        public void DrawPolygons(
            IList<IList<ScreenPoint>> polygons,
            OxyColor fill,
            OxyColor stroke,
            double thickness,
            double[] dashArray,
            OxyPenLineJoin lineJoin,
            bool aliased)
        {
            var path = new Path();
            this.SetStroke(path, stroke, thickness, lineJoin, dashArray, aliased);
            if (fill != null)
            {
                path.Fill = this.GetCachedBrush(fill);
            }

            var pg = new PathGeometry { FillRule = FillRule.Nonzero };
            foreach (var polygon in polygons)
            {
                var figure = new PathFigure { IsClosed = true };
                bool first = true;
                foreach (ScreenPoint p in polygon)
                {
                    if (first)
                    {
                        figure.StartPoint = p.ToPoint(aliased);
                        first = false;
                    }
                    else
                    {
                        figure.Segments.Add(new LineSegment { Point = p.ToPoint(aliased) });
                    }
                }

                pg.Figures.Add(figure);
            }

            path.Data = pg;
            this.Add(path);
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:64,代码来源:MetroRenderContext.cs

示例15: DrawPolygon

        /// <summary>
        /// Draws a polygon. The polygon can have stroke and/or fill.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The stroke thickness.</param>
        /// <param name="dashArray">The dash array.</param>
        /// <param name="lineJoin">The line join type.</param>
        /// <param name="aliased">If set to <c>true</c> the shape will be aliased.</param>
        public override void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness, double[] dashArray, OxyPenLineJoin lineJoin, bool aliased)
        {
            this.paint.Reset();
            {
                this.path.Reset();
                {
                    this.SetPath(points, aliased);
                    this.path.Close();

                    if (fill.IsVisible())
                    {
                        this.SetFill(fill);
                        this.canvas.DrawPath(this.path, this.paint);
                    }

                    if (stroke.IsVisible())
                    {
                        this.SetStroke(stroke, thickness, dashArray, lineJoin, aliased);
                        this.canvas.DrawPath(this.path, this.paint);
                    }
                }
            }
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:33,代码来源:CanvasRenderContext.cs


注:本文中的OxyPenLineJoin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。