• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NGraphics.Pen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DrawLine

 public static void DrawLine(this ICanvas canvas, Point start, Point end, Pen pen)
 {
     var p = new Path { Pen = pen };
     p.MoveTo (start);
     p.LineTo (end);
     p.Draw (canvas);
 }
开发者ID:rbrian,项目名称:NGraphics,代码行数:7,代码来源:ICanvas.cs


示例2: Element

		protected Element (Pen pen, Brush brush)
		{
			Id = "";
			Pen = pen;
			Brush = brush;
			Transform = NGraphics.Transform.Identity;
		}
开发者ID:superlloyd,项目名称:NGraphics,代码行数:7,代码来源:Element.cs


示例3: Element

 public Element(Pen pen, Brush brush)
 {
     Id = Guid.NewGuid ().ToString ();
     Pen = pen;
     Brush = brush;
     Transform = NGraphics.Transform.Identity;
 }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:7,代码来源:Element.cs


示例4: DrawEllipse

		public void DrawEllipse (Rect frame, Pen pen = null, Brush brush = null)
		{
			var ch = GetChild (ChildType.Ellipse);
			var s = (Shapes.Rectangle)ch.Shape;
			s.Width = frame.Width;
			s.Height = frame.Height;
			FormatShape (s, pen, brush);
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:8,代码来源:CanvasCanvas.cs


示例5: Text

		public Text (Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
			: base (pen, brush)
		{
			Frame = frame;
			Font = font;
			Alignment = alignment;
			Spans = new List<TextSpan> ();
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:8,代码来源:Text.cs


示例6: Text

 public Text(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
     : base(pen, brush)
 {
     String = text;
     Frame = frame;
     Font = font;
     Alignment = alignment;
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:8,代码来源:Text.cs


示例7: Draw

		public override void Draw(ICanvas canvas, Rect rect)
		{
			if(DrawingFunction != null)
			{
				base.Draw(canvas, rect);
				return;
			}

			var borderColro = NGraphics.Color.FromHSL(
				                  BorderColor.Hue,
				                  BorderColor.Saturation,
				                  BorderColor.Luminosity,
				                  BorderColor.A);
			var pen = new Pen(borderColro, BorderWidth);
			var fillColor = NGraphics.Color.FromHSL(
				                BackColor.Hue,
				                BackColor.Saturation,
				                BackColor.Luminosity,
				                BackColor.A);
			var brush = new SolidBrush(fillColor);

			var padding = BorderWidth <= 0 ? 0.0 : BorderWidth;
			var newRect = rect.GetInflated(-padding);
			var curveSize = newRect.Height / 2;

			canvas.DrawPath(new PathOp []{ 
				new MoveTo(newRect.Left+curveSize, newRect.Top),
				new LineTo(newRect.Right-curveSize, newRect.Top),
				new CurveTo(
					new NGraphics.Point(newRect.Right-curveSize, newRect.Top),
					newRect.TopRight,
					new NGraphics.Point(newRect.Right, newRect.Top+curveSize)
				),
				new CurveTo(
					new NGraphics.Point(newRect.Right, newRect.Bottom-curveSize),
					newRect.BottomRight,
					new NGraphics.Point(newRect.Right-curveSize, newRect.Bottom)
				),
				new LineTo(newRect.Left+curveSize, newRect.Bottom),
				new CurveTo(
					new NGraphics.Point(newRect.Left+curveSize, newRect.Bottom),
					newRect.BottomLeft,
					new NGraphics.Point(newRect.Left, newRect.Bottom-curveSize)
				),
				new CurveTo(
					new NGraphics.Point(newRect.Left, newRect.Top+curveSize),
					newRect.TopLeft,
					new NGraphics.Point(newRect.Left+curveSize, newRect.Top)
				),
				new ClosePath()
			}, pen, brush);
		}
开发者ID:P3PPP,项目名称:XFAedSearch,代码行数:52,代码来源:RoundedButton.cs


示例8: DrawRectangle

 public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null)
 {
 }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:3,代码来源:NullPlatform.cs


示例9: DrawText

        public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
        {
            if (brush == null)
                return;

            var paint = GetFontPaint (font, alignment);
            var w = paint.MeasureText (text);
            var fm = paint.GetFontMetrics ();
            var h = fm.Ascent + fm.Descent;
            var point = frame.Position;
            var fr = new Rect (point, new Size (w, h));
            AddBrushPaint (paint, brush, fr);
            graphics.DrawText (text, (float)point.X, (float)point.Y, paint);
        }
开发者ID:sami1971,项目名称:NGraphics,代码行数:14,代码来源:AndroidPlatform.cs


示例10: GetPenPaint

 Paint GetPenPaint(Pen pen)
 {
     var paint = new Paint (PaintFlags.AntiAlias);
     paint.SetStyle (Paint.Style.Stroke);
     paint.SetARGB (pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
     paint.StrokeWidth = (float)pen.Width;
     return paint;
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:8,代码来源:AndroidPlatform.cs


示例11: DrawPath

        public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
        {
            if (pen == null && brush == null)
                return;

            using (var path = new global::Android.Graphics.Path ()) {

                var bb = new BoundingBoxBuilder ();

                foreach (var op in ops) {
                    var mt = op as MoveTo;
                    if (mt != null) {
                        var p = mt.Point;
                        path.MoveTo ((float)p.X, (float)p.Y);
                        bb.Add (p);
                        continue;
                    }
                    var lt = op as LineTo;
                    if (lt != null) {
                        var p = lt.Point;
                        path.LineTo ((float)p.X, (float)p.Y);
                        bb.Add (p);
                        continue;
                    }
                    var at = op as ArcTo;
                    if (at != null) {
                        var p = at.Point;
                        path.LineTo ((float)p.X, (float)p.Y);
                        bb.Add (p);
                        continue;
                    }
                    var ct = op as CurveTo;
                    if (ct != null) {
                        var p = ct.Point;
                        var c1 = ct.Control1;
                        var c2 = ct.Control2;
                        path.CubicTo ((float)c1.X, (float)c1.Y, (float)c2.X, (float)c2.Y, (float)p.X, (float)p.Y);
                        bb.Add (p);
                        bb.Add (c1);
                        bb.Add (c2);
                        continue;
                    }
                    var cp = op as ClosePath;
                    if (cp != null) {
                        path.Close ();
                        continue;
                    }

                    throw new NotSupportedException ("Path Op " + op);
                }

                var frame = bb.BoundingBox;

                if (brush != null) {
                    var paint = GetBrushPaint (brush, frame);
                    graphics.DrawPath (path, paint);
                }
                if (pen != null) {
                    var paint = GetPenPaint (pen);
                    graphics.DrawPath (path, paint);
                }
            }
        }
开发者ID:sami1971,项目名称:NGraphics,代码行数:63,代码来源:AndroidPlatform.cs


示例12: DrawRectangle

 public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null)
 {
     if (brush != null) {
         var paint = GetBrushPaint (brush, frame);
         graphics.DrawRect ((float)(frame.X), (float)(frame.Y), (float)(frame.X + frame.Width), (float)(frame.Y + frame.Height), paint);
     }
     if (pen != null) {
         var paint = GetPenPaint (pen);
         graphics.DrawRect ((float)(frame.X), (float)(frame.Y), (float)(frame.X + frame.Width), (float)(frame.Y + frame.Height), paint);
     }
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:11,代码来源:AndroidPlatform.cs


示例13: DrawPath

        public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
        {
            var bb = new BoundingBoxBuilder ();
            var s = new D2D1.PathGeometry (factories.D2DFactory);
            var figureDepth = 0;
            using (var sink = s.Open ()) {
                foreach (var op in ops) {
                    if (op is MoveTo) {
                        while (figureDepth > 0) {
                            sink.EndFigure (D2D1.FigureEnd.Open);
                            figureDepth--;
                        }
                        var mt = ((MoveTo)op);
                        sink.BeginFigure (Conversions.ToVector2 (mt.Point), D2D1.FigureBegin.Filled);
                        figureDepth++;
                        bb.Add (mt.Point);
                    }
                    else if (op is LineTo) {
                        var lt = ((LineTo)op);
                        sink.AddLine (Conversions.ToVector2 (lt.Point));
                        bb.Add (lt.Point);
                    }
                    else if (op is ArcTo) {
                        var ar = ((ArcTo)op);
                        // TODO: Direct2D Arcs
                        //sink.AddArc (new D2D1.ArcSegment {
                        //	Size = Conversions.ToSize2F (ar.Radius),
                        //	Point = Conversions.ToVector2 (ar.Point),
                        //	SweepDirection = ar.SweepClockwise ? D2D1.SweepDirection.Clockwise : D2D1.SweepDirection.CounterClockwise,
                        //});
                        sink.AddLine (Conversions.ToVector2 (ar.Point));
                        bb.Add (ar.Point);
                    }
                    else if (op is CurveTo) {
                        var ct = ((CurveTo)op);
                        sink.AddBezier (new D2D1.BezierSegment {
                            Point1 = Conversions.ToVector2 (ct.Control1),
                            Point2 = Conversions.ToVector2 (ct.Control2),
                            Point3 = Conversions.ToVector2 (ct.Point),
                        });
                        bb.Add (ct.Point);
                        bb.Add (ct.Control1);
                        bb.Add (ct.Control2);
                    }
                    else if (op is ClosePath) {
                        sink.EndFigure (D2D1.FigureEnd.Closed);
                        figureDepth--;
                    }
                    else {
                        // TODO: More path operations
                    }
                }
                while (figureDepth > 0) {
                    sink.EndFigure (D2D1.FigureEnd.Open);
                    figureDepth--;
                }
                sink.Close ();
            }

            var p = GetBrush (pen);
            var b = GetBrush (bb.BoundingBox, brush);

            if (b != null) {
                renderTarget.FillGeometry (s, b);
            }
            if (p != null) {
                renderTarget.DrawGeometry (s, p, (float)pen.Width, GetStrokeStyle (pen));
            }
        }
开发者ID:rbrian,项目名称:NGraphics,代码行数:69,代码来源:Direct2DCanvas.cs


示例14: DrawEllipse

 public void DrawEllipse(Rect frame, Pen pen = null, Brush brush = null)
 {
     if (brush != null) {
         var paint = GetBrushPaint (brush, frame);
         graphics.DrawOval (Conversions.GetRectF (frame), paint);
     }
     if (pen != null) {
         var paint = GetPenPaint (pen);
         graphics.DrawOval (Conversions.GetRectF (frame), paint);
     }
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:11,代码来源:AndroidPlatform.cs


示例15: DrawText

 public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
 {
 }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:3,代码来源:NullPlatform.cs


示例16: DrawPath

 public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
 {
 }
开发者ID:xamarin-libraries,项目名称:xamarin-libraries,代码行数:3,代码来源:NullPlatform.cs


示例17: DrawRectangle

        public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null)
        {
            if (pen == null && brush == null)
                return;

            DrawElement (() => {
                context.AddRect (Conversions.GetCGRect (frame));
                return frame;
            }, pen, brush);
        }
开发者ID:nakijun,项目名称:NGraphics,代码行数:10,代码来源:ApplePlatform.cs


示例18: Path

 public Path(IEnumerable<PathOp> operations, Pen pen = null, Brush brush = null)
     : base(pen, brush)
 {
     Operations.AddRange (operations);
 }
开发者ID:sami1971,项目名称:NGraphics,代码行数:5,代码来源:Path.cs


示例19: DrawPath

        public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
        {
            if (pen == null && brush == null)
                return;

            DrawElement (() => {

                var bb = new BoundingBoxBuilder ();

                foreach (var op in ops) {
                    var mt = op as MoveTo;
                    if (mt != null) {
                        var p = mt.Point;
                        context.MoveTo ((nfloat)p.X, (nfloat)p.Y);
                        bb.Add (p);
                        continue;
                    }
                    var lt = op as LineTo;
                    if (lt != null) {
                        var p = lt.Point;
                        context.AddLineToPoint ((nfloat)p.X, (nfloat)p.Y);
                        bb.Add (p);
                        continue;
                    }
                    var at = op as ArcTo;
                    if (at != null) {
                        var p = at.Point;
                        var pp = Conversions.GetPoint (context.GetPathCurrentPoint ());
                        Point c1, c2;
                        at.GetCircles (pp, out c1, out c2);

                        var circleCenter = at.LargeArc ^ !at.SweepClockwise ? c2 : c1;

                        var startAngle = (float)Math.Atan2(pp.Y - circleCenter.Y, pp.X - circleCenter.X);
                        var endAngle = (float)Math.Atan2(p.Y - circleCenter.Y, p.X - circleCenter.X);

                        context.AddArc((nfloat)circleCenter.X, (nfloat)circleCenter.Y, (nfloat)at.Radius.Min, startAngle, endAngle, at.SweepClockwise);

                        bb.Add (p);
                        continue;
                    }
                    var ct = op as CurveTo;
                    if (ct != null) {
                        var p = ct.Point;
                        var c1 = ct.Control1;
                        var c2 = ct.Control2;
                        context.AddCurveToPoint ((nfloat)c1.X, (nfloat)c1.Y, (nfloat)c2.X, (nfloat)c2.Y, (nfloat)p.X, (nfloat)p.Y);
                        bb.Add (p);
                        bb.Add (c1);
                        bb.Add (c2);
                        continue;
                    }
                    var cp = op as ClosePath;
                    if (cp != null) {
                        context.ClosePath ();
                        continue;
                    }

                    throw new NotSupportedException ("Path Op " + op);
                }

                return bb.BoundingBox;

            }, pen, brush);
        }
开发者ID:nakijun,项目名称:NGraphics,代码行数:65,代码来源:ApplePlatform.cs


示例20: GetStrokeStyle

 D2D1.StrokeStyle GetStrokeStyle(Pen pen)
 {
     return null;
 }
开发者ID:rbrian,项目名称:NGraphics,代码行数:4,代码来源:Direct2DCanvas.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NGraphics.Rect类代码示例发布时间:2022-05-26
下一篇:
C# Treewalk.FileTreeIterator类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap