コード例 #1
0
 public void DrawLine(Pen pen, float startx, float starty, float endx, float endy)
 {
     SetOffset(false);
     Control.MoveTo(startx, starty);
     Control.LineTo(endx, endy);
     pen.Apply(this);
 }
コード例 #2
0
 public void DrawPath(Pen pen, IGraphicsPath path)
 {
     SetOffset(false);
     Control.Save();
     path.Apply(Control);
     pen.Apply(this);
     Control.Restore();
 }
コード例 #3
0
 public bool StrokeContains(Pen pen, PointF point)
 {
     using (var context = Playback())
     {
         pen.Apply(context);
         return(context.InStroke(point.X, point.Y));
     }
 }
コード例 #4
0
 public void DrawLines(Pen pen, IEnumerable <PointF> points)
 {
     SetOffset(false);
     StartDrawing();
     pen.Apply(this);
     Control.AddLines(points.Select(r => r.ToNS()).ToArray());
     pen.Finish(this);
     EndDrawing();
 }
コード例 #5
0
 public void DrawLine(Pen pen, float startx, float starty, float endx, float endy)
 {
     SetOffset(false);
     StartDrawing();
     pen.Apply(this);
     Control.MoveTo(startx, starty);
     Control.AddLineToPoint(endx, endy);
     pen.Finish(this);
     EndDrawing();
 }
コード例 #6
0
        public void DrawEllipse(Pen pen, float x, float y, float width, float height)
        {
            SetOffset(false);
            StartDrawing();
            var rect = new CGRect(x, y, width, height);

            pen.Apply(this);
            Control.StrokeEllipseInRect(rect);
            EndDrawing();
        }
コード例 #7
0
        public void DrawRectangle(Pen pen, float x, float y, float width, float height)
        {
            SetOffset(false);
            StartDrawing();
            var rect = new CGRect(x, y, width, height);

            pen.Apply(this);
            Control.AddRect(rect);
            pen.Finish(this);
            EndDrawing();
        }
コード例 #8
0
        public void DrawPath(Pen pen, IGraphicsPath path)
        {
            SetOffset(false);
            StartDrawing();

            pen.Apply(this);
            Control.BeginPath();
            Control.AddPath(path.ToCG());
            Control.StrokePath();

            EndDrawing();
        }
コード例 #9
0
 public void DrawLine(Pen pen, float startx, float starty, float endx, float endy)
 {
     SetOffset(false);
     StartDrawing();
     pen.Apply(this);
     Control.StrokeLineSegments(new []
     {
         new CGPoint(startx, starty),
         new CGPoint(endx, endy)
     });
     EndDrawing();
 }
コード例 #10
0
        public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
        {
            SetOffset(true);
            StartDrawing();

            var rect = new CGRect(x, y, width, height);

            pen.Apply(this);
            var yscale  = rect.Height / rect.Width;
            var centerY = rect.GetMidY();
            var centerX = rect.GetMidX();

            Control.SaveState();             // save so the drawing of the pen isn't affected by the transform
            Control.ConcatCTM(new CGAffineTransform(1.0f, 0, 0, yscale, 0, centerY - centerY * yscale));
            Control.AddArc(centerX, centerY, rect.Width / 2, CGConversions.DegreesToRadians(startAngle), CGConversions.DegreesToRadians(startAngle + sweepAngle), sweepAngle < 0);
            Control.RestoreState();
            pen.Finish(this);
            EndDrawing();
        }
コード例 #11
0
ファイル: GraphicsHandler.cs プロジェクト: gene-l-thomas/Eto
		public void DrawPath(Pen pen, IGraphicsPath path)
		{
			StartDrawing();
			
			Control.TranslateCTM(offset, offset);
			pen.Apply(this);
			Control.BeginPath();
			Control.AddPath(path.ToCG());
			Control.StrokePath();
			
			EndDrawing();
		}
コード例 #12
0
ファイル: GraphicsHandler.cs プロジェクト: gene-l-thomas/Eto
		public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
		{
			StartDrawing();

			var rect = TranslateView(new CGRect(x, y, width, height), true);
			pen.Apply(this);
			var yscale = rect.Height / rect.Width;
			var centerY = rect.GetMidY();
			var centerX = rect.GetMidX();
			Control.ConcatCTM(new CGAffineTransform(1.0f, 0, 0, yscale, 0, centerY - centerY * yscale));
			Control.AddArc(centerX, centerY, rect.Width / 2, Conversions.DegreesToRadians(startAngle), Conversions.DegreesToRadians(startAngle + sweepAngle), sweepAngle < 0);
			Control.StrokePath();
			EndDrawing();
		}
コード例 #13
0
ファイル: GraphicsHandler.cs プロジェクト: gene-l-thomas/Eto
		public void DrawEllipse(Pen pen, float x, float y, float width, float height)
		{
			StartDrawing();
			var rect = TranslateView(new CGRect(x, y, width, height), true);
			pen.Apply(this);
			Control.StrokeEllipseInRect(rect);
			EndDrawing();
		}
コード例 #14
0
ファイル: GraphicsHandler.cs プロジェクト: gene-l-thomas/Eto
		public void DrawLine(Pen pen, float startx, float starty, float endx, float endy)
		{
			StartDrawing();
			pen.Apply(this);
			Control.StrokeLineSegments(new []
			{
				TranslateView(new CGPoint(startx, starty), true),
				TranslateView(new CGPoint(endx, endy), true)
			});
			EndDrawing();
		}
コード例 #15
0
ファイル: GtkConversions.cs プロジェクト: philstopford/Eto
 public static void Apply(this Pen pen, GraphicsHandler graphics) => pen.Apply(graphics.Control);
コード例 #16
0
ファイル: GraphicsHandler.cs プロジェクト: alexandrebaker/Eto
		public void DrawRectangle(Pen pen, float x, float y, float width, float height)
		{
			StartDrawing();
			var rect = TranslateView(new SD.RectangleF(x, y, width, height), true);
			pen.Apply(this);
			Control.StrokeRect(rect);
			EndDrawing();
		}