public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
        {
            if (fill != null)
            {
                ToColor(fill).SetFill();
                var path = new CGPath();
                path.AddElipseInRect(ToRectangle(rect));

                gctx.AddPath(path);
                gctx.DrawPath(CGPathDrawingMode.Fill);
            }

            if (stroke == null || thickness <= 0)
            {
                return;
            }

            SetAttributes(null, stroke, thickness);

            var path2 = new CGPath();

            path2.AddElipseInRect(ToRectangle(rect));


            gctx.AddPath(path2);
            gctx.DrawPath(CGPathDrawingMode.Stroke);
        }
        /// <summary>
        /// Draws an ellipse.
        /// </summary>
        /// <param name="rect">The rectangle.</param>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The thickness.</param>
        public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
        {
            this.SetAlias(false);
            var convertedRectangle = rect.Convert();

            if (fill.IsVisible())
            {
                this.SetFill(fill);
                var path = new CGPath();
                path.AddElipseInRect(convertedRectangle);

                this.gctx.AddPath(path);
                this.gctx.DrawPath(CGPathDrawingMode.Fill);
            }

            if (stroke.IsVisible() && thickness > 0)
            {
                this.SetStroke(stroke, thickness);

                var path = new CGPath();
                path.AddElipseInRect(convertedRectangle);

                this.gctx.AddPath(path);
                this.gctx.DrawPath(CGPathDrawingMode.Stroke);
            }
        }
Exemplo n.º 3
0
        private UIImage drawCenter()
        {
            UIGraphics.BeginImageContext(new SizeF(64, 64));

            using (CGContext cont = UIGraphics.GetCurrentContext()) {
                using (CGPath path = new CGPath()) {
                    cont.SetLineWidth(1f);
                    cont.SetRGBStrokeColor(1f, 0, 0, 1);
                    cont.SetRGBFillColor(0.5f, 0, 0, 1);
                    path.AddElipseInRect(new RectangleF(24, 24, 16, 16));
                    path.CloseSubpath();

                    cont.AddPath(path);
                    cont.DrawPath(CGPathDrawingMode.FillStroke);
                }

                using (CGPath path = new CGPath()) {
                    cont.SetRGBStrokeColor(1f, 0, 0, 1);
                    cont.SetLineWidth(3f);
//					cont.SetRGBFillColor (.5f, 0, 0, 1);
                    path.AddElipseInRect(new RectangleF(16, 16, 32, 32));
                    path.CloseSubpath();

                    cont.AddPath(path);
                    cont.DrawPath(CGPathDrawingMode.Stroke);
                }

                return(UIGraphics.GetImageFromCurrentImageContext());
            }

            UIGraphics.EndImageContext();
        }
        public override void Draw(System.Drawing.RectangleF rect)
        {
            //Get the current context
            CGContext ctxt = UIGraphics.GetCurrentContext();
            ctxt.ClearRect(rect);

            //Set up the stroke and fill characteristics
            ctxt.SetLineWidth(3.0f);
            float[] gray = { 0.5f, 0.5f, 0.5f, 1.0f};
            ctxt.SetStrokeColor(gray);
            float[] red = { 0.75f, 0.25f, 0.25f, 1.0f};
            ctxt.SetFillColor(red);

            //Draw a line between the two location points
            ctxt.MoveTo(Loc1.X, Loc1.Y);
            ctxt.AddLineToPoint(Loc2.X, Loc2.Y);
            ctxt.StrokePath();

            var p1Box = new RectangleF(Loc1.X, Loc1.Y, 0.0f, 0.0f);
            var p2Box = new RectangleF(Loc2.X, Loc2.Y, 0.0f, 0.0f);
            var offset = -8.0f;

            foreach(var r in new RectangleF[] {p1Box, p2Box})
            {
                using(var path = new CGPath())
                {
                    var cpath = new CGPath();
                    r.Inflate (new SizeF (offset, offset));
                    cpath.AddElipseInRect(r);
                    ctxt.AddPath(cpath);
                    ctxt.FillPath();
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Draws an ellipse.
        /// </summary>
        /// <param name="rect">The rectangle.</param>
        /// <param name="fill">The fill color.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The thickness.</param>
        public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
        {
            this.SetAlias(false);
            var convertedRectangle = rect.Convert();
            if (fill.IsVisible())
            {
                this.SetFill(fill);
                var path = new CGPath();
                path.AddElipseInRect(convertedRectangle);

                this.gctx.AddPath(path);
                this.gctx.DrawPath(CGPathDrawingMode.Fill);
            }

            if (stroke.IsVisible() && thickness > 0)
            {
                this.SetStroke(stroke, thickness);

                var path = new CGPath();
                path.AddElipseInRect(convertedRectangle);

                this.gctx.AddPath(path);
                this.gctx.DrawPath(CGPathDrawingMode.Stroke);
            }
        }
Exemplo n.º 6
0
        public override void CreateShape(CGPath path, CGContext gctx)
        {
            path.AddElipseInRect (new RectangleF (_origin.X, _origin.Y, 100, 100));

            gctx.AddPath (path);

            gctx.DrawPath (CGPathDrawingMode.FillStroke);
        }
Exemplo n.º 7
0
 public void AddEllipse(float x, float y, float width, float height)
 {
                 #if XAMMAC || XAMMAC2 || IOS
     Control.AddEllipseInRect(new CGRect(x, y, width, height));
                 #else
     Control.AddElipseInRect(new CGRect(x, y, width, height));
                 #endif
     startFigure   = true;
     isFirstFigure = false;
 }
        public override void Draw(RectangleF rect)
        {
            var bounds = new RectangleF(0.0f, 0.0f, SIDELENGTH, SIDELENGTH);
            var context = UIGraphics.GetCurrentContext();
            var path = new CGPath();

            //sp! Elipse [sic]
            path.AddElipseInRect(this.Bounds);

            context.AddPath(path);
            context.Clip();

            context.DrawPath(CGPathDrawingMode.Fill);

            this.Image.Draw(bounds);
        }
Exemplo n.º 9
0
        public ClockView()
        {
            // Set background to pink.
            this.BackgroundColor = UIColor.FromRGB(1.0f, 0.8f, 0.8f);

            // All paths are based on 100-unit clock radius
            //		centered at (0, 0)

            // Define circle for tick marks.
            tickMarks = new CGPath();
            tickMarks.AddElipseInRect(new RectangleF(-90, -90, 180, 180));

            // Hour, minute, second hands defined to point straight up.

            // Define hour hand.
            hourHand = new CGPath();
            hourHand.MoveToPoint(0, -60);
            hourHand.AddCurveToPoint(0, -30, 20, -30, 5, -20);
            hourHand.AddLineToPoint(5, 0);
            hourHand.AddCurveToPoint(5, 7.5f, -5, 7.5f, -5, 0);
            hourHand.AddLineToPoint(-5, -20);
            hourHand.AddCurveToPoint(-20, -30, 0, -30, 0, -60);
            hourHand.CloseSubpath();

            // Define minute hand.
            minuteHand = new CGPath();
            minuteHand.MoveToPoint(0, -80);
            minuteHand.AddCurveToPoint(0, -75, 0, -70, 2.5f, -60);
            minuteHand.AddLineToPoint(2.5f, 0);
            minuteHand.AddCurveToPoint(2.5f, 5, -2.5f, 5, -2.5f, 0);
            minuteHand.AddLineToPoint(-2.5f, -60);
            minuteHand.AddCurveToPoint(0, -70, 0, -75, 0, -80);
            minuteHand.CloseSubpath();

            // Define second hand.
            secondHand = new CGPath();
            secondHand.MoveToPoint(0, 10);
            secondHand.AddLineToPoint(0, -80);
        }
Exemplo n.º 10
0
		public ClockView ()
		{
			// Set background to pink.
			this.BackgroundColor = UIColor.FromRGB (1.0f, 0.8f, 0.8f);

			// All paths are based on 100-unit clock radius
			//		centered at (0, 0)

			// Define circle for tick marks.
			tickMarks = new CGPath ();
			tickMarks.AddElipseInRect(new RectangleF(-90, -90, 180, 180));

			// Hour, minute, second hands defined to point straight up.

			// Define hour hand.
			hourHand = new CGPath ();
			hourHand.MoveToPoint (0, -60);
			hourHand.AddCurveToPoint (0, -30, 20, -30, 5, - 20);
			hourHand.AddLineToPoint (5, 0);
			hourHand.AddCurveToPoint (5, 7.5f, -5, 7.5f, -5, 0);
			hourHand.AddLineToPoint (-5, -20);
			hourHand.AddCurveToPoint (-20, -30, 0, -30, 0, -60);
			hourHand.CloseSubpath ();

			// Define minute hand.
			minuteHand = new CGPath ();
			minuteHand.MoveToPoint (0, -80);
			minuteHand.AddCurveToPoint (0, -75, 0, -70, 2.5f, -60);
			minuteHand.AddLineToPoint (2.5f, 0);
			minuteHand.AddCurveToPoint (2.5f, 5, -2.5f, 5, -2.5f, 0);
			minuteHand.AddLineToPoint (-2.5f, -60);
			minuteHand.AddCurveToPoint (0, -70, 0, -75, 0, -80);
			minuteHand.CloseSubpath ();

			// Define second hand.
			secondHand = new CGPath ();
			secondHand.MoveToPoint (0, 10);
			secondHand.AddLineToPoint(0, -80);
		}
		public override void DrawEllipse (OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
		{
			if (fill != null)
            {
				ToColor(fill).SetFill();
                var path = new CGPath ();
	            path.AddElipseInRect(ToRectangle(rect));

	            gctx.AddPath (path);
	            gctx.DrawPath (CGPathDrawingMode.Fill);
            }

            if (stroke == null || thickness <= 0)
            {
                return;
            }

			SetAttributes (null, stroke, thickness);

			var path2 = new CGPath ();
            path2.AddElipseInRect(ToRectangle(rect));


            gctx.AddPath (path2);
            gctx.DrawPath (CGPathDrawingMode.Stroke);
		}
Exemplo n.º 12
0
 public void AddEllipse(float x, float y, float width, float height)
 {
     Control.AddElipseInRect(new sd.RectangleF(x, y, width, height));
     startFigure   = true;
     isFirstFigure = false;
 }
Exemplo n.º 13
0
		private UIImage drawCenter ()
		{
			UIGraphics.BeginImageContext (new SizeF(64, 64));
			
			using (CGContext cont = UIGraphics.GetCurrentContext()) {
				
				using (CGPath path = new CGPath()) {
					
					cont.SetLineWidth (1f);
					cont.SetRGBStrokeColor (1f, 0, 0, 1);
					cont.SetRGBFillColor (0.5f, 0, 0, 1);
					path.AddElipseInRect(new RectangleF(24,24,16,16));
					path.CloseSubpath ();
					
					cont.AddPath (path);
					cont.DrawPath (CGPathDrawingMode.FillStroke);
					
				}
				
				using (CGPath path = new CGPath()) {
					
					cont.SetRGBStrokeColor (1f, 0, 0, 1);
					cont.SetLineWidth(3f);
//					cont.SetRGBFillColor (.5f, 0, 0, 1);
					path.AddElipseInRect(new RectangleF(16,16,32,32));
					path.CloseSubpath ();
					
					cont.AddPath (path);
					cont.DrawPath (CGPathDrawingMode.Stroke);
					
				}
				
				return UIGraphics.GetImageFromCurrentImageContext ();
				
			}
			
			UIGraphics.EndImageContext ();
		}