public override void Draw(TimerTick tick) { UIBezierPath _bezier = new UIBezierPath(); Vector2 pointStart, pointA, pointB, pointEnd; if (IsAnimating) { pointStart = new Vector2(Distance, 0); pointA = new Vector2(BackgroundWidth, ScreenHeight / 4); pointB = new Vector2(BackgroundWidth, ScreenHeight * 3 / 4); pointEnd = new Vector2(Distance, ScreenHeight); _bezier.MoveToPoint(Vector2.Zero); _bezier.AddLineTo(pointStart); _bezier.AddCurveToPoint(pointEnd, pointA, pointB); _bezier.AddLineTo(new Vector2(0, ScreenHeight)); } else { pointStart = Vector2.Zero; pointA = new Vector2(Distance, ScreenHeight / 4); pointB = new Vector2(Distance, ScreenHeight * 3 / 4); pointEnd = new Vector2(0, ScreenHeight); _bezier.MoveToPoint(pointStart); _bezier.AddCurveToPoint(pointEnd, pointA, pointB); } _bezier.ClosePath(); Drawer.FillGeometry(_bezier.GetPath(), Brush); base.Draw(tick); }
public CGPath createPath() { nfloat height = (nfloat)37.0; var path = new UIBezierPath(); var centerWidth = this.Frame.Width / 2; path.MoveTo(new CGPoint(x: 0, y: 0)); // start top left path.AddLineTo(new CGPoint((centerWidth - height * 2), 0)); // the beginning of the trough // first curve down path.AddCurveToPoint(new CGPoint(x: centerWidth, y: height), controlPoint1: new CGPoint(x: (centerWidth - 30), y: 0), controlPoint2: new CGPoint(x: centerWidth - 35, y: height)); // second curve up path.AddCurveToPoint(new CGPoint(x: (centerWidth + height * 2), y: 0), controlPoint1: new CGPoint(x: centerWidth + 35, y: height), controlPoint2: new CGPoint(x: (centerWidth + 30), y: 0)); // complete the rect path.AddLineTo(new CGPoint(x: this.Frame.Width, y: 0)); path.AddLineTo(new CGPoint(x: this.Frame.Width, y: this.Frame.Height)); path.AddLineTo(new CGPoint(x: 0, y: this.Frame.Height)); path.ClosePath(); return(path.CGPath); }
private UIBezierPath PathForRect(CGRect rect, nfloat arrowOffset) { if (rect == CGRect.Empty) { return(null); } rect = new CGRect(CGPoint.Empty, rect.Size); // ensure origin is CGPointZero // Create rounded rect CGRect roundedRect = rect; var size = roundedRect.Size; size.Height -= ArrowLength; roundedRect.Size = size; var popUpPath = UIBezierPath.FromRoundedRect(roundedRect, cornerRadius); // Create arrow path nfloat maxX = roundedRect.GetMaxX(); // prevent arrow from extending beyond this point nfloat arrowTipX = rect.GetMidX() + arrowOffset; CGPoint tip = new CGPoint(arrowTipX, rect.GetMaxY()); nfloat arrowLength = roundedRect.Height / 2.0f; nfloat x = arrowLength * NMath.Tan(45.0f * NMath.PI / 180); // x = half the length of the base of the arrow var arrowPath = new UIBezierPath(); arrowPath.MoveTo(tip); arrowPath.AddLineTo(new CGPoint(NMath.Max(arrowTipX - x, 0), roundedRect.GetMaxY() - arrowLength)); arrowPath.AddLineTo(new CGPoint(NMath.Min(arrowTipX + x, maxX), roundedRect.GetMaxY() - arrowLength)); arrowPath.ClosePath(); popUpPath.AppendPath(arrowPath); return(popUpPath); }
public override void Draw(CGRect rect) { UIView head = ((WalkingDead)Superview).head; var path = new UIBezierPath(); path.LineCapStyle = CGLineCap.Round; CGRect headFrame = head.Frame; if (!MovingRight) { path.MoveTo(new CGPoint(rect.GetMidX() - 10, headFrame.GetMaxY() + 10)); path.AddLineTo(new CGPoint(rect.GetMidX() - 10 + rect.Size.Width / 4, headFrame.GetMaxY() + 10)); path.AddLineTo(new CGPoint(rect.GetMidX() - 10 + rect.Size.Width / 2, headFrame.GetMaxY() + 10 + rect.Size.Height / 10)); } else { path.MoveTo(new CGPoint(rect.GetMidX() + 10, headFrame.GetMaxY() + 10)); path.AddLineTo(new CGPoint(rect.GetMidX() + 10 - rect.Size.Width / 4, headFrame.GetMaxY() + 10)); path.AddLineTo(new CGPoint(rect.GetMidX() + 10 - rect.Size.Width / 2, headFrame.GetMaxY() + 10 + rect.Size.Height / 10)); } UIColor.Black.SetStroke(); path.LineWidth = 12; path.Stroke(); UIColor.White.SetStroke(); path.LineWidth = 8; path.Stroke(); }
private UIBezierPath ShapePath(CGSize size) { var intensity = 0.44f; var controlRatio = 0.25f; var padding = 0; CGPoint leftTop = new CGPoint(x: padding, y: padding); CGPoint rightTop = new CGPoint(x: size.Width - padding, y: padding); CGPoint leftBottom = new CGPoint(x: padding, y: size.Height - padding); CGPoint rightBottom = new CGPoint(x: size.Width - padding, y: size.Height - padding); var path = new UIBezierPath(); path.MoveTo(leftTop); path.AddQuadCurveToPoint(new CGPoint(x: size.Width / 2, y: size.Height / 2 * intensity), controlPoint: new CGPoint(x: size.Width / 2 * controlRatio, y: size.Height / 2 * intensity)); path.AddQuadCurveToPoint(rightTop, controlPoint: new CGPoint(x: size.Width - (size.Width / 2 * controlRatio), y: size.Height / 2 * intensity)); path.AddLineTo(rightBottom); path.AddQuadCurveToPoint(new CGPoint(x: size.Width / 2, y: size.Height - (size.Height / 2 * intensity)), controlPoint: new CGPoint(x: size.Width - (size.Width / 2 * controlRatio), y: size.Height - (size.Height / 2 * intensity))); path.AddQuadCurveToPoint(leftBottom, controlPoint: new CGPoint(x: size.Width / 2 * controlRatio, y: size.Height - (size.Height / 2 * intensity))); path.AddLineTo(leftTop); path.ClosePath(); return(path); }
private void ConfigureStarCircularProgress() { var frame = new CGRect(201, 200, 200, 200); starProgress = new iOS.CircularProgress(frame); starProgress.Colors = new[] { UIColor.Purple.CGColor, ColorExtension.RgbaColor(0xFFF77A55).CGColor, UIColor.Orange.CGColor }; starProgress.LineWidth = 3.0; var path = new UIBezierPath(); path.MoveTo(new CGPoint(50.0, 2.0)); path.AddLineTo(new CGPoint(84.0, 86.0)); path.AddLineTo(new CGPoint(6.0, 33.0)); path.AddLineTo(new CGPoint(96.0, 33.0)); path.AddLineTo(new CGPoint(17.0, 86.0)); path.ClosePath(); starProgress.Path = path; View.AddSubview(starProgress); }
static void DrawXamagram() { var context = UIGraphics.GetCurrentContext(); var color = UIColor.FromRGBA(0.204f, 0.600f, 0.863f, 1.000f); context.SaveState(); context.TranslateCTM(257.0f, 257.0f); context.RotateCTM(90.0f * (nfloat)Math.PI / 180.0f); var polygonPath = new UIBezierPath(); polygonPath.MoveTo(new CGPoint(0.0f, -250.0f)); polygonPath.AddLineTo(new CGPoint(216.51f, -125.0f)); polygonPath.AddLineTo(new CGPoint(216.51f, 125.0f)); polygonPath.AddLineTo(new CGPoint(0.0f, 250.0f)); polygonPath.AddLineTo(new CGPoint(-216.51f, 125.0f)); polygonPath.AddLineTo(new CGPoint(-216.51f, -125.0f)); polygonPath.ClosePath(); color.SetFill(); polygonPath.Fill(); context.RestoreState(); var textRect = new CGRect(0.0f, 0.0f, 512.0f, 512.0f); var textContent = "X"; UIColor.White.SetFill(); var textFont = UIFont.FromName("Helvetica", 350.0f); textRect.Offset(0.0f, (textRect.Height - new NSString(textContent).StringSize(textFont, textRect.Size).Height) / 2.0f); new NSString(textContent).DrawString(textRect, textFont, UILineBreakMode.WordWrap, UITextAlignment.Center); }
private void ConfigureStarCircularProgress() { CGRect frame = new CGRect(0, 0, 128, 128); starProgress = new CircularProgress(frame); //starProgress.Center = ProgressHazne.Center; starProgress.Colors = new[] { UIColor.FromRGB(225, 0, 105).CGColor }; starProgress.LineWidth = 10.0; var path = new UIBezierPath(); path.MoveTo(new CGPoint(50.0, 2.0)); path.AddLineTo(new CGPoint(84.0, 86.0)); path.AddLineTo(new CGPoint(6.0, 33.0)); path.AddLineTo(new CGPoint(96.0, 33.0)); path.AddLineTo(new CGPoint(17.0, 86.0)); path.ClosePath(); starProgress.Path = path; ProgressHazne.AddSubview(starProgress); starProgress.Transform = CGAffineTransform.MakeRotation(3.14159f * 270 / 180f); }
private void DrawZones() { NCZone[] zones = currentSublocation.Zones; foreach (NCZone zone in zones) { UIBezierPath zonePath = new UIBezierPath(); CAShapeLayer zoneLayer = new CAShapeLayer(); NCLocationPoint[] points = zone.Points; NCLocationPoint point0 = points[0]; zonePath.MoveTo(new CGPoint(mapView.Frame.Width * point0.X.DoubleValue / currentSublocation.Width, mapView.Frame.Height * (1.0 - point0.Y.DoubleValue / currentSublocation.Height))); foreach (NCLocationPoint point in zone.Points) { zonePath.AddLineTo(new CGPoint(mapView.Frame.Width * point.X.DoubleValue / currentSublocation.Width, mapView.Frame.Height * (1.0 - point.Y.DoubleValue / currentSublocation.Height))); } zonePath.AddLineTo(new CGPoint(mapView.Frame.Width * point0.X.DoubleValue / currentSublocation.Width, mapView.Frame.Height * (1.0 - point0.Y.DoubleValue / currentSublocation.Height))); zoneLayer.Hidden = false; zoneLayer.Path = zonePath.CGPath; zoneLayer.StrokeColor = ColorHelper.FromHex(zone.Color, 1).CGColor; zoneLayer.LineWidth = 2.0f; zoneLayer.LineJoin = CoreAnimation.CAShapeLayer.JoinRound; zoneLayer.FillColor = ColorHelper.FromHex(zone.Color, 0.5f).CGColor; mapView.Layer.AddSublayer(zoneLayer); } }
public override void Draw(RectangleF rect) { UIView head = ((WalkingDead)Superview).head; UIBezierPath path = new UIBezierPath(); path.LineCapStyle = CGLineCap.Round; RectangleF headFrame = head.Frame; if (!MovingRight) { rect.X -= 20; path.MoveTo(new PointF(rect.GetMidX() + 20, headFrame.GetMaxY() + 10)); path.AddLineTo(new PointF(rect.GetMidX() + 20 + rect.Size.Width / 6, headFrame.GetMaxY() + 10)); path.AddLineTo(new PointF(rect.GetMidX() + 20 + rect.Size.Width / 6 + 10, headFrame.GetMaxY() + 10 + 20)); } else { path.MoveTo(new PointF(rect.GetMidX() - 20, headFrame.GetMaxY() + 10)); path.AddLineTo(new PointF(rect.GetMidX() - 20 - rect.Size.Width / 6, headFrame.GetMaxY() + 10)); path.AddLineTo(new PointF(rect.GetMidX() - 20 - rect.Size.Width / 6 - 10, headFrame.GetMaxY() + 10 + 20)); } UIColor.Black.SetStroke(); path.LineWidth = 12; path.Stroke(); UIColor.White.SetStroke(); path.LineWidth = 8; path.Stroke(); }
/// <summary> /// Touches ended. /// </summary> /// <param name="touches">Touches to use.</param> /// <param name="evt">Event to use.</param> public override void TouchesEnded(NSSet touches, UIEvent evt) { UITouch touch = touches.AnyObject as UITouch; // Obtain the location of the touch and add it to the current path and current_points array. CGPoint touchLocation = touch.LocationInView(this); currentPath.AddLineTo(touchLocation); currentPoints.Add(touchLocation); // Obtain the smoothed path and the points array for that path. currentPath = SmoothedPathWithGranularity(0, out currentPoints); // Add the smoothed path and points array to their Lists. paths.Add(currentPath); points.Add(currentPoints.ToArray()); LoadNewImage(); UpdateBounds(touchLocation); SetNeedsDisplay(); NotifyIsBlankChanged(); currentPath = null; currentPoints.Clear(); }
void DrawLandmark(VNFaceLandmarkRegion2D feature, CGRect scaledBoundingBox, bool closed, UIColor color) { if (feature == null) { return; } var mappedPoints = feature.NormalizedPoints.Select(o => new CGPoint(x: o.X * scaledBoundingBox.Width + scaledBoundingBox.X, y: o.Y * scaledBoundingBox.Height + scaledBoundingBox.Y)); using (var newLayer = new CAShapeLayer()) { newLayer.Frame = _view.Frame; newLayer.StrokeColor = color.CGColor; newLayer.LineWidth = 2; newLayer.FillColor = UIColor.Clear.CGColor; using (UIBezierPath path = new UIBezierPath()) { path.MoveTo(mappedPoints.First()); foreach (var point in mappedPoints.Skip(1)) { path.AddLineTo(point); } if (closed) { path.AddLineTo(mappedPoints.First()); } newLayer.Path = path.CGPath; } _shapeLayer.AddSublayer(newLayer); } }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); cnsTableViewHeight.Constant = TableView.ContentSize.Height; ScrollView.ContentSize = new CGSize(ScrollView.Frame.Width, TableView.Frame.Y + TableView.ContentSize.Height); InvokeOnMainThread(() => { View.LayoutIfNeeded(); }); var bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(ivTriangle.Layer.Bounds.X, ivTriangle.Layer.Bounds.Y)); bezierPath.AddLineTo(new CGPoint(ivTriangle.Layer.Bounds.GetMaxX(), ivTriangle.Layer.Bounds.GetMaxY())); bezierPath.AddLineTo(new CGPoint(ivTriangle.Layer.Bounds.GetMaxX(), ivTriangle.Layer.Bounds.GetMaxY() + 4)); bezierPath.AddLineTo(new CGPoint(ivTriangle.Layer.Bounds.X, ivTriangle.Layer.Bounds.GetMaxY() + 4)); bezierPath.AddLineTo(new CGPoint(ivTriangle.Layer.Bounds.X, ivTriangle.Layer.Bounds.GetMaxY())); bezierPath.ClosePath(); ivTriangle.Layer.AddSublayer(new CAShapeLayer { Frame = ivTriangle.Bounds, Path = bezierPath.CGPath, FillColor = UIColor.White.CGColor }); ivTriangle.Image = null; ScrollToOffset(ScrollView); }
private void HoleLayerViewOnDrawRectangleHole(object sender, EventArgs e) { var firstCorner = _holeLayerView.TopLeftCorner; var secondCorner = _holeLayerView.TopRightCorner; var thirstCorner = _holeLayerView.BottomRightCorner; var fourthCorner = _holeLayerView.BottomLeftCorner; var overlayPath = UIBezierPath.FromRect(_nativeView.Bounds); var transparentPath = new UIBezierPath(); transparentPath.MoveTo(new CGPoint(firstCorner.X, firstCorner.Y)); transparentPath.AddLineTo(new CGPoint(secondCorner.X, secondCorner.Y)); transparentPath.AddLineTo(new CGPoint(thirstCorner.X, thirstCorner.Y)); transparentPath.AddLineTo(new CGPoint(fourthCorner.X, fourthCorner.Y)); transparentPath.ClosePath(); overlayPath.AppendPath(transparentPath); overlayPath.UsesEvenOddFillRule = true; // Border path _borderShapeLayer.Path = transparentPath.CGPath; _borderShapeLayer.StrokeColor = UIColor.Black.CGColor; _borderShapeLayer.FillColor = UIColor.Clear.CGColor; // Rectangle hole path _holeShapeLayer.FillRule = CAShapeLayer.FillRuleEvenOdd; _holeShapeLayer.FillColor = UIColor.Black.ColorWithAlpha((nfloat)0.5).CGColor; _holeShapeLayer.Path = overlayPath.CGPath; }
public override void DrawRect(CGRect area, UIViewPrintFormatter formatter) { base.DrawRect(area, formatter); this.Add(placeHolderLabel); //创建路径 UIBezierPath leftPath = new UIBezierPath(); //起点 leftPath.MoveTo(new CGPoint(0, this.Bounds.Size.Height)); //画第一条线 leftPath.AddLineTo(new CGPoint(0, this.Bounds.Size.Height)); //画第二条线 leftPath.AddLineTo(new CGPoint(this.Bounds.Size.Width, this.Bounds.Size.Height)); //设置图层的属性 leftLayer.Path = leftPath.CGPath; //动画路径 leftLayer.StrokeColor = new CGColor(1f, 1f, 1f);; //外边框颜色 leftLayer.FillColor = null; //不设置路径颜色填充 leftLayer.BorderWidth = 3.0f; //图层边框 leftLayer.LineCap = new NSString("kCALineCapRound"); //线头样式为圆形 leftLayer.LineJoin = new NSString("kCALineJoinRound"); //拐角样式为圆角 // leftLayer.frame=CGRectMake(0, 50, 200, 1); leftLayer.BorderColor = UIColor.Black.CGColor; //边框颜色 this.Layer.AddSublayer(leftLayer); }
/// <summary> /// Draw the specified rect. /// </summary> /// <returns>The draw.</returns> /// <param name="rect">Rect.</param> public override void Draw(CGRect rect) { base.Draw(rect); var lineWidth = rect.Size.Width / 10; // Draw check mark if (Selected) { this.Layer.BackgroundColor = FillColor; var checkmark = new UIBezierPath(); var size = rect.Size; checkmark.MoveTo(new CGPoint(x: 22f / 100f * size.Width, y: 52f / 100f * size.Height)); checkmark.AddLineTo(new CGPoint(x: 38f / 100f * size.Width, y: 68f / 100f * size.Height)); checkmark.AddLineTo(new CGPoint(x: 76f / 100f * size.Width, y: 30f / 100f * size.Height)); checkmark.LineWidth = lineWidth; UIColor.White.SetStroke(); checkmark.Stroke(); } else { this.Layer.BackgroundColor = new CGColor(0, 0, 0, 0); } }
private void DrawNotImplemented(CGRect frame) { UIBezierPath textPath = new UIBezierPath(); textPath.MoveTo(new CGPoint(frame.GetMinX() + 0.40164f * frame.Width, frame.GetMinY() + 0.39663f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.40164f * frame.Width, frame.GetMinY() + 0.31069f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.31411f * frame.Width, frame.GetMinY() + 0.31069f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.31411f * frame.Width, frame.GetMinY() + 0.39663f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.40164f * frame.Width, frame.GetMinY() + 0.39663f * frame.Height)); textPath.ClosePath(); textPath.MoveTo(new CGPoint(frame.GetMinX() + 0.31411f * frame.Width, frame.GetMinY() + 0.62503f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.31411f * frame.Width, frame.GetMinY() + 0.71097f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.40164f * frame.Width, frame.GetMinY() + 0.71097f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.40164f * frame.Width, frame.GetMinY() + 0.62503f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.31411f * frame.Width, frame.GetMinY() + 0.62503f * frame.Height)); textPath.ClosePath(); textPath.MoveTo(new CGPoint(frame.GetMinX() + 0.62874f * frame.Width, frame.GetMinY() + 0.86349f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.68000f * frame.Width, frame.GetMinY() + 0.86349f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.59996f * frame.Width, frame.GetMinY() + 0.68696f * frame.Height), new CGPoint(frame.GetMinX() + 0.64267f * frame.Width, frame.GetMinY() + 0.80413f * frame.Height), new CGPoint(frame.GetMinX() + 0.61600f * frame.Width, frame.GetMinY() + 0.74529f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.57591f * frame.Width, frame.GetMinY() + 0.50192f * frame.Height), new CGPoint(frame.GetMinX() + 0.58393f * frame.Width, frame.GetMinY() + 0.62864f * frame.Height), new CGPoint(frame.GetMinX() + 0.57591f * frame.Width, frame.GetMinY() + 0.56696f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.59957f * frame.Width, frame.GetMinY() + 0.31998f * frame.Height), new CGPoint(frame.GetMinX() + 0.57591f * frame.Width, frame.GetMinY() + 0.43843f * frame.Height), new CGPoint(frame.GetMinX() + 0.58380f * frame.Width, frame.GetMinY() + 0.37779f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.68000f * frame.Width, frame.GetMinY() + 0.14500f * frame.Height), new CGPoint(frame.GetMinX() + 0.61534f * frame.Width, frame.GetMinY() + 0.26217f * frame.Height), new CGPoint(frame.GetMinX() + 0.64215f * frame.Width, frame.GetMinY() + 0.20384f * frame.Height)); textPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.62874f * frame.Width, frame.GetMinY() + 0.14500f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.53609f * frame.Width, frame.GetMinY() + 0.31765f * frame.Height), new CGPoint(frame.GetMinX() + 0.58774f * frame.Width, frame.GetMinY() + 0.19816f * frame.Height), new CGPoint(frame.GetMinX() + 0.55685f * frame.Width, frame.GetMinY() + 0.25572f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50494f * frame.Width, frame.GetMinY() + 0.50192f * frame.Height), new CGPoint(frame.GetMinX() + 0.51532f * frame.Width, frame.GetMinY() + 0.37959f * frame.Height), new CGPoint(frame.GetMinX() + 0.50494f * frame.Width, frame.GetMinY() + 0.44102f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.51361f * frame.Width, frame.GetMinY() + 0.59948f * frame.Height), new CGPoint(frame.GetMinX() + 0.50494f * frame.Width, frame.GetMinY() + 0.53599f * frame.Height), new CGPoint(frame.GetMinX() + 0.50783f * frame.Width, frame.GetMinY() + 0.56851f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.53845f * frame.Width, frame.GetMinY() + 0.69006f * frame.Height), new CGPoint(frame.GetMinX() + 0.51940f * frame.Width, frame.GetMinY() + 0.63045f * frame.Height), new CGPoint(frame.GetMinX() + 0.52768f * frame.Width, frame.GetMinY() + 0.66064f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.57749f * frame.Width, frame.GetMinY() + 0.77716f * frame.Height), new CGPoint(frame.GetMinX() + 0.54923f * frame.Width, frame.GetMinY() + 0.71948f * frame.Height), new CGPoint(frame.GetMinX() + 0.56224f * frame.Width, frame.GetMinY() + 0.74852f * frame.Height)); textPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.62874f * frame.Width, frame.GetMinY() + 0.86349f * frame.Height), new CGPoint(frame.GetMinX() + 0.59273f * frame.Width, frame.GetMinY() + 0.80581f * frame.Height), new CGPoint(frame.GetMinX() + 0.60982f * frame.Width, frame.GetMinY() + 0.83459f * frame.Height)); textPath.ClosePath(); UIColor.Black.SetFill(); textPath.Fill(); }
private void DrawCancelPictureButton(CGRect frame) { var color2 = UIColor.Red; var bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(frame.GetMinX() + 0.73928f * frame.Width, frame.GetMinY() + 0.14291f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.85711f * frame.Width, frame.GetMinY() + 0.26074f * frame.Height), new CGPoint(frame.GetMinX() + 0.73926f * frame.Width, frame.GetMinY() + 0.14289f * frame.Height), new CGPoint(frame.GetMinX() + 0.85711f * frame.Width, frame.GetMinY() + 0.26074f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.61785f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.85711f * frame.Width, frame.GetMinY() + 0.26074f * frame.Height), new CGPoint(frame.GetMinX() + 0.74457f * frame.Width, frame.GetMinY() + 0.37328f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.85355f * frame.Width, frame.GetMinY() + 0.73570f * frame.Height), new CGPoint(frame.GetMinX() + 0.74311f * frame.Width, frame.GetMinY() + 0.62526f * frame.Height), new CGPoint(frame.GetMinX() + 0.85355f * frame.Width, frame.GetMinY() + 0.73570f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.73570f * frame.Width, frame.GetMinY() + 0.85355f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.61785f * frame.Height), new CGPoint(frame.GetMinX() + 0.73570f * frame.Width, frame.GetMinY() + 0.85355f * frame.Height), new CGPoint(frame.GetMinX() + 0.62526f * frame.Width, frame.GetMinY() + 0.74311f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.26785f * frame.Width, frame.GetMinY() + 0.85000f * frame.Height), new CGPoint(frame.GetMinX() + 0.37621f * frame.Width, frame.GetMinY() + 0.74164f * frame.Height), new CGPoint(frame.GetMinX() + 0.26785f * frame.Width, frame.GetMinY() + 0.85000f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.15000f * frame.Width, frame.GetMinY() + 0.73215f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.38215f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.15000f * frame.Width, frame.GetMinY() + 0.73215f * frame.Height), new CGPoint(frame.GetMinX() + 0.25836f * frame.Width, frame.GetMinY() + 0.62379f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.14645f * frame.Width, frame.GetMinY() + 0.26430f * frame.Height), new CGPoint(frame.GetMinX() + 0.25689f * frame.Width, frame.GetMinY() + 0.37474f * frame.Height), new CGPoint(frame.GetMinX() + 0.14645f * frame.Width, frame.GetMinY() + 0.26430f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.22060f * frame.Width, frame.GetMinY() + 0.19014f * frame.Height), new CGPoint(frame.GetMinX() + 0.14645f * frame.Width, frame.GetMinY() + 0.26430f * frame.Height), new CGPoint(frame.GetMinX() + 0.18706f * frame.Width, frame.GetMinY() + 0.22369f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.26430f * frame.Width, frame.GetMinY() + 0.14645f * frame.Height), new CGPoint(frame.GetMinX() + 0.24420f * frame.Width, frame.GetMinY() + 0.16655f * frame.Height), new CGPoint(frame.GetMinX() + 0.26430f * frame.Width, frame.GetMinY() + 0.14645f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.38215f * frame.Height), new CGPoint(frame.GetMinX() + 0.26430f * frame.Width, frame.GetMinY() + 0.14645f * frame.Height), new CGPoint(frame.GetMinX() + 0.37474f * frame.Width, frame.GetMinY() + 0.25689f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.73926f * frame.Width, frame.GetMinY() + 0.14289f * frame.Height), new CGPoint(frame.GetMinX() + 0.62672f * frame.Width, frame.GetMinY() + 0.25543f * frame.Height), new CGPoint(frame.GetMinX() + 0.73926f * frame.Width, frame.GetMinY() + 0.14289f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.73928f * frame.Width, frame.GetMinY() + 0.14291f * frame.Height)); bezierPath.ClosePath(); color2.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 1.0f; bezierPath.Stroke(); }
private CAShapeLayer GetMaskForRoundedCorners() { var roundedRectanglePath = UIBezierPath.FromRoundedRect(Bounds, RadiusCorner); var biggerRect = Bounds.Copy().Grow(5); var maskPath = new UIBezierPath(); maskPath.MoveTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY())); maskPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMaxY())); maskPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMaxY())); maskPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMinY())); maskPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY())); maskPath.AppendPath(roundedRectanglePath); var maskForRoundedCorners = new CAShapeLayer(); var newPath = new CGPath(); newPath.AddRect(biggerRect); newPath.AddPath(maskPath.CGPath); maskForRoundedCorners.Path = newPath; maskForRoundedCorners.FillRule = CAShapeLayer.FillRuleEvenOdd; newPath.Dispose(); maskPath.Dispose(); roundedRectanglePath.Dispose(); return(maskForRoundedCorners); }
private void DrawInsectoid(CGRect rect) { //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(rect.GetMinX() + 0.15500f * rect.Width, rect.GetMinY() + 0.47746f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.19384f * rect.Width, rect.GetMinY() + 0.54225f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.84116f * rect.Width, rect.GetMinY() + 0.62000f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.88000f * rect.Width, rect.GetMinY() + 0.54225f * rect.Height)); bezierPath.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.54339f * rect.Width, rect.GetMinY() + 0.29605f * rect.Height), new CGPoint(rect.GetMinX() + 0.88000f * rect.Width, rect.GetMinY() + 0.54225f * rect.Height), new CGPoint(rect.GetMinX() + 0.77643f * rect.Width, rect.GetMinY() + 0.33492f * rect.Height)); bezierPath.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.15500f * rect.Width, rect.GetMinY() + 0.47746f * rect.Height), new CGPoint(rect.GetMinX() + 0.31036f * rect.Width, rect.GetMinY() + 0.25718f * rect.Height), new CGPoint(rect.GetMinX() + 0.15500f * rect.Width, rect.GetMinY() + 0.47746f * rect.Height)); bezierPath.ClosePath(); UIColor.Gray.SetFill(); bezierPath.Fill(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.13000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.32000f + 0.5f), NMath.Floor(rect.Width * 0.36000f + 0.5f) - NMath.Floor(rect.Width * 0.13000f + 0.5f), NMath.Floor(rect.Height * 0.56000f + 0.5f) - NMath.Floor(rect.Height * 0.32000f + 0.5f))); UIColor.Gray.SetFill(); ovalPath.Fill(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(rect.GetMinX() + 0.66000f * rect.Width, rect.GetMinY() + 0.53000f * rect.Height)); bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.77000f * rect.Width, rect.GetMinY() + 0.53000f * rect.Height)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.73000f * rect.Width, rect.GetMinY() + 0.71000f * rect.Height), new CGPoint(rect.GetMinX() + 0.77000f * rect.Width, rect.GetMinY() + 0.53000f * rect.Height), new CGPoint(rect.GetMinX() + 0.83000f * rect.Width, rect.GetMinY() + 0.71000f * rect.Height)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.66000f * rect.Width, rect.GetMinY() + 0.53000f * rect.Height), new CGPoint(rect.GetMinX() + 0.71500f * rect.Width, rect.GetMinY() + 0.60000f * rect.Height), new CGPoint(rect.GetMinX() + 0.66000f * rect.Width, rect.GetMinY() + 0.53000f * rect.Height)); bezier2Path.ClosePath(); UIColor.Gray.SetFill(); bezier2Path.Fill(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new CGPoint(rect.GetMinX() + 0.54338f * rect.Width, rect.GetMinY() + 0.48500f * rect.Height)); bezier3Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.66500f * rect.Width, rect.GetMinY() + 0.52500f * rect.Height)); bezier3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.54338f * rect.Width, rect.GetMinY() + 0.70500f * rect.Height), new CGPoint(rect.GetMinX() + 0.66500f * rect.Width, rect.GetMinY() + 0.52500f * rect.Height), new CGPoint(rect.GetMinX() + 0.63459f * rect.Width, rect.GetMinY() + 0.70500f * rect.Height)); bezier3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.54338f * rect.Width, rect.GetMinY() + 0.48500f * rect.Height), new CGPoint(rect.GetMinX() + 0.53578f * rect.Width, rect.GetMinY() + 0.66000f * rect.Height), new CGPoint(rect.GetMinX() + 0.54338f * rect.Width, rect.GetMinY() + 0.48500f * rect.Height)); bezier3Path.ClosePath(); UIColor.Gray.SetFill(); bezier3Path.Fill(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 0.44500f * rect.Width, rect.GetMinY() + 0.49500f * rect.Height)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.32805f * rect.Width, rect.GetMinY() + 0.52500f * rect.Height)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.40115f * rect.Width, rect.GetMinY() + 0.69500f * rect.Height), new CGPoint(rect.GetMinX() + 0.32805f * rect.Width, rect.GetMinY() + 0.52500f * rect.Height), new CGPoint(rect.GetMinX() + 0.28420f * rect.Width, rect.GetMinY() + 0.69500f * rect.Height)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.44500f * rect.Width, rect.GetMinY() + 0.49500f * rect.Height), new CGPoint(rect.GetMinX() + 0.40845f * rect.Width, rect.GetMinY() + 0.59000f * rect.Height), new CGPoint(rect.GetMinX() + 0.44500f * rect.Width, rect.GetMinY() + 0.49500f * rect.Height)); bezier4Path.ClosePath(); UIColor.Gray.SetFill(); bezier4Path.Fill(); }
/* Returns a UIBezierPath object for the flat checkmark of the checkbox * @see BEMAnimationTypeFlat * @returns The path of the flat checkmark. */ public UIBezierPath PathForFlatCheckMark() { UIBezierPath flatCheckMarkPath = UIBezierPath.Create(); flatCheckMarkPath.MoveTo(new CGPoint(Size / 4, Size / 2)); flatCheckMarkPath.AddLineTo(new CGPoint(new CGPoint(Size / 2, Size / 2))); flatCheckMarkPath.AddLineTo(new CGPoint(new CGPoint(Size / 1.2, Size / 2))); return(flatCheckMarkPath); }
public override void CreatePath(Triangle shape, CGRect bounds) { using (var bezierPath = new UIBezierPath()) { bezierPath.MoveTo(shape.PointA.ToCGPointProp(bounds)); bezierPath.AddLineTo(shape.PointB.ToCGPointProp(bounds)); bezierPath.AddLineTo(shape.PointC.ToCGPointProp(bounds)); bezierPath.ClosePath(); Path = bezierPath.CGPath; } }
public Stream GetArcPartFromSquareImage(Stream ms, int partNumber, int nbParts) { Stream result = null; int diameter = 0; using (UIImage image = UIImage.LoadFromData(NSData.FromStream(ms))) { diameter = (int)image.Size.Width; } float arcAngle = 360 / nbParts; float arcStart = 90 + (partNumber - 1) * arcAngle; if (nbParts > 2) { arcStart += (180 / nbParts); } float x = (float)(diameter / 2 - ((diameter * Math.Cos(DegreeToRadian(arcStart + arcAngle / 2)) + diameter) / 2)) / 2; float y = (float)(diameter / 2 - ((diameter * Math.Sin(DegreeToRadian(arcStart + arcAngle / 2)) + diameter) / 2)) / 2; float startX = (float)((diameter * Math.Cos(DegreeToRadian(arcStart)) + diameter) / 2); float startY = (float)((diameter * Math.Sin(DegreeToRadian(arcStart)) + diameter) / 2); ms.Seek(0, SeekOrigin.Begin); Stream moved = GetTranslated(ms, -x, y); using (UIImage temp = UIImage.LoadFromData(NSData.FromStream(moved))) { UIGraphics.BeginImageContext(new SizeF(temp.CGImage.Width, temp.CGImage.Height)); using (UIBezierPath path = new UIBezierPath()) { path.MoveTo(new CGPoint(diameter / 2, diameter / 2)); path.AddLineTo(new CGPoint(startX, startY)); path.AddArc(new CGPoint(diameter / 2, diameter / 2), diameter / 2, DegreeToRadian(arcStart), DegreeToRadian(arcStart + arcAngle), true); path.AddLineTo(new CGPoint(diameter / 2, diameter / 2)); path.AddClip(); temp.Draw(new Rectangle(0, 0, (int)temp.CGImage.Width, (int)temp.CGImage.Height)); var resultImage = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); NSData data = resultImage.AsPNG(); result = data.AsStream(); } } return(result); }
public override void Draw(CGRect rect) { base.Draw(rect); Console.WriteLine("DrawingView draw!"); CGContext context = UIGraphics.GetCurrentContext(); // Create a path around the entire view UIBezierPath clipPath = UIBezierPath.FromRect(rect); // Add the transparent window to a sample rectangle CGRect sampleRect = new CGRect(0f, 0f, rect.Width, rect.Height); UIBezierPath path = UIBezierPath.FromRoundedRect(sampleRect, (System.nfloat)Device.CornerRadius); //Top left of notch path.MoveTo(new CGPoint(Device.NotchX - Device.NotchTopRadius, Device.NotchY)); //Curve into notch path.AddArc(new CGPoint(Device.NotchX - Device.NotchTopRadius, Device.NotchTopRadius), (System.nfloat)(Device.NotchY + Device.NotchTopRadius), Top, Right, true);//Angles in Radians, relative to 90deg //Left side of notch path.AddLineTo(new CGPoint(Device.NotchX, Device.NotchHeight - Device.NotchBottomRadius)); //Curve into bottom path.AddArc(new CGPoint(Device.NotchX + Device.NotchBottomRadius, Device.NotchY + Device.NotchHeight - Device.NotchBottomRadius), (System.nfloat)Device.NotchBottomRadius, Left, Bottom, false); //Bottom of notch path.AddLineTo(new CGPoint(Device.NotchX + Device.NotchWidth - Device.NotchBottomRadius, Device.NotchY + Device.NotchHeight)); //Curve into right path.AddArc(new CGPoint(Device.NotchX + Device.NotchWidth - Device.NotchBottomRadius, Device.NotchY + Device.NotchHeight - Device.NotchBottomRadius), (System.nfloat)Device.NotchBottomRadius, Bottom, Right, false); //Right side of nothc path.AddLineTo(new CGPoint(Device.NotchX + Device.NotchWidth, Device.NotchY + Device.NotchTopRadius)); //Curve out of notch path.AddArc(new CGPoint(Device.NotchX + Device.NotchWidth + Device.NotchTopRadius, Device.NotchTopRadius), (System.nfloat)(Device.NotchY + Device.NotchTopRadius), Left, Top, true); //finish path path.AddLineTo(new CGPoint(Device.NotchX - Device.NotchTopRadius, Device.NotchY)); path.ClosePath(); clipPath.AppendPath(path); // This sets the algorithm used to determine what gets filled and what doesn't clipPath.UsesEvenOddFillRule = true; context.SetFillColor(Device.NotchColor.ToUIColor().CGColor); clipPath.Fill(); }
public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { UITouch touch = touches.AnyObject as UITouch; //Obtain the location of the touch and add it to the current path and current_points array. CGPoint touchLocation = touch.LocationInView(this); currentPath.AddLineTo(touchLocation); currentPoints.Add(touchLocation); updateBounds(touchLocation); SetNeedsDisplayInRect(new CGRect(minX, minY, (nfloat)Math.Abs(maxX - minX), (nfloat)Math.Abs(maxY - minY))); }
//// Drawing Methods public static void DrawRefreshIcon(UIColor strokeColor) { //// Group 2 { //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(22.65f, 2.0f)); bezierPath.AddCurveToPoint(new CGPoint(36.33f, 7.67f), new CGPoint(27.6f, 2.0f), new CGPoint(32.55f, 3.89f)); bezierPath.AddCurveToPoint(new CGPoint(38.13f, 32.97f), new CGPoint(43.23f, 14.57f), new CGPoint(43.83f, 25.39f)); bezierPath.AddLineTo(new CGPoint(34.26f, 36.84f)); strokeColor.SetStroke(); bezierPath.LineWidth = 1.0f; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(21.35f, 42.0f)); bezier2Path.AddCurveToPoint(new CGPoint(7.67f, 36.33f), new CGPoint(16.4f, 42.0f), new CGPoint(11.45f, 40.11f)); bezier2Path.AddCurveToPoint(new CGPoint(5.87f, 11.03f), new CGPoint(0.77f, 29.43f), new CGPoint(0.17f, 18.61f)); bezier2Path.AddLineTo(new CGPoint(9.74f, 7.16f)); strokeColor.SetStroke(); bezier2Path.LineWidth = 1.0f; bezier2Path.Stroke(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new CGPoint(34.26f, 29.74f)); bezier3Path.AddLineTo(new CGPoint(34.26f, 36.84f)); bezier3Path.AddLineTo(new CGPoint(41.35f, 36.84f)); bezier3Path.LineJoinStyle = CGLineJoin.Bevel; strokeColor.SetStroke(); bezier3Path.LineWidth = 1.0f; bezier3Path.Stroke(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(9.74f, 14.26f)); bezier4Path.AddLineTo(new CGPoint(9.74f, 7.16f)); bezier4Path.AddLineTo(new CGPoint(2.65f, 7.16f)); bezier4Path.LineJoinStyle = CGLineJoin.Bevel; strokeColor.SetStroke(); bezier4Path.LineWidth = 1.0f; bezier4Path.Stroke(); } }
public static UIBezierPath MakeCheckmarkPath(CGRect withFrame) { var path = new UIBezierPath(); nfloat minX = withFrame.GetMinX(); nfloat minY = withFrame.GetMinY(); nfloat width = withFrame.Width; nfloat height = withFrame.Height; path.MoveTo(new CGPoint(minX + 0.07692 * width, minY + 0.57143 * height)); path.AddLineTo(new CGPoint(minX + 0.30769 * width, minY + 0.85714 * height)); path.AddLineTo(new CGPoint(minX + 0.92308 * width, minY + 0.09524 * height)); path.LineWidth = 2; return(path); }
private CGPath GetShadowPath(CGRect biggerRect) { var shadowPath = new UIBezierPath(); shadowPath.MoveTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY())); shadowPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMaxY())); shadowPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMaxY())); shadowPath.AddLineTo(new CGPoint(biggerRect.GetMaxX(), biggerRect.GetMinY())); shadowPath.AddLineTo(new CGPoint(biggerRect.GetMinX(), biggerRect.GetMinY()));; shadowPath.AppendPath(UIBezierPath.FromRoundedRect(Bounds, RadiusCorner)); shadowPath.UsesEvenOddFillRule = true; return(shadowPath.CGPath); }
static void paintCodeNonRetina() { //// Color Declarations UIColor color2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(22.72f, 5.43f)); bezierPath.AddCurveToPoint(new PointF(23.37f, 6.19f), new PointF(22.95f, 5.67f), new PointF(23.17f, 5.93f)); bezierPath.AddCurveToPoint(new PointF(27.47f, 4.67f), new PointF(24.63f, 5.42f), new PointF(26.03f, 4.91f)); bezierPath.AddCurveToPoint(new PointF(37.28f, 7.43f), new PointF(30.92f, 4.09f), new PointF(34.61f, 5.01f)); bezierPath.AddCurveToPoint(new PointF(37.28f, 21.57f), new PointF(41.57f, 11.33f), new PointF(41.57f, 17.67f)); bezierPath.AddCurveToPoint(new PointF(27.49f, 24.33f), new PointF(34.62f, 23.99f), new PointF(30.93f, 24.91f)); bezierPath.AddCurveToPoint(new PointF(24.72f, 29.3f), new PointF(27.39f, 26.14f), new PointF(26.47f, 27.92f)); bezierPath.AddCurveToPoint(new PointF(11.28f, 29.3f), new PointF(21.01f, 32.23f), new PointF(14.99f, 32.23f)); bezierPath.AddCurveToPoint(new PointF(9.86f, 20.13f), new PointF(8.13f, 26.82f), new PointF(7.66f, 23.01f)); bezierPath.AddCurveToPoint(new PointF(9.28f, 19.57f), new PointF(9.66f, 19.95f), new PointF(9.47f, 19.77f)); bezierPath.AddCurveToPoint(new PointF(9.28f, 5.43f), new PointF(5.57f, 15.67f), new PointF(5.57f, 9.33f)); bezierPath.AddCurveToPoint(new PointF(22.72f, 5.43f), new PointF(12.99f, 1.52f), new PointF(19.01f, 1.52f)); bezierPath.ClosePath(); UIColor.White.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 1; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(3.5f, 40.5f)); bezier2Path.AddCurveToPoint(new PointF(9.5f, 33.5f), new PointF(9.5f, 33.5f), new PointF(9.5f, 33.5f)); color2.SetFill(); bezier2Path.Fill(); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 2.5f; bezier2Path.Stroke(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new PointF(6.5f, 32.5f)); bezier3Path.AddLineTo(new PointF(11.5f, 37.5f)); bezier3Path.AddLineTo(new PointF(10.5f, 32.5f)); bezier3Path.AddLineTo(new PointF(6.5f, 32.5f)); bezier3Path.ClosePath(); color2.SetFill(); bezier3Path.Fill(); UIColor.Black.SetStroke(); bezier3Path.LineWidth = 1; bezier3Path.Stroke(); }
// To intermix custom drawing with the drawing performed by an associated print formatter, // this method is called for each print formatter associated with a given page. // // We do this to intermix/overlay our custom drawing onto the recipe presentation. // We draw the upper portion of the recipe presentation by hand (image, title, desc), // and the bottom portion is drawn via the UIMarkupTextPrintFormatter. public override void DrawPrintFormatterForPage(UIPrintFormatter printFormatter, int page) { base.DrawPrintFormatterForPage(printFormatter, page); // To keep our custom drawing in sync with the printFormatter, base our drawing // on the formatters rect. RectangleF rect = printFormatter.RectangleForPage(page); // Use a bezier path to draw the borders. // We may potentially choose not to draw either the top or bottom line // of the border depending on whether our recipe extended from the previous // page, or carries onto the subsequent page. UIBezierPath border = new UIBezierPath(); if (page == printFormatter.StartPage) { // For border drawing, get the rect that includes the formatter area plus the header area. // Move the formatter's rect up the size of the custom drawn recipe presentation // and essentially grow the rect's height by this amount. rect.Height += RecipeInfoHeight; rect.Y -= RecipeInfoHeight; border.MoveTo(rect.Location); border.AddLineTo(new PointF(rect.Right, rect.Top)); Recipe recipe = recipeFormatterMap[printFormatter]; // Run custom code to draw upper portion of the recipe presentation (image, title, desc) DrawRecipe(recipe, rect); } // Draw the left border border.MoveTo(rect.Location); border.AddLineTo(new PointF(rect.Left, rect.Bottom)); // Draw the right border border.MoveTo(new PointF(rect.Right, rect.Top)); border.AddLineTo(new PointF(rect.Right, rect.Bottom)); if (page == printFormatter.StartPage + printFormatter.PageCount - 1) { border.AddLineTo(new PointF(rect.Left, rect.Bottom)); } // Set the UIColor to be used by the current graphics context, and then stroke // stroke the current path that is defined by the border bezier path. UIColor.Black.SetColor(); border.Stroke(); }
void DrawQuadrangle(CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3, CALayer layer, RTRResultStabilityStatus progress) { var area = new CAShapeLayer(); var recognizedAreaPath = new UIBezierPath(); recognizedAreaPath.MoveTo(p0); recognizedAreaPath.AddLineTo(p1); recognizedAreaPath.AddLineTo(p2); recognizedAreaPath.AddLineTo(p3); recognizedAreaPath.ClosePath(); area.Path = recognizedAreaPath.CGPath; area.StrokeColor = ProgressColor(progress).CGColor; area.FillColor = UIColor.Clear.CGColor; layer.AddSublayer(area); }
public override void Draw(RectangleF rect) { TintColor.SetColor (); RectangleF bounds = Bounds; float x = bounds.Right - LineWidth; for (int n = 0; n < Count; n++) { x -= LineMargin; if ((n + 1) % LineGroupCount == 0) { UIBezierPath path = new UIBezierPath (); path.MoveTo ( new PointF (x + 0.5f * LineWidth, bounds.Top + 0.5f * LineWidth)); path.AddLineTo ( new PointF (x + 0.5f * LineWidth + LineGroupCount * LineMargin, bounds.Bottom - 0.5f * LineWidth)); path.Stroke (); } else { RectangleF lineRect = bounds; lineRect.X = x; lineRect.Width = LineWidth; UIGraphics.RectFill (lineRect); } } }
public override void Draw (RectangleF rect) { rect = RectangleF.Inflate (rect, 4, 4); rect = new RectangleF ((rect.Size.Width - rect.Size.Height) / 2 + 4, 8, rect.Size.Height, rect.Size.Height); UIBezierPath path = UIBezierPath.FromOval (rect); UIColor.Black.SetStroke (); UIColor.White.SetFill (); path.LineWidth = 2; path.Fill (); path.Stroke (); UIBezierPath rightEye, leftEye, mouth = new UIBezierPath (); if (MovingRight) { rightEye = UIBezierPath.FromArc (new PointF (rect.GetMidX () - 5, rect.Y + 15), 4, 0, 180, true); leftEye = UIBezierPath.FromArc (new PointF (rect.GetMidX () + 10, rect.Y + 15), 4, 0, 180, true); mouth.MoveTo (new PointF (rect.GetMidX (), rect.Y + 30)); mouth.AddLineTo (new PointF (rect.GetMidX () + 13, rect.Y + 30)); } else { rightEye = UIBezierPath.FromArc (new PointF (rect.GetMidX () - 10, rect.Y + 15), 4, 0, 180, true); leftEye = UIBezierPath.FromArc (new PointF (rect.GetMidX () - 10, rect.Y + 15), 4, 0, 180, true); mouth.MoveTo (new PointF (rect.GetMidX (), rect.Y + 30)); mouth.MoveTo (new PointF (rect.GetMidX (), rect.Y + 30)); } rightEye.LineWidth = 2; rightEye.Stroke (); leftEye.LineWidth = 2; leftEye.Stroke (); mouth.LineWidth = 2; mouth.Stroke (); }
public static UIImage MakeBackArrow() { bool retina = (UIScreen.MainScreen.Scale > 1.0); if (retina) { UIGraphics.BeginImageContext (new System.Drawing.SizeF (44, 44)); //BEGIN PAINTCODE RETINA //// Color Declarations UIColor gradient2Color = UIColor.FromRGBA(0.018f, 0.324f, 0.969f, 1.000f); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new PointF(14.5f, 16.31f)); bezier5Path.AddLineTo(new PointF(39.5f, 16.31f)); bezier5Path.AddLineTo(new PointF(39.5f, 26.69f)); bezier5Path.AddLineTo(new PointF(14.5f, 26.69f)); bezier5Path.AddLineTo(new PointF(14.5f, 41.5f)); bezier5Path.AddLineTo(new PointF(2.5f, 20.32f)); bezier5Path.AddLineTo(new PointF(14.5f, 1.5f)); bezier5Path.AddLineTo(new PointF(14.5f, 16.31f)); bezier5Path.ClosePath(); gradient2Color.SetFill(); bezier5Path.Fill(); gradient2Color.SetStroke(); bezier5Path.LineWidth = 1; bezier5Path.Stroke(); //END PAINTCODE RETINA } else { UIGraphics.BeginImageContext (new System.Drawing.SizeF (22, 22)); //start paintcode NON RETINA //// Color Declarations UIColor gradient2Color = UIColor.FromRGBA(0.018f, 0.324f, 0.969f, 1.000f); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new PointF(7.99f, 8.91f)); bezier5Path.AddLineTo(new PointF(21.5f, 8.91f)); bezier5Path.AddLineTo(new PointF(21.5f, 14.09f)); bezier5Path.AddLineTo(new PointF(7.99f, 14.09f)); bezier5Path.AddLineTo(new PointF(7.5f, 20.5f)); bezier5Path.AddLineTo(new PointF(1.5f, 10.91f)); bezier5Path.AddLineTo(new PointF(7.99f, 1.5f)); bezier5Path.AddLineTo(new PointF(7.99f, 8.91f)); bezier5Path.ClosePath(); gradient2Color.SetFill(); bezier5Path.Fill(); gradient2Color.SetStroke(); bezier5Path.LineWidth = 1; bezier5Path.Stroke(); //END PAINTCODE NON RETINA } var converted = UIGraphics.GetImageFromCurrentImageContext (); UIGraphics.EndImageContext (); return converted; }
public override void DrawRect (System.Drawing.RectangleF area, UIViewPrintFormatter formatter) { base.DrawRect (area, formatter); CGContext context = UIGraphics.GetCurrentContext (); UIColor shadow; shadow = UIColor.Clear; UIColor chevronColor = this.Color; SizeF shadowOffset = new SizeF (0.1F, 1.1F); Single shadowBlurRadius = 0F; RectangleF frame = new RectangleF (this.Bounds.X, this.Bounds.Y, this.Bounds.Width, this.Bounds.Height); UIBezierPath chevronPath = new UIBezierPath (); chevronPath.MoveTo (new PointF (frame.GetMinX () + 0.22000F * frame.Width, frame.GetMinY () + 0.01667F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.98000F * frame.Width, frame.GetMinY() + 0.48333F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.22000F * frame.Width, frame.GetMinY() + 0.98333F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.02000F * frame.Width, frame.GetMinY() + 0.81667F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.54000F * frame.Width, frame.GetMinY() + 0.48333F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.02000F * frame.Width, frame.GetMinY() + 0.15000F * frame.Height)); chevronPath.AddLineTo (new PointF (frame.GetMinX() + 0.22000F * frame.Width, frame.GetMinY() + 0.01667F * frame.Height)); chevronPath.ClosePath (); context.SaveState (); context.SetShadowWithColor (shadowOffset, shadowBlurRadius, shadow.CGColor); chevronColor.SetFill (); chevronPath.Fill (); context.RestoreState (); }
static void paintCodeNonRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); UIColor color2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); //// Group { //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(15.05f, 2.27f)); bezierPath.AddLineTo(new PointF(7.17f, 12.34f)); bezierPath.AddCurveToPoint(new PointF(11.5f, 4.39f), new PointF(7.17f, 12.34f), new PointF(9.53f, 6.9f)); bezierPath.AddCurveToPoint(new PointF(15.05f, 2.27f), new PointF(13.47f, 1.87f), new PointF(15.05f, 2.27f)); color.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 1; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(7.56f, 12.87f)); bezier2Path.AddCurveToPoint(new PointF(17.8f, 5.98f), new PointF(7.56f, 12.87f), new PointF(17.82f, 5.8f)); bezier2Path.AddCurveToPoint(new PointF(16.62f, 8.1f), new PointF(17.78f, 6.15f), new PointF(18.68f, 5.93f)); bezier2Path.AddCurveToPoint(new PointF(7.56f, 12.87f), new PointF(14.56f, 10.26f), new PointF(7.56f, 12.87f)); bezier2Path.ClosePath(); color.SetFill(); bezier2Path.Fill(); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 1; bezier2Path.Stroke(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(5.5f, 12.5f, 4, 5)); color2.SetFill(); oval2Path.Fill(); UIColor.Black.SetStroke(); oval2Path.LineWidth = 2; oval2Path.Stroke(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new RectangleF(3.5f, 9.5f, 4, 5)); color2.SetFill(); ovalPath.Fill(); UIColor.Black.SetStroke(); ovalPath.LineWidth = 2; ovalPath.Stroke(); } }
static void paintCodeRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.219f, 0.657f, 1.000f); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(1.5f, 1.5f)); bezierPath.AddCurveToPoint(new PointF(40.5f, 41.5f), new PointF(40.5f, 41.5f), new PointF(40.5f, 41.5f)); color.SetStroke(); bezierPath.LineWidth = 4; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(40.5f, 1.5f)); bezier2Path.AddLineTo(new PointF(1.5f, 42.5f)); color.SetStroke(); bezier2Path.LineWidth = 4; bezier2Path.Stroke(); }
public static UIImage MakeFlosshatt() { bool retina = (UIScreen.MainScreen.Scale > 1.0); if (retina) { UIGraphics.BeginImageContext (new System.Drawing.SizeF (96, 64)); ///BEGIN PAINTCODE RETINA //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations UIColor shadowColor2 = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 0.454f); UIColor color4 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Shadow Declarations var shadow = shadowColor2.ColorWithAlpha(0.5f).CGColor; var shadowOffset = new SizeF(0.1f, -1.1f); var shadowBlurRadius = 10; //// Group { //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(20.5f, 15.5f, 0, 0)); color4.SetFill(); rectanglePath.Fill(); color4.SetStroke(); rectanglePath.LineWidth = 1; rectanglePath.Stroke(); //// Rectangle 2 Drawing UIBezierPath rectangle2Path = new UIBezierPath(); rectangle2Path.MoveTo(new PointF(20.72f, 49.5f)); rectangle2Path.AddCurveToPoint(new PointF(45.5f, 54.5f), new PointF(20.72f, 49.5f), new PointF(32.97f, 54.5f)); rectangle2Path.AddCurveToPoint(new PointF(70.84f, 49.5f), new PointF(58.03f, 54.5f), new PointF(70.84f, 49.5f)); rectangle2Path.AddLineTo(new PointF(70.5f, 9.5f)); rectangle2Path.AddCurveToPoint(new PointF(59.27f, 15), new PointF(70.5f, 9.5f), new PointF(68.43f, 13.56f)); rectangle2Path.AddCurveToPoint(new PointF(34.21f, 15), new PointF(50.12f, 16.44f), new PointF(41.85f, 15.58f)); rectangle2Path.AddCurveToPoint(new PointF(20.72f, 9.25f), new PointF(26.58f, 14.41f), new PointF(20.72f, 9.25f)); rectangle2Path.AddLineTo(new PointF(20.72f, 49.5f)); rectangle2Path.ClosePath(); color4.SetFill(); rectangle2Path.Fill(); ////// Rectangle 2 Inner Shadow var rectangle2BorderRect = rectangle2Path.Bounds; rectangle2BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle2BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle2BorderRect = RectangleF.Union(rectangle2BorderRect, rectangle2Path.Bounds); rectangle2BorderRect.Inflate(1, 1); var rectangle2NegativePath = UIBezierPath.FromRect(rectangle2BorderRect); rectangle2NegativePath.AppendPath(rectangle2Path); rectangle2NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle2BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle2Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle2BorderRect.Width), 0); rectangle2NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle2NegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); rectangle2Path.LineWidth = 1; rectangle2Path.Stroke(); //// Oval Drawing UIBezierPath ovalPath = new UIBezierPath(); ovalPath.MoveTo(new PointF(41.75f, 29.14f)); ovalPath.AddCurveToPoint(new PointF(41.75f, 29.14f), new PointF(41.64f, 28.93f), new PointF(41.75f, 29.14f)); ovalPath.AddCurveToPoint(new PointF(41.75f, 29.14f), new PointF(41.75f, 29.14f), new PointF(41.85f, 29.34f)); ovalPath.ClosePath(); ovalPath.MoveTo(new PointF(71.09f, 40.78f)); ovalPath.AddCurveToPoint(new PointF(85.5f, 53.5f), new PointF(71.09f, 40.78f), new PointF(90.3f, 44.46f)); ovalPath.AddCurveToPoint(new PointF(71.5f, 60.5f), new PointF(83.59f, 57.1f), new PointF(79.87f, 58.44f)); ovalPath.AddCurveToPoint(new PointF(43.5f, 63.5f), new PointF(68.37f, 61.27f), new PointF(55.33f, 63.35f)); ovalPath.AddCurveToPoint(new PointF(19.98f, 60.61f), new PointF(32.61f, 63.64f), new PointF(22.5f, 61.09f)); ovalPath.AddCurveToPoint(new PointF(6.48f, 53.09f), new PointF(14.84f, 59.63f), new PointF(6.96f, 54.65f)); ovalPath.AddCurveToPoint(new PointF(19.98f, 40.78f), new PointF(5.15f, 48.79f), new PointF(10.39f, 43.13f)); ovalPath.AddLineTo(new PointF(19.98f, 49.64f)); ovalPath.AddCurveToPoint(new PointF(45.5f, 53.5f), new PointF(19.98f, 49.64f), new PointF(32.72f, 53.5f)); ovalPath.AddCurveToPoint(new PointF(71.09f, 49.64f), new PointF(58.28f, 53.5f), new PointF(71.09f, 49.64f)); ovalPath.AddLineTo(new PointF(71.09f, 40.78f)); ovalPath.ClosePath(); ovalPath.MiterLimit = 6; color4.SetFill(); ovalPath.Fill(); ////// Oval Inner Shadow var ovalBorderRect = ovalPath.Bounds; ovalBorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); ovalBorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); ovalBorderRect = RectangleF.Union(ovalBorderRect, ovalPath.Bounds); ovalBorderRect.Inflate(1, 1); var ovalNegativePath = UIBezierPath.FromRect(ovalBorderRect); ovalNegativePath.AppendPath(ovalPath); ovalNegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(ovalBorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); ovalPath.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(ovalBorderRect.Width), 0); ovalNegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); ovalNegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); ovalPath.LineWidth = 1; ovalPath.Stroke(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(20.5f, 3.5f, 50, 12)); color4.SetFill(); oval2Path.Fill(); ////// Oval 2 Inner Shadow var oval2BorderRect = oval2Path.Bounds; oval2BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); oval2BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); oval2BorderRect = RectangleF.Union(oval2BorderRect, oval2Path.Bounds); oval2BorderRect.Inflate(1, 1); var oval2NegativePath = UIBezierPath.FromRect(oval2BorderRect); oval2NegativePath.AppendPath(oval2Path); oval2NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(oval2BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); oval2Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(oval2BorderRect.Width), 0); oval2NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); oval2NegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); oval2Path.LineWidth = 1; oval2Path.Stroke(); } // END PAINTCODE RETINA } else { UIGraphics.BeginImageContext (new System.Drawing.SizeF (48, 32)); //start paintcode //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations UIColor shadowColor2 = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 0.454f); UIColor color4 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Shadow Declarations var shadow = shadowColor2.ColorWithAlpha(0.5f).CGColor; var shadowOffset = new SizeF(0.1f, -1.1f); var shadowBlurRadius = 10; //// Group { //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(10.5f, 7.5f, 0, 0)); color4.SetFill(); rectanglePath.Fill(); color4.SetStroke(); rectanglePath.LineWidth = 1; rectanglePath.Stroke(); //// Rectangle 2 Drawing UIBezierPath rectangle2Path = new UIBezierPath(); rectangle2Path.MoveTo(new PointF(9.81f, 24.87f)); rectangle2Path.AddCurveToPoint(new PointF(22.97f, 27.33f), new PointF(9.81f, 24.87f), new PointF(16.32f, 27.33f)); rectangle2Path.AddCurveToPoint(new PointF(36.42f, 24.87f), new PointF(29.62f, 27.33f), new PointF(36.42f, 24.87f)); rectangle2Path.AddLineTo(new PointF(36.24f, 5.2f)); rectangle2Path.AddCurveToPoint(new PointF(30.28f, 7.9f), new PointF(36.24f, 5.2f), new PointF(35.14f, 7.19f)); rectangle2Path.AddCurveToPoint(new PointF(16.98f, 7.9f), new PointF(25.42f, 8.61f), new PointF(21.03f, 8.19f)); rectangle2Path.AddCurveToPoint(new PointF(9.81f, 5.07f), new PointF(12.92f, 7.61f), new PointF(9.81f, 5.07f)); rectangle2Path.AddLineTo(new PointF(9.81f, 24.87f)); rectangle2Path.ClosePath(); color4.SetFill(); rectangle2Path.Fill(); ////// Rectangle 2 Inner Shadow var rectangle2BorderRect = rectangle2Path.Bounds; rectangle2BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle2BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle2BorderRect = RectangleF.Union(rectangle2BorderRect, rectangle2Path.Bounds); rectangle2BorderRect.Inflate(1, 1); var rectangle2NegativePath = UIBezierPath.FromRect(rectangle2BorderRect); rectangle2NegativePath.AppendPath(rectangle2Path); rectangle2NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle2BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle2Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle2BorderRect.Width), 0); rectangle2NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle2NegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); rectangle2Path.LineWidth = 1; rectangle2Path.Stroke(); //// Oval Drawing UIBezierPath ovalPath = new UIBezierPath(); ovalPath.MoveTo(new PointF(20.98f, 14.86f)); ovalPath.AddCurveToPoint(new PointF(20.98f, 14.86f), new PointF(20.92f, 14.75f), new PointF(20.98f, 14.86f)); ovalPath.AddCurveToPoint(new PointF(20.98f, 14.86f), new PointF(20.98f, 14.86f), new PointF(21.03f, 14.96f)); ovalPath.ClosePath(); ovalPath.MoveTo(new PointF(36.56f, 20.58f)); ovalPath.AddCurveToPoint(new PointF(44.2f, 26.84f), new PointF(36.56f, 20.58f), new PointF(46.75f, 22.39f)); ovalPath.AddCurveToPoint(new PointF(36.77f, 30.28f), new PointF(43.19f, 28.61f), new PointF(41.21f, 29.27f)); ovalPath.AddCurveToPoint(new PointF(21.91f, 31.75f), new PointF(35.11f, 30.66f), new PointF(28.18f, 31.68f)); ovalPath.AddCurveToPoint(new PointF(9.42f, 30.33f), new PointF(16.13f, 31.82f), new PointF(10.76f, 30.57f)); ovalPath.AddCurveToPoint(new PointF(2.25f, 26.63f), new PointF(6.69f, 29.85f), new PointF(2.51f, 27.4f)); ovalPath.AddCurveToPoint(new PointF(9.42f, 20.58f), new PointF(1.55f, 24.52f), new PointF(4.33f, 21.73f)); ovalPath.AddLineTo(new PointF(9.42f, 24.94f)); ovalPath.AddCurveToPoint(new PointF(22.97f, 26.84f), new PointF(9.42f, 24.94f), new PointF(16.19f, 26.84f)); ovalPath.AddCurveToPoint(new PointF(36.56f, 24.94f), new PointF(29.75f, 26.84f), new PointF(36.56f, 24.94f)); ovalPath.AddLineTo(new PointF(36.56f, 20.58f)); ovalPath.ClosePath(); ovalPath.MiterLimit = 6; color4.SetFill(); ovalPath.Fill(); ////// Oval Inner Shadow var ovalBorderRect = ovalPath.Bounds; ovalBorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); ovalBorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); ovalBorderRect = RectangleF.Union(ovalBorderRect, ovalPath.Bounds); ovalBorderRect.Inflate(1, 1); var ovalNegativePath = UIBezierPath.FromRect(ovalBorderRect); ovalNegativePath.AppendPath(ovalPath); ovalNegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(ovalBorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); ovalPath.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(ovalBorderRect.Width), 0); ovalNegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); ovalNegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); ovalPath.LineWidth = 1; ovalPath.Stroke(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(10.5f, 2.5f, 25, 5)); color4.SetFill(); oval2Path.Fill(); ////// Oval 2 Inner Shadow var oval2BorderRect = oval2Path.Bounds; oval2BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); oval2BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); oval2BorderRect = RectangleF.Union(oval2BorderRect, oval2Path.Bounds); oval2BorderRect.Inflate(1, 1); var oval2NegativePath = UIBezierPath.FromRect(oval2BorderRect); oval2NegativePath.AppendPath(oval2Path); oval2NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(oval2BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); oval2Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(oval2BorderRect.Width), 0); oval2NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); oval2NegativePath.Fill(); } context.RestoreState(); color4.SetStroke(); oval2Path.LineWidth = 1; oval2Path.Stroke(); } // END PAINTCODE } var converted = UIGraphics.GetImageFromCurrentImageContext (); UIGraphics.EndImageContext (); return converted; }
void DrawFilledShape() { var bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(41.35f, 17.47f)); bezierPath.AddLineTo(new PointF(39.61f, 17.47f)); bezierPath.AddCurveToPoint(new PointF(36.99f, 14.79f), new PointF(38.18f, 17.47f), new PointF(36.99f, 16.24f)); bezierPath.AddCurveToPoint(new PointF(37.85f, 12.9f), new PointF(36.99f, 14.06f), new PointF(37.3f, 13.39f)); bezierPath.AddLineTo(new PointF(38.98f, 11.8f)); bezierPath.AddCurveToPoint(new PointF(38.98f, 7.8f), new PointF(40.09f, 10.7f), new PointF(40.09f, 8.9f)); bezierPath.AddLineTo(new PointF(36.42f, 5.27f)); bezierPath.AddCurveToPoint(new PointF(34.41f, 4.47f), new PointF(35.91f, 4.77f), new PointF(35.17f, 4.47f)); bezierPath.AddCurveToPoint(new PointF(32.4f, 5.27f), new PointF(33.65f, 4.47f), new PointF(32.92f, 4.77f)); bezierPath.AddLineTo(new PointF(31.33f, 6.35f)); bezierPath.AddCurveToPoint(new PointF(29.38f, 7.23f), new PointF(30.81f, 6.92f), new PointF(30.12f, 7.23f)); bezierPath.AddCurveToPoint(new PointF(26.68f, 4.63f), new PointF(27.91f, 7.23f), new PointF(26.68f, 6.04f)); bezierPath.AddLineTo(new PointF(26.68f, 2.88f)); bezierPath.AddCurveToPoint(new PointF(23.86f, 0), new PointF(26.68f, 1.33f), new PointF(25.42f, 0)); bezierPath.AddLineTo(new PointF(20.38f, 0)); bezierPath.AddCurveToPoint(new PointF(17.58f, 2.88f), new PointF(18.82f, 0), new PointF(17.58f, 1.32f)); bezierPath.AddLineTo(new PointF(17.58f, 4.62f)); bezierPath.AddCurveToPoint(new PointF(14.89f, 7.22f), new PointF(17.58f, 6.03f), new PointF(16.36f, 7.22f)); bezierPath.AddCurveToPoint(new PointF(12.98f, 6.37f), new PointF(14.15f, 7.22f), new PointF(13.48f, 6.91f)); bezierPath.AddLineTo(new PointF(11.87f, 5.27f)); bezierPath.AddCurveToPoint(new PointF(9.86f, 4.47f), new PointF(11.37f, 4.75f), new PointF(10.62f, 4.47f)); bezierPath.AddCurveToPoint(new PointF(7.86f, 5.27f), new PointF(9.11f, 4.47f), new PointF(8.37f, 4.77f)); bezierPath.AddLineTo(new PointF(5.28f, 7.79f)); bezierPath.AddCurveToPoint(new PointF(5.28f, 11.78f), new PointF(4.18f, 8.89f), new PointF(4.18f, 10.69f)); bezierPath.AddLineTo(new PointF(6.35f, 12.85f)); bezierPath.AddCurveToPoint(new PointF(7.25f, 14.79f), new PointF(6.93f, 13.37f), new PointF(7.25f, 14.06f)); bezierPath.AddCurveToPoint(new PointF(4.63f, 17.47f), new PointF(7.25f, 16.26f), new PointF(6.06f, 17.47f)); bezierPath.AddLineTo(new PointF(2.89f, 17.47f)); bezierPath.AddCurveToPoint(new PointF(0, 20.25f), new PointF(1.32f, 17.47f), new PointF(0, 18.7f)); bezierPath.AddLineTo(new PointF(0, 21.99f)); bezierPath.AddLineTo(new PointF(0, 23.74f)); bezierPath.AddCurveToPoint(new PointF(2.89f, 26.52f), new PointF(0, 25.28f), new PointF(1.32f, 26.52f)); bezierPath.AddLineTo(new PointF(4.63f, 26.52f)); bezierPath.AddCurveToPoint(new PointF(7.25f, 29.2f), new PointF(6.06f, 26.52f), new PointF(7.25f, 27.74f)); bezierPath.AddCurveToPoint(new PointF(6.35f, 31.14f), new PointF(7.25f, 29.93f), new PointF(6.93f, 30.62f)); bezierPath.AddLineTo(new PointF(5.28f, 32.2f)); bezierPath.AddCurveToPoint(new PointF(5.28f, 36.19f), new PointF(4.18f, 33.3f), new PointF(4.18f, 35.1f)); bezierPath.AddLineTo(new PointF(7.83f, 38.73f)); bezierPath.AddCurveToPoint(new PointF(9.84f, 39.53f), new PointF(8.34f, 39.25f), new PointF(9.08f, 39.53f)); bezierPath.AddCurveToPoint(new PointF(11.85f, 38.73f), new PointF(10.6f, 39.53f), new PointF(11.33f, 39.23f)); bezierPath.AddLineTo(new PointF(12.96f, 37.63f)); bezierPath.AddCurveToPoint(new PointF(14.87f, 36.78f), new PointF(13.44f, 37.09f), new PointF(14.13f, 36.78f)); bezierPath.AddCurveToPoint(new PointF(17.56f, 39.38f), new PointF(16.33f, 36.78f), new PointF(17.56f, 37.97f)); bezierPath.AddLineTo(new PointF(17.56f, 41.12f)); bezierPath.AddCurveToPoint(new PointF(20.37f, 44), new PointF(17.56f, 42.67f), new PointF(18.8f, 44)); bezierPath.AddLineTo(new PointF(23.86f, 44)); bezierPath.AddCurveToPoint(new PointF(26.66f, 41.12f), new PointF(25.42f, 44), new PointF(26.66f, 42.68f)); bezierPath.AddLineTo(new PointF(26.66f, 39.38f)); bezierPath.AddCurveToPoint(new PointF(29.35f, 36.78f), new PointF(26.66f, 37.97f), new PointF(27.88f, 36.78f)); bezierPath.AddCurveToPoint(new PointF(31.3f, 37.67f), new PointF(30.09f, 36.78f), new PointF(30.77f, 37.1f)); bezierPath.AddLineTo(new PointF(32.38f, 38.74f)); bezierPath.AddCurveToPoint(new PointF(34.39f, 39.54f), new PointF(32.9f, 39.25f), new PointF(33.63f, 39.54f)); bezierPath.AddCurveToPoint(new PointF(36.39f, 38.74f), new PointF(35.14f, 39.54f), new PointF(35.88f, 39.25f)); bezierPath.AddLineTo(new PointF(38.95f, 36.2f)); bezierPath.AddCurveToPoint(new PointF(38.95f, 32.2f), new PointF(40.05f, 35.1f), new PointF(40.05f, 33.3f)); bezierPath.AddLineTo(new PointF(37.83f, 31.1f)); bezierPath.AddCurveToPoint(new PointF(36.97f, 29.21f), new PointF(37.28f, 30.61f), new PointF(36.97f, 29.93f)); bezierPath.AddCurveToPoint(new PointF(39.58f, 26.53f), new PointF(36.97f, 27.74f), new PointF(38.16f, 26.53f)); bezierPath.AddLineTo(new PointF(41.33f, 26.53f)); bezierPath.AddCurveToPoint(new PointF(44, 23.75f), new PointF(42.89f, 26.53f), new PointF(44, 25.3f)); bezierPath.AddLineTo(new PointF(44, 21.99f)); bezierPath.AddLineTo(new PointF(44, 20.25f)); bezierPath.AddCurveToPoint(new PointF(41.35f, 17.47f), new PointF(44.02f, 18.7f), new PointF(42.91f, 17.47f)); bezierPath.ClosePath(); bezierPath.MoveTo(new PointF(31.29f, 21.99f)); bezierPath.AddLineTo(new PointF(31.29f, 21.99f)); bezierPath.AddCurveToPoint(new PointF(22.11f, 31.16f), new PointF(31.29f, 27.05f), new PointF(27.2f, 31.16f)); bezierPath.AddCurveToPoint(new PointF(12.94f, 21.99f), new PointF(17.03f, 31.16f), new PointF(12.94f, 27.05f)); bezierPath.AddLineTo(new PointF(12.94f, 21.99f)); bezierPath.AddLineTo(new PointF(12.94f, 21.99f)); bezierPath.AddCurveToPoint(new PointF(22.11f, 12.83f), new PointF(12.94f, 16.94f), new PointF(17.03f, 12.83f)); bezierPath.AddCurveToPoint(new PointF(31.29f, 21.99f), new PointF(27.2f, 12.83f), new PointF(31.29f, 16.94f)); bezierPath.AddLineTo(new PointF(31.29f, 21.99f)); bezierPath.ClosePath(); bezierPath.MiterLimit = 4; DefaultFillColor.SetColor (); bezierPath.Fill (); }
void drawBorder() { UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(22.09f, 10.97f)); bezierPath.AddCurveToPoint(new PointF(14.31f, 14.18f), new PointF(19.15f, 10.97f), new PointF(16.39f, 12.11f)); bezierPath.AddCurveToPoint(new PointF(11.09f, 21.94f), new PointF(12.24f, 16.25f), new PointF(11.09f, 19.01f)); bezierPath.AddCurveToPoint(new PointF(14.31f, 29.7f), new PointF(11.09f, 24.88f), new PointF(12.24f, 27.62f)); bezierPath.AddCurveToPoint(new PointF(22.09f, 32.91f), new PointF(16.39f, 31.77f), new PointF(19.16f, 32.91f)); bezierPath.AddCurveToPoint(new PointF(29.87f, 29.7f), new PointF(25.04f, 32.91f), new PointF(27.8f, 31.77f)); bezierPath.AddCurveToPoint(new PointF(33.09f, 21.94f), new PointF(31.95f, 27.63f), new PointF(33.09f, 24.88f)); bezierPath.AddCurveToPoint(new PointF(29.87f, 14.18f), new PointF(33.09f, 19.01f), new PointF(31.95f, 16.26f)); bezierPath.AddCurveToPoint(new PointF(22.09f, 10.97f), new PointF(27.8f, 12.11f), new PointF(25.04f, 10.97f)); bezierPath.ClosePath(); bezierPath.MoveTo(new PointF(22.09f, 31.09f)); bezierPath.AddCurveToPoint(new PointF(12.92f, 21.94f), new PointF(17.02f, 31.09f), new PointF(12.92f, 26.98f)); bezierPath.AddCurveToPoint(new PointF(22.09f, 12.8f), new PointF(12.92f, 16.9f), new PointF(17.02f, 12.8f)); bezierPath.AddCurveToPoint(new PointF(31.26f, 21.94f), new PointF(27.17f, 12.8f), new PointF(31.26f, 16.9f)); bezierPath.AddCurveToPoint(new PointF(22.09f, 31.09f), new PointF(31.26f, 26.98f), new PointF(27.17f, 31.09f)); bezierPath.ClosePath(); bezierPath.MiterLimit = 4; UIColor.LightGray.ColorWithAlpha(.5f).SetFill(); bezierPath.Fill(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(41.31f, 17.37f)); bezier2Path.AddLineTo(new PointF(39.57f, 17.37f)); bezier2Path.AddCurveToPoint(new PointF(36.95f, 14.72f), new PointF(38.14f, 17.37f), new PointF(36.95f, 16.18f)); bezier2Path.AddCurveToPoint(new PointF(37.81f, 12.85f), new PointF(36.95f, 13.99f), new PointF(37.26f, 13.34f)); bezier2Path.AddLineTo(new PointF(38.94f, 11.75f)); bezier2Path.AddCurveToPoint(new PointF(38.94f, 7.76f), new PointF(40.05f, 10.65f), new PointF(40.05f, 8.87f)); bezier2Path.AddLineTo(new PointF(36.38f, 5.23f)); bezier2Path.AddCurveToPoint(new PointF(34.38f, 4.43f), new PointF(35.88f, 4.73f), new PointF(35.13f, 4.43f)); bezier2Path.AddCurveToPoint(new PointF(32.37f, 5.23f), new PointF(33.62f, 4.43f), new PointF(32.89f, 4.73f)); bezier2Path.AddLineTo(new PointF(31.29f, 6.31f)); bezier2Path.AddCurveToPoint(new PointF(29.32f, 7.19f), new PointF(30.78f, 6.88f), new PointF(30.07f, 7.19f)); bezier2Path.AddCurveToPoint(new PointF(26.61f, 4.59f), new PointF(27.86f, 7.19f), new PointF(26.61f, 6)); bezier2Path.AddLineTo(new PointF(26.61f, 2.87f)); bezier2Path.AddCurveToPoint(new PointF(23.86f, 0), new PointF(26.61f, 1.33f), new PointF(25.4f, 0)); bezier2Path.AddLineTo(new PointF(20.37f, 0)); bezier2Path.AddCurveToPoint(new PointF(17.53f, 2.87f), new PointF(18.79f, 0), new PointF(17.53f, 1.31f)); bezier2Path.AddLineTo(new PointF(17.53f, 4.61f)); bezier2Path.AddCurveToPoint(new PointF(14.85f, 7.2f), new PointF(17.53f, 6.01f), new PointF(16.32f, 7.2f)); bezier2Path.AddCurveToPoint(new PointF(12.95f, 6.35f), new PointF(14.12f, 7.2f), new PointF(13.45f, 6.89f)); bezier2Path.AddLineTo(new PointF(11.84f, 5.26f)); bezier2Path.AddCurveToPoint(new PointF(9.83f, 4.46f), new PointF(11.33f, 4.74f), new PointF(10.59f, 4.46f)); bezier2Path.AddCurveToPoint(new PointF(7.83f, 5.26f), new PointF(9.07f, 4.46f), new PointF(8.34f, 4.75f)); bezier2Path.AddLineTo(new PointF(5.27f, 7.77f)); bezier2Path.AddCurveToPoint(new PointF(5.27f, 11.75f), new PointF(4.17f, 8.87f), new PointF(4.17f, 10.66f)); bezier2Path.AddLineTo(new PointF(6.35f, 12.82f)); bezier2Path.AddCurveToPoint(new PointF(7.24f, 14.73f), new PointF(6.92f, 13.34f), new PointF(7.24f, 13.99f)); bezier2Path.AddCurveToPoint(new PointF(4.63f, 17.38f), new PointF(7.24f, 16.19f), new PointF(6.05f, 17.38f)); bezier2Path.AddLineTo(new PointF(2.89f, 17.38f)); bezier2Path.AddCurveToPoint(new PointF(0, 20.21f), new PointF(1.32f, 17.37f), new PointF(0, 18.65f)); bezier2Path.AddLineTo(new PointF(0, 21.94f)); bezier2Path.AddLineTo(new PointF(0, 23.68f)); bezier2Path.AddCurveToPoint(new PointF(2.89f, 26.51f), new PointF(0, 25.22f), new PointF(1.32f, 26.51f)); bezier2Path.AddLineTo(new PointF(4.63f, 26.51f)); bezier2Path.AddCurveToPoint(new PointF(7.24f, 29.17f), new PointF(6.05f, 26.51f), new PointF(7.24f, 27.7f)); bezier2Path.AddCurveToPoint(new PointF(6.35f, 31.09f), new PointF(7.24f, 29.9f), new PointF(6.92f, 30.57f)); bezier2Path.AddLineTo(new PointF(5.27f, 32.14f)); bezier2Path.AddCurveToPoint(new PointF(5.27f, 36.11f), new PointF(4.17f, 33.23f), new PointF(4.17f, 35.02f)); bezier2Path.AddLineTo(new PointF(7.83f, 38.65f)); bezier2Path.AddCurveToPoint(new PointF(9.83f, 39.45f), new PointF(8.33f, 39.17f), new PointF(9.07f, 39.45f)); bezier2Path.AddCurveToPoint(new PointF(11.84f, 38.65f), new PointF(10.59f, 39.45f), new PointF(11.32f, 39.15f)); bezier2Path.AddLineTo(new PointF(12.95f, 37.55f)); bezier2Path.AddCurveToPoint(new PointF(14.84f, 36.71f), new PointF(13.43f, 37.02f), new PointF(14.11f, 36.71f)); bezier2Path.AddCurveToPoint(new PointF(17.52f, 39.3f), new PointF(16.31f, 36.71f), new PointF(17.52f, 37.9f)); bezier2Path.AddLineTo(new PointF(17.52f, 41.04f)); bezier2Path.AddCurveToPoint(new PointF(20.35f, 43.91f), new PointF(17.52f, 42.58f), new PointF(18.78f, 43.91f)); bezier2Path.AddLineTo(new PointF(23.83f, 43.91f)); bezier2Path.AddCurveToPoint(new PointF(26.69f, 41.04f), new PointF(25.39f, 43.91f), new PointF(26.69f, 42.59f)); bezier2Path.AddLineTo(new PointF(26.69f, 39.3f)); bezier2Path.AddCurveToPoint(new PointF(29.36f, 36.71f), new PointF(26.69f, 37.9f), new PointF(27.89f, 36.71f)); bezier2Path.AddCurveToPoint(new PointF(31.29f, 37.59f), new PointF(30.09f, 36.71f), new PointF(30.77f, 37.03f)); bezier2Path.AddLineTo(new PointF(32.37f, 38.66f)); bezier2Path.AddCurveToPoint(new PointF(34.38f, 39.46f), new PointF(32.89f, 39.17f), new PointF(33.62f, 39.46f)); bezier2Path.AddCurveToPoint(new PointF(36.38f, 38.66f), new PointF(35.13f, 39.46f), new PointF(35.86f, 39.17f)); bezier2Path.AddLineTo(new PointF(38.94f, 36.13f)); bezier2Path.AddCurveToPoint(new PointF(38.94f, 32.14f), new PointF(40.04f, 35.03f), new PointF(40.04f, 33.23f)); bezier2Path.AddLineTo(new PointF(37.81f, 31.04f)); bezier2Path.AddCurveToPoint(new PointF(36.95f, 29.13f), new PointF(37.26f, 30.55f), new PointF(36.95f, 29.85f)); bezier2Path.AddCurveToPoint(new PointF(39.57f, 26.43f), new PointF(36.95f, 27.67f), new PointF(38.14f, 26.43f)); bezier2Path.AddLineTo(new PointF(41.31f, 26.43f)); bezier2Path.AddCurveToPoint(new PointF(43.98f, 23.7f), new PointF(42.87f, 26.43f), new PointF(43.98f, 25.26f)); bezier2Path.AddLineTo(new PointF(43.98f, 21.94f)); bezier2Path.AddLineTo(new PointF(43.98f, 20.21f)); bezier2Path.AddCurveToPoint(new PointF(41.31f, 17.37f), new PointF(43.98f, 18.65f), new PointF(42.87f, 17.37f)); bezier2Path.ClosePath(); bezier2Path.MoveTo(new PointF(42.17f, 21.94f)); bezier2Path.AddLineTo(new PointF(42.17f, 23.67f)); bezier2Path.AddCurveToPoint(new PointF(41.33f, 24.57f), new PointF(42.17f, 24.15f), new PointF(41.9f, 24.57f)); bezier2Path.AddLineTo(new PointF(39.59f, 24.57f)); bezier2Path.AddCurveToPoint(new PointF(36.44f, 25.94f), new PointF(38.41f, 24.57f), new PointF(37.29f, 25.07f)); bezier2Path.AddCurveToPoint(new PointF(35.14f, 29.12f), new PointF(35.6f, 26.8f), new PointF(35.14f, 27.93f)); bezier2Path.AddCurveToPoint(new PointF(36.57f, 32.34f), new PointF(35.14f, 30.35f), new PointF(35.65f, 31.5f)); bezier2Path.AddLineTo(new PointF(37.66f, 33.42f)); bezier2Path.AddCurveToPoint(new PointF(37.66f, 34.82f), new PointF(38.04f, 33.81f), new PointF(38.04f, 34.45f)); bezier2Path.AddLineTo(new PointF(35.11f, 37.36f)); bezier2Path.AddCurveToPoint(new PointF(34.39f, 37.63f), new PointF(34.92f, 37.53f), new PointF(34.66f, 37.63f)); bezier2Path.AddCurveToPoint(new PointF(33.66f, 37.36f), new PointF(34.11f, 37.63f), new PointF(33.84f, 37.53f)); bezier2Path.AddLineTo(new PointF(32.62f, 36.32f)); bezier2Path.AddCurveToPoint(new PointF(29.36f, 34.88f), new PointF(31.74f, 35.39f), new PointF(30.58f, 34.88f)); bezier2Path.AddCurveToPoint(new PointF(26.21f, 36.16f), new PointF(28.16f, 34.88f), new PointF(27.06f, 35.34f)); bezier2Path.AddCurveToPoint(new PointF(24.88f, 39.3f), new PointF(25.33f, 37.01f), new PointF(24.88f, 38.11f)); bezier2Path.AddLineTo(new PointF(24.88f, 41.04f)); bezier2Path.AddCurveToPoint(new PointF(23.86f, 42.08f), new PointF(24.88f, 41.6f), new PointF(24.38f, 42.08f)); bezier2Path.AddLineTo(new PointF(20.37f, 42.08f)); bezier2Path.AddCurveToPoint(new PointF(19.38f, 41.04f), new PointF(19.85f, 42.08f), new PointF(19.38f, 41.6f)); bezier2Path.AddLineTo(new PointF(19.38f, 39.3f)); bezier2Path.AddCurveToPoint(new PointF(18.04f, 36.16f), new PointF(19.38f, 38.13f), new PointF(18.91f, 37.01f)); bezier2Path.AddCurveToPoint(new PointF(14.87f, 34.88f), new PointF(17.18f, 35.34f), new PointF(16.05f, 34.88f)); bezier2Path.AddCurveToPoint(new PointF(11.65f, 36.3f), new PointF(13.66f, 34.88f), new PointF(12.49f, 35.39f)); bezier2Path.AddLineTo(new PointF(10.59f, 37.36f)); bezier2Path.AddCurveToPoint(new PointF(9.87f, 37.63f), new PointF(10.4f, 37.53f), new PointF(10.14f, 37.63f)); bezier2Path.AddCurveToPoint(new PointF(9.17f, 37.38f), new PointF(9.59f, 37.63f), new PointF(9.32f, 37.54f)); bezier2Path.AddLineTo(new PointF(9.16f, 37.37f)); bezier2Path.AddLineTo(new PointF(9.14f, 37.36f)); bezier2Path.AddLineTo(new PointF(6.59f, 34.82f)); bezier2Path.AddCurveToPoint(new PointF(6.59f, 33.43f), new PointF(6.21f, 34.45f), new PointF(6.21f, 33.82f)); bezier2Path.AddLineTo(new PointF(7.63f, 32.4f)); bezier2Path.AddCurveToPoint(new PointF(9.09f, 29.14f), new PointF(8.57f, 31.53f), new PointF(9.09f, 30.38f)); bezier2Path.AddCurveToPoint(new PointF(7.79f, 26.01f), new PointF(9.09f, 27.95f), new PointF(8.63f, 26.87f)); bezier2Path.AddCurveToPoint(new PointF(4.64f, 24.7f), new PointF(6.94f, 25.14f), new PointF(5.82f, 24.7f)); bezier2Path.AddLineTo(new PointF(2.89f, 24.7f)); bezier2Path.AddCurveToPoint(new PointF(1.83f, 23.69f), new PointF(2.31f, 24.7f), new PointF(1.83f, 24.21f)); bezier2Path.AddLineTo(new PointF(1.83f, 21.94f)); bezier2Path.AddLineTo(new PointF(1.83f, 20.21f)); bezier2Path.AddCurveToPoint(new PointF(2.89f, 19.2f), new PointF(1.83f, 19.69f), new PointF(2.31f, 19.2f)); bezier2Path.AddLineTo(new PointF(4.63f, 19.2f)); bezier2Path.AddCurveToPoint(new PointF(7.78f, 17.89f), new PointF(5.81f, 19.2f), new PointF(6.93f, 18.75f)); bezier2Path.AddCurveToPoint(new PointF(9.08f, 14.74f), new PointF(8.62f, 17.03f), new PointF(9.08f, 15.92f)); bezier2Path.AddCurveToPoint(new PointF(7.62f, 11.5f), new PointF(9.08f, 13.51f), new PointF(8.56f, 12.35f)); bezier2Path.AddLineTo(new PointF(6.57f, 10.46f)); bezier2Path.AddCurveToPoint(new PointF(6.28f, 9.76f), new PointF(6.31f, 10.21f), new PointF(6.28f, 9.92f)); bezier2Path.AddCurveToPoint(new PointF(6.57f, 9.06f), new PointF(6.28f, 9.61f), new PointF(6.31f, 9.31f)); bezier2Path.AddLineTo(new PointF(9.11f, 6.54f)); bezier2Path.AddCurveToPoint(new PointF(9.83f, 6.26f), new PointF(9.29f, 6.37f), new PointF(9.56f, 6.26f)); bezier2Path.AddCurveToPoint(new PointF(10.53f, 6.51f), new PointF(10.11f, 6.26f), new PointF(10.38f, 6.35f)); bezier2Path.AddLineTo(new PointF(10.54f, 6.53f)); bezier2Path.AddLineTo(new PointF(10.55f, 6.54f)); bezier2Path.AddLineTo(new PointF(11.63f, 7.61f)); bezier2Path.AddCurveToPoint(new PointF(14.85f, 9.03f), new PointF(12.48f, 8.53f), new PointF(13.62f, 9.03f)); bezier2Path.AddCurveToPoint(new PointF(18.01f, 7.75f), new PointF(16.04f, 9.03f), new PointF(17.15f, 8.57f)); bezier2Path.AddCurveToPoint(new PointF(19.36f, 4.61f), new PointF(18.88f, 6.9f), new PointF(19.36f, 5.79f)); bezier2Path.AddLineTo(new PointF(19.36f, 2.87f)); bezier2Path.AddCurveToPoint(new PointF(20.34f, 1.83f), new PointF(19.36f, 2.31f), new PointF(19.82f, 1.83f)); bezier2Path.AddLineTo(new PointF(23.83f, 1.83f)); bezier2Path.AddCurveToPoint(new PointF(24.75f, 2.87f), new PointF(24.35f, 1.83f), new PointF(24.75f, 2.31f)); bezier2Path.AddLineTo(new PointF(24.75f, 4.61f)); bezier2Path.AddCurveToPoint(new PointF(26.12f, 7.75f), new PointF(24.75f, 5.78f), new PointF(25.25f, 6.9f)); bezier2Path.AddCurveToPoint(new PointF(29.31f, 9.03f), new PointF(26.98f, 8.57f), new PointF(28.12f, 9.03f)); bezier2Path.AddCurveToPoint(new PointF(32.59f, 7.59f), new PointF(30.55f, 9.03f), new PointF(31.72f, 8.51f)); bezier2Path.AddLineTo(new PointF(33.63f, 6.55f)); bezier2Path.AddCurveToPoint(new PointF(34.35f, 6.27f), new PointF(33.81f, 6.38f), new PointF(34.08f, 6.27f)); bezier2Path.AddCurveToPoint(new PointF(35.07f, 6.54f), new PointF(34.63f, 6.27f), new PointF(34.9f, 6.38f)); bezier2Path.AddLineTo(new PointF(37.63f, 9.06f)); bezier2Path.AddCurveToPoint(new PointF(37.93f, 9.76f), new PointF(37.81f, 9.25f), new PointF(37.93f, 9.5f)); bezier2Path.AddCurveToPoint(new PointF(37.64f, 10.46f), new PointF(37.93f, 10.02f), new PointF(37.82f, 10.27f)); bezier2Path.AddLineTo(new PointF(36.55f, 11.53f)); bezier2Path.AddCurveToPoint(new PointF(35.12f, 14.75f), new PointF(35.64f, 12.38f), new PointF(35.12f, 13.52f)); bezier2Path.AddCurveToPoint(new PointF(36.41f, 17.89f), new PointF(35.12f, 15.94f), new PointF(35.58f, 17.03f)); bezier2Path.AddCurveToPoint(new PointF(39.57f, 19.2f), new PointF(37.26f, 18.75f), new PointF(38.39f, 19.2f)); bezier2Path.AddLineTo(new PointF(41.31f, 19.2f)); bezier2Path.AddCurveToPoint(new PointF(42.17f, 20.23f), new PointF(41.93f, 19.2f), new PointF(42.16f, 19.77f)); bezier2Path.AddLineTo(new PointF(42.17f, 21.94f)); bezier2Path.ClosePath(); bezier2Path.MiterLimit = 4; UIColor.LightGray.ColorWithAlpha(.5f).SetFill(); bezier2Path.Fill(); }
public static UIBezierPath BezierPathForBackButton(RectangleF rect, float radius) { var path = new UIBezierPath(); var mPoint = new PointF(rect.Right - radius, rect.Y); var ctrlPoint = mPoint; path.MoveTo(mPoint); ctrlPoint.Y += radius; mPoint.X += radius; mPoint.Y += radius; if (radius > 0) path.AddArc(ctrlPoint, radius, (float)(Math.PI + Math.PI / 2), 0, true); mPoint.Y = rect.Bottom - radius; path.AddLineTo(mPoint); ctrlPoint = mPoint; mPoint.Y += radius; mPoint.X -= radius; ctrlPoint.X -= radius; if (radius > 0) path.AddArc(ctrlPoint, radius, 0, (float)(Math.PI / 2), true); mPoint.X = rect.X + 10f; path.AddLineTo(mPoint); path.AddLineTo(new PointF(rect.X, rect.Height / 2)); mPoint.Y = rect.Y; path.AddLineTo(mPoint); path.ClosePath(); return path; }
static void paintCodeRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); UIColor color2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(33.51f, 2.63f)); bezierPath.AddLineTo(new PointF(13.55f, 26.55f)); bezierPath.AddCurveToPoint(new PointF(24.53f, 7.67f), new PointF(13.55f, 26.55f), new PointF(19.54f, 13.65f)); bezierPath.AddCurveToPoint(new PointF(33.51f, 2.63f), new PointF(29.52f, 1.69f), new PointF(33.51f, 2.63f)); color.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 1; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(14.55f, 27.81f)); bezier2Path.AddCurveToPoint(new PointF(40.5f, 11.44f), new PointF(14.55f, 27.81f), new PointF(40.56f, 11.03f)); bezier2Path.AddCurveToPoint(new PointF(37.51f, 16.48f), new PointF(40.45f, 11.85f), new PointF(42.73f, 11.33f)); bezier2Path.AddCurveToPoint(new PointF(14.55f, 27.81f), new PointF(32.28f, 21.62f), new PointF(14.55f, 27.81f)); bezier2Path.ClosePath(); color.SetFill(); bezier2Path.Fill(); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 1; bezier2Path.Stroke(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(9.5f, 27.5f, 9, 12)); color2.SetFill(); oval2Path.Fill(); UIColor.Black.SetStroke(); oval2Path.LineWidth = 2; oval2Path.Stroke(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new RectangleF(3.5f, 19.5f, 10, 12)); color2.SetFill(); ovalPath.Fill(); UIColor.Black.SetStroke(); ovalPath.LineWidth = 2; ovalPath.Stroke(); }
static void paintCodeRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(19.88f, 4.59f)); bezier2Path.AddCurveToPoint(new PointF(28.6f, 6.25f), new PointF(22.84f, 4.27f), new PointF(25.87f, 4.82f)); bezier2Path.AddLineTo(new PointF(30.02f, 5.82f)); bezier2Path.AddLineTo(new PointF(31.53f, 3.5f)); bezier2Path.AddLineTo(new PointF(33.04f, 5.82f)); bezier2Path.AddLineTo(new PointF(35.61f, 6.61f)); bezier2Path.AddLineTo(new PointF(33.97f, 8.83f)); bezier2Path.AddLineTo(new PointF(34.03f, 10.88f)); bezier2Path.AddCurveToPoint(new PointF(35.44f, 13.03f), new PointF(34.55f, 11.56f), new PointF(35.02f, 12.28f)); bezier2Path.AddLineTo(new PointF(36.77f, 11.5f)); bezier2Path.AddLineTo(new PointF(38.79f, 13.82f)); bezier2Path.AddLineTo(new PointF(42.21f, 14.61f)); bezier2Path.AddLineTo(new PointF(40.03f, 16.83f)); bezier2Path.AddLineTo(new PointF(40.13f, 19.64f)); bezier2Path.AddLineTo(new PointF(37.47f, 18.9f)); bezier2Path.AddCurveToPoint(new PointF(36.87f, 27.6f), new PointF(37.95f, 21.79f), new PointF(37.75f, 24.79f)); bezier2Path.AddLineTo(new PointF(39.42f, 28.65f)); bezier2Path.AddLineTo(new PointF(37.79f, 31.61f)); bezier2Path.AddLineTo(new PointF(37.86f, 35.35f)); bezier2Path.AddLineTo(new PointF(35.34f, 34.1f)); bezier2Path.AddLineTo(new PointF(32.82f, 35.35f)); bezier2Path.AddLineTo(new PointF(32.84f, 34.53f)); bezier2Path.AddCurveToPoint(new PointF(30.74f, 36.39f), new PointF(32.18f, 35.22f), new PointF(31.48f, 35.84f)); bezier2Path.AddLineTo(new PointF(30.8f, 36.56f)); bezier2Path.AddLineTo(new PointF(32.79f, 37.26f)); bezier2Path.AddLineTo(new PointF(31.53f, 39.24f)); bezier2Path.AddLineTo(new PointF(31.58f, 41.74f)); bezier2Path.AddLineTo(new PointF(29.62f, 40.9f)); bezier2Path.AddLineTo(new PointF(27.66f, 41.74f)); bezier2Path.AddLineTo(new PointF(27.72f, 39.24f)); bezier2Path.AddLineTo(new PointF(27.18f, 38.4f)); bezier2Path.AddCurveToPoint(new PointF(21.39f, 39.5f), new PointF(25.32f, 39.15f), new PointF(23.36f, 39.52f)); bezier2Path.AddLineTo(new PointF(21.46f, 42.45f)); bezier2Path.AddLineTo(new PointF(18.66f, 41.3f)); bezier2Path.AddLineTo(new PointF(15.86f, 42.45f)); bezier2Path.AddLineTo(new PointF(15.95f, 39.02f)); bezier2Path.AddLineTo(new PointF(15.41f, 38.21f)); bezier2Path.AddCurveToPoint(new PointF(10.07f, 34.37f), new PointF(13.46f, 37.35f), new PointF(11.64f, 36.08f)); bezier2Path.AddLineTo(new PointF(10.01f, 34.31f)); bezier2Path.AddLineTo(new PointF(10.03f, 35.35f)); bezier2Path.AddLineTo(new PointF(7.23f, 34.1f)); bezier2Path.AddLineTo(new PointF(4.43f, 35.35f)); bezier2Path.AddLineTo(new PointF(4.51f, 31.61f)); bezier2Path.AddLineTo(new PointF(2.7f, 28.65f)); bezier2Path.AddLineTo(new PointF(5.55f, 27.59f)); bezier2Path.AddLineTo(new PointF(5.95f, 26.84f)); bezier2Path.AddCurveToPoint(new PointF(5.33f, 22.44f), new PointF(5.57f, 25.41f), new PointF(5.36f, 23.92f)); bezier2Path.AddLineTo(new PointF(3.67f, 22.83f)); bezier2Path.AddLineTo(new PointF(3.76f, 20.65f)); bezier2Path.AddLineTo(new PointF(1.77f, 18.92f)); bezier2Path.AddLineTo(new PointF(4.91f, 18.3f)); bezier2Path.AddLineTo(new PointF(5.9f, 17.33f)); bezier2Path.AddLineTo(new PointF(5.58f, 17.45f)); bezier2Path.AddLineTo(new PointF(5.67f, 14.02f)); bezier2Path.AddLineTo(new PointF(3.67f, 11.3f)); bezier2Path.AddLineTo(new PointF(6.81f, 10.33f)); bezier2Path.AddLineTo(new PointF(8.66f, 7.5f)); bezier2Path.AddLineTo(new PointF(10.06f, 9.64f)); bezier2Path.AddCurveToPoint(new PointF(12.57f, 7.41f), new PointF(10.85f, 8.79f), new PointF(11.68f, 8.05f)); bezier2Path.AddLineTo(new PointF(12.23f, 5.99f)); bezier2Path.AddLineTo(new PointF(16.76f, 1.5f)); bezier2Path.AddLineTo(new PointF(19.88f, 4.59f)); bezier2Path.ClosePath(); bezier2Path.MoveTo(new PointF(14.79f, 15.14f)); bezier2Path.AddCurveToPoint(new PointF(14.79f, 27.86f), new PointF(11.06f, 18.65f), new PointF(11.06f, 24.35f)); bezier2Path.AddCurveToPoint(new PointF(28.26f, 27.86f), new PointF(18.51f, 31.38f), new PointF(24.54f, 31.38f)); bezier2Path.AddCurveToPoint(new PointF(28.26f, 15.14f), new PointF(31.98f, 24.35f), new PointF(31.98f, 18.65f)); bezier2Path.AddCurveToPoint(new PointF(14.79f, 15.14f), new PointF(24.54f, 11.62f), new PointF(18.51f, 11.62f)); bezier2Path.ClosePath(); color.SetFill(); bezier2Path.Fill(); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 1; bezier2Path.Stroke(); }
public override void Draw (RectangleF rect) { UIView head = ((WalkingDead)Superview).head; UIBezierPath path = new UIBezierPath (); path.LineCapStyle = CGLineCap.Round; RectangleF headFrame = head.Frame; if (!MovingRight) { rect.X -= 20; path.MoveTo (new PointF (rect.GetMidX () + 20, headFrame.GetMaxY () + 10)); path.AddLineTo (new PointF (rect.GetMidX () + 20 + rect.Size.Width / 6, headFrame.GetMaxY () + 10)); path.AddLineTo (new PointF (rect.GetMidX () + 20 + rect.Size.Width / 6 + 10, headFrame.GetMaxY () + 10 + 20)); } else { path.MoveTo (new PointF (rect.GetMidX () - 20, headFrame.GetMaxY () + 10)); path.AddLineTo (new PointF (rect.GetMidX () - 20 - rect.Size.Width / 6, headFrame.GetMaxY () + 10)); path.AddLineTo (new PointF (rect.GetMidX () - 20 - rect.Size.Width / 6 - 10, headFrame.GetMaxY () + 10 + 20)); } UIColor.Black.SetStroke (); path.LineWidth = 12; path.Stroke (); UIColor.White.SetStroke (); path.LineWidth = 8; path.Stroke (); }
UIBezierPath CreateCirclePath(PointF center, float radius, int sampleCount) { var smoothedPath = new UIBezierPath(); PointF startPoint = PointOnCircle (center, radius, -90); smoothedPath.MoveTo (startPoint); float delta = 360 / sampleCount; float angleInDegrees = -90; for(int i = 1; i < sampleCount; i++) { angleInDegrees += delta; var point = PointOnCircle(center, radius, angleInDegrees); smoothedPath.AddLineTo(point); } smoothedPath.AddLineTo (startPoint); return smoothedPath; }
public static void paintCodeDrawQRNONRetina() { //// Color Declarations UIColor color2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(3.5f, 2.5f, 10, 8)); UIColor.White.SetFill(); rectanglePath.Fill(); UIColor.Black.SetStroke(); rectanglePath.LineWidth = 1; rectanglePath.Stroke(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRect(new RectangleF(6.5f, 4.5f, 4, 4)); color2.SetFill(); rectangle2Path.Fill(); UIColor.Black.SetStroke(); rectangle2Path.LineWidth = 1; rectangle2Path.Stroke(); //// Rectangle 3 Drawing var rectangle3Path = UIBezierPath.FromRect(new RectangleF(3.5f, 18.5f, 10, 8)); UIColor.White.SetFill(); rectangle3Path.Fill(); UIColor.Black.SetStroke(); rectangle3Path.LineWidth = 1; rectangle3Path.Stroke(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRect(new RectangleF(6.5f, 20.5f, 4, 4)); color2.SetFill(); rectangle4Path.Fill(); UIColor.Black.SetStroke(); rectangle4Path.LineWidth = 1; rectangle4Path.Stroke(); //// Rectangle 5 Drawing var rectangle5Path = UIBezierPath.FromRect(new RectangleF(30.5f, 2.5f, 10, 8)); UIColor.White.SetFill(); rectangle5Path.Fill(); UIColor.Black.SetStroke(); rectangle5Path.LineWidth = 1; rectangle5Path.Stroke(); //// Rectangle 6 Drawing var rectangle6Path = UIBezierPath.FromRect(new RectangleF(33.5f, 4.5f, 4, 4)); color2.SetFill(); rectangle6Path.Fill(); UIColor.Black.SetStroke(); rectangle6Path.LineWidth = 1; rectangle6Path.Stroke(); //// Star Drawing UIBezierPath starPath = new UIBezierPath(); starPath.MoveTo(new PointF(26.5f, 8.5f)); starPath.AddLineTo(new PointF(29.67f, 13.39f)); starPath.AddLineTo(new PointF(35.06f, 15.06f)); starPath.AddLineTo(new PointF(31.64f, 19.76f)); starPath.AddLineTo(new PointF(31.79f, 25.69f)); starPath.AddLineTo(new PointF(26.5f, 23.7f)); starPath.AddLineTo(new PointF(21.21f, 25.69f)); starPath.AddLineTo(new PointF(21.36f, 19.76f)); starPath.AddLineTo(new PointF(17.94f, 15.06f)); starPath.AddLineTo(new PointF(23.33f, 13.39f)); starPath.ClosePath(); UIColor.White.SetFill(); starPath.Fill(); UIColor.Black.SetStroke(); starPath.LineWidth = 2.5f; starPath.Stroke(); //// Star 2 Drawing UIBezierPath star2Path = new UIBezierPath(); star2Path.MoveTo(new PointF(20.5f, 2.5f)); star2Path.AddLineTo(new PointF(21.56f, 4.56f)); star2Path.AddLineTo(new PointF(23.35f, 5.26f)); star2Path.AddLineTo(new PointF(22.21f, 7.24f)); star2Path.AddLineTo(new PointF(22.26f, 9.74f)); star2Path.AddLineTo(new PointF(20.5f, 8.9f)); star2Path.AddLineTo(new PointF(18.74f, 9.74f)); star2Path.AddLineTo(new PointF(18.79f, 7.24f)); star2Path.AddLineTo(new PointF(17.65f, 5.26f)); star2Path.AddLineTo(new PointF(19.44f, 4.56f)); star2Path.ClosePath(); UIColor.White.SetFill(); star2Path.Fill(); UIColor.Black.SetStroke(); star2Path.LineWidth = 2; star2Path.Stroke(); //// Star 3 Drawing UIBezierPath star3Path = new UIBezierPath(); star3Path.MoveTo(new PointF(41.5f, 21.5f)); star3Path.AddLineTo(new PointF(42.91f, 23.56f)); star3Path.AddLineTo(new PointF(45.3f, 24.26f)); star3Path.AddLineTo(new PointF(43.78f, 26.24f)); star3Path.AddLineTo(new PointF(43.85f, 28.74f)); star3Path.AddLineTo(new PointF(41.5f, 27.9f)); star3Path.AddLineTo(new PointF(39.15f, 28.74f)); star3Path.AddLineTo(new PointF(39.22f, 26.24f)); star3Path.AddLineTo(new PointF(37.7f, 24.26f)); star3Path.AddLineTo(new PointF(40.09f, 23.56f)); star3Path.ClosePath(); UIColor.White.SetFill(); star3Path.Fill(); UIColor.Black.SetStroke(); star3Path.LineWidth = 1.5f; star3Path.Stroke(); }
static void paintCodeRetina() { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations UIColor shadowColor2 = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 0.413f); UIColor color5 = UIColor.FromRGBA(0.200f, 0.067f, 0.000f, 1.000f); //// Shadow Declarations var shadow = shadowColor2.CGColor; var shadowOffset = new SizeF(0.1f, 1.1f); var shadowBlurRadius = 10; //// Rectangle 5 Drawing UIBezierPath rectangle5Path = new UIBezierPath(); rectangle5Path.MoveTo(new PointF(6.09f, 11.75f)); rectangle5Path.AddLineTo(new PointF(6.09f, 11.85f)); rectangle5Path.AddLineTo(new PointF(6.09f, 11.75f)); rectangle5Path.ClosePath(); rectangle5Path.MoveTo(new PointF(6.94f, 20.6f)); rectangle5Path.AddLineTo(new PointF(6.94f, 2)); rectangle5Path.AddLineTo(new PointF(9.27f, 5.28f)); rectangle5Path.AddLineTo(new PointF(9.47f, 26.07f)); rectangle5Path.AddLineTo(new PointF(6.94f, 20.6f)); rectangle5Path.ClosePath(); color5.SetFill(); rectangle5Path.Fill(); ////// Rectangle 5 Inner Shadow var rectangle5BorderRect = rectangle5Path.Bounds; rectangle5BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle5BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle5BorderRect = RectangleF.Union(rectangle5BorderRect, rectangle5Path.Bounds); rectangle5BorderRect.Inflate(1, 1); var rectangle5NegativePath = UIBezierPath.FromRect(rectangle5BorderRect); rectangle5NegativePath.AppendPath(rectangle5Path); rectangle5NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle5BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle5Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle5BorderRect.Width), 0); rectangle5NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle5NegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectangle5Path.LineWidth = 1; rectangle5Path.Stroke(); //// Rectangle 4 Drawing UIBezierPath rectangle4Path = new UIBezierPath(); rectangle4Path.MoveTo(new PointF(77.17f, 46.2f)); rectangle4Path.AddLineTo(new PointF(77.17f, 46.2f)); rectangle4Path.AddLineTo(new PointF(77.17f, 46.2f)); rectangle4Path.ClosePath(); rectangle4Path.MoveTo(new PointF(77.54f, 58.04f)); rectangle4Path.AddLineTo(new PointF(77.54f, 34.62f)); rectangle4Path.AddLineTo(new PointF(83.98f, 37.55f)); rectangle4Path.AddLineTo(new PointF(83.98f, 63.9f)); rectangle4Path.AddLineTo(new PointF(77.54f, 58.04f)); rectangle4Path.ClosePath(); color5.SetFill(); rectangle4Path.Fill(); ////// Rectangle 4 Inner Shadow var rectangle4BorderRect = rectangle4Path.Bounds; rectangle4BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle4BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle4BorderRect = RectangleF.Union(rectangle4BorderRect, rectangle4Path.Bounds); rectangle4BorderRect.Inflate(1, 1); var rectangle4NegativePath = UIBezierPath.FromRect(rectangle4BorderRect); rectangle4NegativePath.AppendPath(rectangle4Path); rectangle4NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle4BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle4Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle4BorderRect.Width), 0); rectangle4NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle4NegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectangle4Path.LineWidth = 1; rectangle4Path.Stroke(); //// Rectangle 6 Drawing UIBezierPath rectangle6Path = new UIBezierPath(); rectangle6Path.MoveTo(new PointF(26.89f, 48.27f)); rectangle6Path.AddLineTo(new PointF(26.89f, 48.27f)); rectangle6Path.AddLineTo(new PointF(26.89f, 48.27f)); rectangle6Path.ClosePath(); rectangle6Path.MoveTo(new PointF(27.14f, 58.73f)); rectangle6Path.AddLineTo(new PointF(27.14f, 31)); rectangle6Path.AddLineTo(new PointF(31.51f, 40.63f)); rectangle6Path.AddLineTo(new PointF(31.51f, 63.9f)); rectangle6Path.AddLineTo(new PointF(27.14f, 58.73f)); rectangle6Path.ClosePath(); color5.SetFill(); rectangle6Path.Fill(); ////// Rectangle 6 Inner Shadow var rectangle6BorderRect = rectangle6Path.Bounds; rectangle6BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle6BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle6BorderRect = RectangleF.Union(rectangle6BorderRect, rectangle6Path.Bounds); rectangle6BorderRect.Inflate(1, 1); var rectangle6NegativePath = UIBezierPath.FromRect(rectangle6BorderRect); rectangle6NegativePath.AppendPath(rectangle6Path); rectangle6NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle6BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle6Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle6BorderRect.Width), 0); rectangle6NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle6NegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectangle6Path.LineWidth = 1; rectangle6Path.Stroke(); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(31.5f, 39.5f, 11, 24)); color5.SetFill(); rectanglePath.Fill(); ////// Rectangle Inner Shadow var rectangleBorderRect = rectanglePath.Bounds; rectangleBorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangleBorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangleBorderRect = RectangleF.Union(rectangleBorderRect, rectanglePath.Bounds); rectangleBorderRect.Inflate(1, 1); var rectangleNegativePath = UIBezierPath.FromRect(rectangleBorderRect); rectangleNegativePath.AppendPath(rectanglePath); rectangleNegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangleBorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectanglePath.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangleBorderRect.Width), 0); rectangleNegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangleNegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectanglePath.LineWidth = 1; rectanglePath.Stroke(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRect(new RectangleF(9.5f, 7.5f, 7, 19)); color5.SetFill(); rectangle2Path.Fill(); ////// Rectangle 2 Inner Shadow var rectangle2BorderRect = rectangle2Path.Bounds; rectangle2BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle2BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle2BorderRect = RectangleF.Union(rectangle2BorderRect, rectangle2Path.Bounds); rectangle2BorderRect.Inflate(1, 1); var rectangle2NegativePath = UIBezierPath.FromRect(rectangle2BorderRect); rectangle2NegativePath.AppendPath(rectangle2Path); rectangle2NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle2BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle2Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle2BorderRect.Width), 0); rectangle2NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle2NegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectangle2Path.LineWidth = 1; rectangle2Path.Stroke(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(7.47f, 2.1f)); bezierPath.AddLineTo(new PointF(30.42f, 38.52f)); bezierPath.AddLineTo(new PointF(93.81f, 38.52f)); bezierPath.AddLineTo(new PointF(53.37f, 2.1f)); bezierPath.AddLineTo(new PointF(10.74f, 2.1f)); bezierPath.AddLineTo(new PointF(7.47f, 2.1f)); bezierPath.ClosePath(); color5.SetFill(); bezierPath.Fill(); ////// Bezier Inner Shadow var bezierBorderRect = bezierPath.Bounds; bezierBorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); bezierBorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); bezierBorderRect = RectangleF.Union(bezierBorderRect, bezierPath.Bounds); bezierBorderRect.Inflate(1, 1); var bezierNegativePath = UIBezierPath.FromRect(bezierBorderRect); bezierNegativePath.AppendPath(bezierPath); bezierNegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(bezierBorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); bezierPath.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(bezierBorderRect.Width), 0); bezierNegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); bezierNegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); bezierPath.LineWidth = 2; bezierPath.Stroke(); //// Rectangle 3 Drawing var rectangle3Path = UIBezierPath.FromRect(new RectangleF(83.5f, 39.5f, 11, 24)); color5.SetFill(); rectangle3Path.Fill(); ////// Rectangle 3 Inner Shadow var rectangle3BorderRect = rectangle3Path.Bounds; rectangle3BorderRect.Inflate(shadowBlurRadius, shadowBlurRadius); rectangle3BorderRect.Offset(-shadowOffset.Width, -shadowOffset.Height); rectangle3BorderRect = RectangleF.Union(rectangle3BorderRect, rectangle3Path.Bounds); rectangle3BorderRect.Inflate(1, 1); var rectangle3NegativePath = UIBezierPath.FromRect(rectangle3BorderRect); rectangle3NegativePath.AppendPath(rectangle3Path); rectangle3NegativePath.UsesEvenOddFillRule = true; context.SaveState(); { var xOffset = shadowOffset.Width + (float)Math.Round(rectangle3BorderRect.Width); var yOffset = shadowOffset.Height; context.SetShadowWithColor( new SizeF(xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f)), shadowBlurRadius, shadow); rectangle3Path.AddClip(); var transform = CGAffineTransform.MakeTranslation(-(float)Math.Round(rectangle3BorderRect.Width), 0); rectangle3NegativePath.ApplyTransform(transform); UIColor.Gray.SetFill(); rectangle3NegativePath.Fill(); } context.RestoreState(); color5.SetStroke(); rectangle3Path.LineWidth = 1; rectangle3Path.Stroke(); }
public override void DrawRect (RectangleF area, UIViewPrintFormatter formatter) { base.DrawRect (area, formatter); //General Declarations CGContext context = UIGraphics.GetCurrentContext (); // Color Declarations UIColor mmFill = new UIColor (0F, 0F, 0F, 0.196F); UIColor shape1DropShadowColor = new UIColor (1F, 1F, 1F, 0.4F); UIColor shape1InnerShadowColor = new UIColor (0F, 0F, 0F, 0.392F); // Shadow Declarations UIColor mmDropShadow = shape1DropShadowColor; SizeF mmDropShadowOffset = new SizeF (0.1F, 1.1F); Single mmDropShadowBlurRadius = 0; UIColor mmInnerShadow = shape1InnerShadowColor; SizeF mmInnerShadowOffset = new SizeF (0.1F, 1.1F); Single mmInnerShadowBlurRadius = 0; // Frames RectangleF frame = this.Bounds; // mmGroup { // mmShape Drawing UIBezierPath mmShapePath = new UIBezierPath (); mmShapePath.MoveTo (new PointF (frame.GetMinX () + 0.51759F * frame.Width, frame.GetMinY () + 0.96761F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.37558F * frame.Width, frame.GetMinY() + 0.91398F * frame.Height), new PointF (frame.GetMinX() + 0.46395F * frame.Width, frame.GetMinY() + 0.96761F * frame.Height), new PointF (frame.GetMinX() + 0.41351F * frame.Width, frame.GetMinY() + 0.94854F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.31759F * frame.Width, frame.GetMinY() + 0.76824F * frame.Height), new PointF (frame.GetMinX() + 0.33346F * frame.Width, frame.GetMinY() + 0.87556F * frame.Height), new PointF (frame.GetMinX() + 0.31234F * frame.Width, frame.GetMinY() + 0.82249F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.31904F * frame.Width, frame.GetMinY() + 0.75325F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.30262F * frame.Width, frame.GetMinY() + 0.75459F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.28470F * frame.Width, frame.GetMinY() + 0.75535F * frame.Height), new PointF (frame.GetMinX() + 0.29666F * frame.Width, frame.GetMinY() + 0.75510F * frame.Height), new PointF (frame.GetMinX() + 0.29065F * frame.Width, frame.GetMinY() + 0.75535F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.14274F * frame.Width, frame.GetMinY() + 0.70173F * frame.Height), new PointF (frame.GetMinX() + 0.23106F * frame.Width, frame.GetMinY() + 0.75535F * frame.Height), new PointF (frame.GetMinX() + 0.18067F * frame.Width, frame.GetMinY() + 0.73625F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.14274F * frame.Width, frame.GetMinY() + 0.44291F * frame.Height), new PointF (frame.GetMinX() + 0.06451F * frame.Width, frame.GetMinY() + 0.63038F * frame.Height), new PointF (frame.GetMinX() + 0.06451F * frame.Width, frame.GetMinY() + 0.51425F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.45528F * frame.Width, frame.GetMinY() + 0.15799F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.48085F * frame.Width, frame.GetMinY() + 0.14832F * frame.Height), new PointF (frame.GetMinX() + 0.46207F * frame.Width, frame.GetMinY() + 0.15176F * frame.Height), new PointF (frame.GetMinX() + 0.47120F * frame.Width, frame.GetMinY() + 0.14832F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.50639F * frame.Width, frame.GetMinY() + 0.15799F * frame.Height), new PointF (frame.GetMinX() + 0.49051F * frame.Width, frame.GetMinY() + 0.14832F * frame.Height), new PointF (frame.GetMinX() + 0.49957F * frame.Width, frame.GetMinY() + 0.15176F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.50639F * frame.Width, frame.GetMinY() + 0.20462F * frame.Height), new PointF (frame.GetMinX() + 0.52050F * frame.Width, frame.GetMinY() + 0.17087F * frame.Height), new PointF (frame.GetMinX() + 0.52050F * frame.Width, frame.GetMinY() + 0.19177F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.19390F * frame.Width, frame.GetMinY() + 0.48951F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.19386F * frame.Width, frame.GetMinY() + 0.65510F * frame.Height), new PointF (frame.GetMinX() + 0.14397F * frame.Width, frame.GetMinY() + 0.53518F * frame.Height), new PointF (frame.GetMinX() + 0.14397F * frame.Width, frame.GetMinY() + 0.60942F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.28476F * frame.Width, frame.GetMinY() + 0.68936F * frame.Height), new PointF (frame.GetMinX() + 0.21821F * frame.Width, frame.GetMinY() + 0.67720F * frame.Height), new PointF (frame.GetMinX() + 0.25047F * frame.Width, frame.GetMinY() + 0.68936F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.37557F * frame.Width, frame.GetMinY() + 0.65514F * frame.Height), new PointF (frame.GetMinX() + 0.31904F * frame.Width, frame.GetMinY() + 0.68936F * frame.Height), new PointF (frame.GetMinX() + 0.35128F * frame.Width, frame.GetMinY() + 0.67720F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.68812F * frame.Width, frame.GetMinY() + 0.37025F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.71365F * frame.Width, frame.GetMinY() + 0.36056F * frame.Height), new PointF (frame.GetMinX() + 0.69491F * frame.Width, frame.GetMinY() + 0.36401F * frame.Height), new PointF (frame.GetMinX() + 0.70403F * frame.Width, frame.GetMinY() + 0.36056F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.73923F * frame.Width, frame.GetMinY() + 0.37025F * frame.Height), new PointF (frame.GetMinX() + 0.72332F * frame.Width, frame.GetMinY() + 0.36056F * frame.Height), new PointF (frame.GetMinX() + 0.73241F * frame.Width, frame.GetMinY() + 0.36401F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.73923F * frame.Width, frame.GetMinY() + 0.41681F * frame.Height), new PointF (frame.GetMinX() + 0.75333F * frame.Width, frame.GetMinY() + 0.38310F * frame.Height), new PointF (frame.GetMinX() + 0.75333F * frame.Width, frame.GetMinY() + 0.40399F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.42673F * frame.Width, frame.GetMinY() + 0.70173F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.42670F * frame.Width, frame.GetMinY() + 0.86737F * frame.Height), new PointF (frame.GetMinX() + 0.37681F * frame.Width, frame.GetMinY() + 0.74744F * frame.Height), new PointF (frame.GetMinX() + 0.37681F * frame.Width, frame.GetMinY() + 0.82172F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.51759F * frame.Width, frame.GetMinY() + 0.90159F * frame.Height), new PointF (frame.GetMinX() + 0.45104F * frame.Width, frame.GetMinY() + 0.88944F * frame.Height), new PointF (frame.GetMinX() + 0.48328F * frame.Width, frame.GetMinY() + 0.90159F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.60840F * frame.Width, frame.GetMinY() + 0.86743F * frame.Height), new PointF (frame.GetMinX() + 0.55183F * frame.Width, frame.GetMinY() + 0.90159F * frame.Height), new PointF (frame.GetMinX() + 0.58413F * frame.Width, frame.GetMinY() + 0.88944F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.92092F * frame.Width, frame.GetMinY() + 0.58246F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.94646F * frame.Width, frame.GetMinY() + 0.57284F * frame.Height), new PointF (frame.GetMinX() + 0.92773F * frame.Width, frame.GetMinY() + 0.57623F * frame.Height), new PointF (frame.GetMinX() + 0.93682F * frame.Width, frame.GetMinY() + 0.57284F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.97208F * frame.Width, frame.GetMinY() + 0.58246F * frame.Height), new PointF (frame.GetMinX() + 0.95617F * frame.Width, frame.GetMinY() + 0.57284F * frame.Height), new PointF (frame.GetMinX() + 0.96523F * frame.Width, frame.GetMinY() + 0.57623F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.97208F * frame.Width, frame.GetMinY() + 0.62912F * frame.Height), new PointF (frame.GetMinX() + 0.98615F * frame.Width, frame.GetMinY() + 0.59535F * frame.Height), new PointF (frame.GetMinX() + 0.98615F * frame.Width, frame.GetMinY() + 0.61626F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.65956F * frame.Width, frame.GetMinY() + 0.91398F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.51759F * frame.Width, frame.GetMinY() + 0.96761F * frame.Height), new PointF (frame.GetMinX() + 0.62160F * frame.Width, frame.GetMinY() + 0.94854F * frame.Height), new PointF (frame.GetMinX() + 0.57117F * frame.Width, frame.GetMinY() + 0.96761F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.51759F * frame.Width, frame.GetMinY() + 0.96761F * frame.Height)); mmShapePath.ClosePath (); mmShapePath.MoveTo (new PointF (frame.GetMinX() + 0.51965F * frame.Width, frame.GetMinY() + 0.81940F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.49408F * frame.Width, frame.GetMinY() + 0.80982F * frame.Height), new PointF (frame.GetMinX() + 0.50999F * frame.Width, frame.GetMinY() + 0.81940F * frame.Height), new PointF (frame.GetMinX() + 0.50091F * frame.Width, frame.GetMinY() + 0.81600F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.49408F * frame.Width, frame.GetMinY() + 0.76313F * frame.Height), new PointF (frame.GetMinX() + 0.48000F * frame.Width, frame.GetMinY() + 0.79686F * frame.Height), new PointF (frame.GetMinX() + 0.48000F * frame.Width, frame.GetMinY() + 0.77600F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.80659F * frame.Width, frame.GetMinY() + 0.47824F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.80662F * frame.Width, frame.GetMinY() + 0.31264F * frame.Height), new PointF (frame.GetMinX() + 0.85650F * frame.Width, frame.GetMinY() + 0.43259F * frame.Height), new PointF (frame.GetMinX() + 0.85650F * frame.Width, frame.GetMinY() + 0.35831F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.71574F * frame.Width, frame.GetMinY() + 0.27840F * frame.Height), new PointF (frame.GetMinX() + 0.78226F * frame.Width, frame.GetMinY() + 0.29053F * frame.Height), new PointF (frame.GetMinX() + 0.75001F * frame.Width, frame.GetMinY() + 0.27840F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.62493F * frame.Width, frame.GetMinY() + 0.31260F * frame.Height), new PointF (frame.GetMinX() + 0.68146F * frame.Width, frame.GetMinY() + 0.27840F * frame.Height), new PointF (frame.GetMinX() + 0.64921F * frame.Width, frame.GetMinY() + 0.29053F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.31239F * frame.Width, frame.GetMinY() + 0.59752F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.28684F * frame.Width, frame.GetMinY() + 0.60718F * frame.Height), new PointF (frame.GetMinX() + 0.30556F * frame.Width, frame.GetMinY() + 0.60378F * frame.Height), new PointF (frame.GetMinX() + 0.29644F * frame.Width, frame.GetMinY() + 0.60718F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.26125F * frame.Width, frame.GetMinY() + 0.59752F * frame.Height), new PointF (frame.GetMinX() + 0.27718F * frame.Width, frame.GetMinY() + 0.60718F * frame.Height), new PointF (frame.GetMinX() + 0.26808F * frame.Width, frame.GetMinY() + 0.60378F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.26125F * frame.Width, frame.GetMinY() + 0.55093F * frame.Height), new PointF (frame.GetMinX() + 0.24715F * frame.Width, frame.GetMinY() + 0.58467F * frame.Height), new PointF (frame.GetMinX() + 0.24715F * frame.Width, frame.GetMinY() + 0.56377F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.57377F * frame.Width, frame.GetMinY() + 0.26601F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.57380F * frame.Width, frame.GetMinY() + 0.10041F * frame.Height), new PointF (frame.GetMinX() + 0.62368F * frame.Width, frame.GetMinY() + 0.22029F * frame.Height), new PointF (frame.GetMinX() + 0.62368F * frame.Width, frame.GetMinY() + 0.14606F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.48291F * frame.Width, frame.GetMinY() + 0.06617F * frame.Height), new PointF (frame.GetMinX() + 0.54946F * frame.Width, frame.GetMinY() + 0.07832F * frame.Height), new PointF (frame.GetMinX() + 0.51721F * frame.Width, frame.GetMinY() + 0.06617F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.39208F * frame.Width, frame.GetMinY() + 0.10040F * frame.Height), new PointF (frame.GetMinX() + 0.44863F * frame.Width, frame.GetMinY() + 0.06617F * frame.Height), new PointF (frame.GetMinX() + 0.41637F * frame.Width, frame.GetMinY() + 0.07832F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.07956F * frame.Width, frame.GetMinY() + 0.38530F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.05400F * frame.Width, frame.GetMinY() + 0.39496F * frame.Height), new PointF (frame.GetMinX() + 0.07274F * frame.Width, frame.GetMinY() + 0.39149F * frame.Height), new PointF (frame.GetMinX() + 0.06365F * frame.Width, frame.GetMinY() + 0.39496F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.02841F * frame.Width, frame.GetMinY() + 0.38530F * frame.Height), new PointF (frame.GetMinX() + 0.04434F * frame.Width, frame.GetMinY() + 0.39496F * frame.Height), new PointF (frame.GetMinX() + 0.03525F * frame.Width, frame.GetMinY() + 0.39149F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.02841F * frame.Width, frame.GetMinY() + 0.33867F * frame.Height), new PointF (frame.GetMinX() + 0.01434F * frame.Width, frame.GetMinY() + 0.37241F * frame.Height), new PointF (frame.GetMinX() + 0.01434F * frame.Width, frame.GetMinY() + 0.35151F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.34095F * frame.Width, frame.GetMinY() + 0.05378F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.48291F * frame.Width, frame.GetMinY() + 0.00013F * frame.Height), new PointF (frame.GetMinX() + 0.37888F * frame.Width, frame.GetMinY() + 0.01919F * frame.Height), new PointF (frame.GetMinX() + 0.42931F * frame.Width, frame.GetMinY() + 0.00013F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.62491F * frame.Width, frame.GetMinY() + 0.05378F * frame.Height), new PointF (frame.GetMinX() + 0.53657F * frame.Width, frame.GetMinY() + 0.00013F * frame.Height), new PointF (frame.GetMinX() + 0.58700F * frame.Width, frame.GetMinY() + 0.01919F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.68292F * frame.Width, frame.GetMinY() + 0.19950F * frame.Height), new PointF (frame.GetMinX() + 0.66705F * frame.Width, frame.GetMinY() + 0.09219F * frame.Height), new PointF (frame.GetMinX() + 0.68815F * frame.Width, frame.GetMinY() + 0.14529F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.68143F * frame.Width, frame.GetMinY() + 0.21454F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.69786F * frame.Width, frame.GetMinY() + 0.21318F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.71580F * frame.Width, frame.GetMinY() + 0.21244F * frame.Height), new PointF (frame.GetMinX() + 0.70379F * frame.Width, frame.GetMinY() + 0.21269F * frame.Height), new PointF (frame.GetMinX() + 0.70984F * frame.Width, frame.GetMinY() + 0.21244F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.85774F * frame.Width, frame.GetMinY() + 0.26604F * frame.Height), new PointF (frame.GetMinX() + 0.76941F * frame.Width, frame.GetMinY() + 0.21244F * frame.Height), new PointF (frame.GetMinX() + 0.81981F * frame.Width, frame.GetMinY() + 0.23147F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.85774F * frame.Width, frame.GetMinY() + 0.52485F * frame.Height), new PointF (frame.GetMinX() + 0.93599F * frame.Width, frame.GetMinY() + 0.33738F * frame.Height), new PointF (frame.GetMinX() + 0.93599F * frame.Width, frame.GetMinY() + 0.45349F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.54521F * frame.Width, frame.GetMinY() + 0.80977F * frame.Height)); mmShapePath.AddCurveToPoint ( new PointF (frame.GetMinX() + 0.51965F * frame.Width, frame.GetMinY() + 0.81940F * frame.Height), new PointF (frame.GetMinX() + 0.53840F * frame.Width, frame.GetMinY() + 0.81600F * frame.Height), new PointF (frame.GetMinX() + 0.52930F * frame.Width, frame.GetMinY() + 0.81940F * frame.Height)); mmShapePath.AddLineTo (new PointF (frame.GetMinX() + 0.51965F * frame.Width, frame.GetMinY() + 0.81940F * frame.Height)); mmShapePath.ClosePath (); context.SaveState (); context.SetShadowWithColor (mmDropShadowOffset, mmDropShadowBlurRadius, mmDropShadow.CGColor); context.SetBlendMode (CGBlendMode.Overlay); mmFill.SetFill (); mmShapePath.Fill (); RectangleF mmShapeBorderRect = RectangleF.Inflate (mmShapePath.Bounds, mmInnerShadowBlurRadius, mmInnerShadowBlurRadius); mmShapeBorderRect.Offset (mmInnerShadowOffset.Width, mmInnerShadowOffset.Height); mmShapeBorderRect.UnionWith (mmShapePath.Bounds); UIBezierPath mmShapeNegativePath = UIBezierPath.FromRect (mmShapeBorderRect); mmShapeNegativePath.AppendPath (mmShapePath); mmShapeNegativePath.UsesEvenOddFillRule = true; context.SaveState (); { Single xOffset = mmInnerShadowOffset.Width + (float) Math.Round (mmShapeBorderRect.Size.Width); Single yOffset = mmInnerShadowOffset.Height; context.SetShadowWithColor (new SizeF (xOffset + CopySign (0.1F, xOffset), yOffset + CopySign (0.1F, yOffset)), mmInnerShadowBlurRadius, mmInnerShadow.CGColor); mmShapePath.AddClip (); CGAffineTransform transform = CGAffineTransform.MakeTranslation ((float)-Math.Round (mmShapeBorderRect.Size.Width), 0F); mmShapeNegativePath.ApplyTransform (transform); UIColor.Gray.SetFill (); mmShapeNegativePath.Fill (); } context.RestoreState (); context.RestoreState (); } }
private void SetArrowFrame() { SelectionIndicatorArrowLayer.Frame = FrameForSelectionIndicator(); SelectionIndicatorArrowLayer.Mask = null; PointF p1, p2, p3; if (SelectionIndicatorLocation == HMSegmentedControlIndicatorLocation.Down) { p1 = new PointF(SelectionIndicatorArrowLayer.Bounds.Size.Width / 2, 0); p2 = new PointF(0, SelectionIndicatorArrowLayer.Bounds.Size.Height); p3 = new PointF(SelectionIndicatorArrowLayer.Bounds.Size.Width, SelectionIndicatorArrowLayer.Bounds.Size.Height); } else if (SelectionIndicatorLocation == HMSegmentedControlIndicatorLocation.Up) { p1 = new PointF(SelectionIndicatorArrowLayer.Bounds.Size.Width / 2, SelectionIndicatorArrowLayer.Bounds.Size.Height); p2 = new PointF(SelectionIndicatorArrowLayer.Bounds.Size.Width, 0); p3 = new PointF(0, 0); } else { p1 = p2 = p3 = PointF.Empty; } var arrowPath = new UIBezierPath(); arrowPath.MoveTo(p1); arrowPath.AddLineTo(p2); arrowPath.AddLineTo(p3); arrowPath.ClosePath(); SelectionIndicatorArrowLayer.Mask = new CAShapeLayer { Frame = SelectionIndicatorArrowLayer.Bounds, Path = arrowPath.CGPath }; }
static void paintCodeRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(1.5f, 0.5f, 41, 8)); color.SetFill(); oval2Path.Fill(); UIColor.Black.SetStroke(); oval2Path.LineWidth = 2; oval2Path.Stroke(); //// Bezier 7 Drawing UIBezierPath bezier7Path = new UIBezierPath(); bezier7Path.MoveTo(new PointF(30.64f, 7.16f)); bezier7Path.AddCurveToPoint(new PointF(21.21f, 4.74f), new PointF(30.64f, 7.16f), new PointF(25.54f, 4.74f)); bezier7Path.AddCurveToPoint(new PointF(11.79f, 7.16f), new PointF(16.89f, 4.74f), new PointF(11.79f, 7.16f)); bezier7Path.AddLineTo(new PointF(11.79f, 4.74f)); bezier7Path.AddCurveToPoint(new PointF(21.21f, 1.1f), new PointF(11.79f, 4.74f), new PointF(16.5f, 1.48f)); bezier7Path.AddCurveToPoint(new PointF(30.64f, 4.74f), new PointF(25.93f, 0.72f), new PointF(30.64f, 4.74f)); bezier7Path.AddLineTo(new PointF(30.64f, 7.16f)); bezier7Path.ClosePath(); color.SetFill(); bezier7Path.Fill(); UIColor.Black.SetStroke(); bezier7Path.LineWidth = 1; bezier7Path.Stroke(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new PointF(21.42f, 9.18f)); bezier4Path.AddLineTo(new PointF(21.42f, 43.46f)); UIColor.Black.SetStroke(); bezier4Path.LineWidth = 1; bezier4Path.Stroke(); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new PointF(8.68f, 8.11f)); bezier5Path.AddLineTo(new PointF(8.68f, 42.39f)); UIColor.Black.SetStroke(); bezier5Path.LineWidth = 1; bezier5Path.Stroke(); //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new PointF(34.16f, 8.11f)); bezier6Path.AddLineTo(new PointF(34.16f, 42.39f)); UIColor.Black.SetStroke(); bezier6Path.LineWidth = 1; bezier6Path.Stroke(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new RectangleF(38.5f, 0.5f, 0, 0)); UIColor.White.SetFill(); ovalPath.Fill(); UIColor.Black.SetStroke(); ovalPath.LineWidth = 1; ovalPath.Stroke(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(0.58f, 3.82f)); bezierPath.AddLineTo(new PointF(1.22f, 40.93f)); UIColor.White.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 2; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(43.42f, 3.82f)); bezier2Path.AddLineTo(new PointF(43.42f, 39.18f)); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 2; bezier2Path.Stroke(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new PointF(1.5f, 40.5f)); bezier3Path.AddCurveToPoint(new PointF(21.5f, 43.5f), new PointF(1.5f, 40.5f), new PointF(10.69f, 43.12f)); bezier3Path.AddCurveToPoint(new PointF(43.5f, 38.5f), new PointF(32.31f, 43.88f), new PointF(43.5f, 38.5f)); UIColor.Black.SetStroke(); bezier3Path.LineWidth = 2; bezier3Path.Stroke(); }
static void paintCodeNonRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); //// Group { //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new RectangleF(0.5f, 0.5f, 21, 4)); color.SetFill(); oval2Path.Fill(); UIColor.Black.SetStroke(); oval2Path.LineWidth = 2; oval2Path.Stroke(); //// Bezier 7 Drawing UIBezierPath bezier7Path = new UIBezierPath(); bezier7Path.MoveTo(new PointF(15.32f, 3.58f)); bezier7Path.AddCurveToPoint(new PointF(10.61f, 2.37f), new PointF(15.32f, 3.58f), new PointF(12.77f, 2.37f)); bezier7Path.AddCurveToPoint(new PointF(5.89f, 3.58f), new PointF(8.45f, 2.37f), new PointF(5.89f, 3.58f)); bezier7Path.AddLineTo(new PointF(5.89f, 2.37f)); bezier7Path.AddCurveToPoint(new PointF(10.61f, 0.55f), new PointF(5.89f, 2.37f), new PointF(8.25f, 0.74f)); bezier7Path.AddCurveToPoint(new PointF(15.32f, 2.37f), new PointF(12.96f, 0.36f), new PointF(15.32f, 2.37f)); bezier7Path.AddLineTo(new PointF(15.32f, 3.58f)); bezier7Path.ClosePath(); color.SetFill(); bezier7Path.Fill(); UIColor.Black.SetStroke(); bezier7Path.LineWidth = 1; bezier7Path.Stroke(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new PointF(10.71f, 4.59f)); bezier4Path.AddLineTo(new PointF(10.71f, 21.73f)); UIColor.Black.SetStroke(); bezier4Path.LineWidth = 1; bezier4Path.Stroke(); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new PointF(4.34f, 4.05f)); bezier5Path.AddLineTo(new PointF(4.34f, 21.2f)); UIColor.Black.SetStroke(); bezier5Path.LineWidth = 1; bezier5Path.Stroke(); //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new PointF(17.08f, 4.05f)); bezier6Path.AddLineTo(new PointF(17.08f, 21.2f)); UIColor.Black.SetStroke(); bezier6Path.LineWidth = 1; bezier6Path.Stroke(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new RectangleF(19.5f, 0.5f, 0, 0)); UIColor.White.SetFill(); ovalPath.Fill(); UIColor.Black.SetStroke(); ovalPath.LineWidth = 1; ovalPath.Stroke(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(0.29f, 1.91f)); bezierPath.AddLineTo(new PointF(0.61f, 20.47f)); UIColor.White.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 2; bezierPath.Stroke(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(21.71f, 1.91f)); bezier2Path.AddLineTo(new PointF(21.71f, 19.59f)); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 2; bezier2Path.Stroke(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new PointF(0.75f, 20.25f)); bezier3Path.AddCurveToPoint(new PointF(10.75f, 21.75f), new PointF(0.75f, 20.25f), new PointF(5.34f, 21.56f)); bezier3Path.AddCurveToPoint(new PointF(21.75f, 19.25f), new PointF(16.16f, 21.94f), new PointF(21.75f, 19.25f)); UIColor.Black.SetStroke(); bezier3Path.LineWidth = 2; bezier3Path.Stroke(); } }
//Allow the user to import an array of points to be used to draw a signature in the view, with new //lines indicated by a PointF.Empty in the array. public void LoadPoints(PointF[] loadedPoints) { if (loadedPoints == null || loadedPoints.Count () == 0) return; var startIndex = 0; var emptyIndex = loadedPoints.ToList ().IndexOf (PointF.Empty); if (emptyIndex == -1) emptyIndex = loadedPoints.Count (); //Clear any existing paths or points. paths = new List<UIBezierPath> (); points = new List<PointF[]> (); do { //Create a new path and set the line options currentPath = UIBezierPath.Create (); currentPath.LineWidth = StrokeWidth; currentPath.LineJoinStyle = CGLineJoin.Round; currentPoints = new List<PointF> (); //Move to the first point and add that point to the current_points array. currentPath.MoveTo (loadedPoints [startIndex]); currentPoints.Add (loadedPoints [startIndex]); //Iterate through the array until an empty point (or the end of the array) is reached, //adding each point to the current_path and to the current_points array. for (var i = startIndex + 1; i < emptyIndex; i++) { currentPath.AddLineTo (loadedPoints [i]); currentPoints.Add (loadedPoints [i]); } //Add the current_path and current_points list to their respective Lists before //starting on the next line to be drawn. paths.Add (currentPath); points.Add (currentPoints.ToArray ()); //Obtain the indices for the next line to be drawn. startIndex = emptyIndex + 1; if (startIndex < loadedPoints.Count () - 1) { emptyIndex = loadedPoints.ToList ().IndexOf (PointF.Empty, startIndex); if (emptyIndex == -1) emptyIndex = loadedPoints.Count (); } else emptyIndex = startIndex; } while (startIndex < emptyIndex); //Obtain the image for the imported signature and display it in the image view. imageView.Image = GetImage (false); //Display the clear button. btnClear.Hidden = false; SetNeedsDisplay (); }
public static void paintCodeDrawQRRETINA() { //// Color Declarations UIColor color2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(11.5f, 7.5f, 13, 14)); UIColor.White.SetFill(); rectanglePath.Fill(); UIColor.Black.SetStroke(); rectanglePath.LineWidth = 1; rectanglePath.Stroke(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRect(new RectangleF(14.5f, 10.5f, 7, 8)); color2.SetFill(); rectangle2Path.Fill(); UIColor.Black.SetStroke(); rectangle2Path.LineWidth = 1; rectangle2Path.Stroke(); //// Rectangle 3 Drawing var rectangle3Path = UIBezierPath.FromRect(new RectangleF(57.5f, 7.5f, 13, 14)); UIColor.White.SetFill(); rectangle3Path.Fill(); UIColor.Black.SetStroke(); rectangle3Path.LineWidth = 1; rectangle3Path.Stroke(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRect(new RectangleF(60.5f, 10.5f, 7, 8)); color2.SetFill(); rectangle4Path.Fill(); UIColor.Black.SetStroke(); rectangle4Path.LineWidth = 1; rectangle4Path.Stroke(); //// Rectangle 5 Drawing var rectangle5Path = UIBezierPath.FromRect(new RectangleF(11.5f, 36.5f, 13, 14)); UIColor.White.SetFill(); rectangle5Path.Fill(); UIColor.Black.SetStroke(); rectangle5Path.LineWidth = 1; rectangle5Path.Stroke(); //// Rectangle 6 Drawing var rectangle6Path = UIBezierPath.FromRect(new RectangleF(14.5f, 39.5f, 7, 8)); color2.SetFill(); rectangle6Path.Fill(); UIColor.Black.SetStroke(); rectangle6Path.LineWidth = 1; rectangle6Path.Stroke(); //// Star Drawing UIBezierPath starPath = new UIBezierPath(); starPath.MoveTo(new PointF(41.5f, 21.5f)); starPath.AddLineTo(new PointF(45.73f, 27.42f)); starPath.AddLineTo(new PointF(52.91f, 29.45f)); starPath.AddLineTo(new PointF(48.35f, 35.13f)); starPath.AddLineTo(new PointF(48.55f, 42.3f)); starPath.AddLineTo(new PointF(41.5f, 39.9f)); starPath.AddLineTo(new PointF(34.45f, 42.3f)); starPath.AddLineTo(new PointF(34.65f, 35.13f)); starPath.AddLineTo(new PointF(30.09f, 29.45f)); starPath.AddLineTo(new PointF(37.27f, 27.42f)); starPath.ClosePath(); UIColor.White.SetFill(); starPath.Fill(); color2.SetStroke(); starPath.LineWidth = 3.5f; starPath.Stroke(); //// Star 2 Drawing UIBezierPath star2Path = new UIBezierPath(); star2Path.MoveTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.AddLineTo(new PointF(36.5f, 28.5f)); star2Path.ClosePath(); UIColor.White.SetFill(); star2Path.Fill(); UIColor.Black.SetStroke(); star2Path.LineWidth = 1; star2Path.Stroke(); //// Star 3 Drawing UIBezierPath star3Path = new UIBezierPath(); star3Path.MoveTo(new PointF(32.5f, 11)); star3Path.AddLineTo(new PointF(34.62f, 13.83f)); star3Path.AddLineTo(new PointF(38.21f, 14.8f)); star3Path.AddLineTo(new PointF(35.92f, 17.52f)); star3Path.AddLineTo(new PointF(36.03f, 20.95f)); star3Path.AddLineTo(new PointF(32.5f, 19.8f)); star3Path.AddLineTo(new PointF(28.97f, 20.95f)); star3Path.AddLineTo(new PointF(29.08f, 17.52f)); star3Path.AddLineTo(new PointF(26.79f, 14.8f)); star3Path.AddLineTo(new PointF(30.38f, 13.83f)); star3Path.ClosePath(); UIColor.White.SetFill(); star3Path.Fill(); UIColor.Black.SetStroke(); star3Path.LineWidth = 2.5f; star3Path.Stroke(); //// Star 4 Drawing UIBezierPath star4Path = new UIBezierPath(); star4Path.MoveTo(new PointF(50, 11.5f)); star4Path.AddLineTo(new PointF(51.94f, 14.07f)); star4Path.AddLineTo(new PointF(55.23f, 14.95f)); star4Path.AddLineTo(new PointF(53.14f, 17.43f)); star4Path.AddLineTo(new PointF(53.23f, 20.55f)); star4Path.AddLineTo(new PointF(50, 19.5f)); star4Path.AddLineTo(new PointF(46.77f, 20.55f)); star4Path.AddLineTo(new PointF(46.86f, 17.43f)); star4Path.AddLineTo(new PointF(44.77f, 14.95f)); star4Path.AddLineTo(new PointF(48.06f, 14.07f)); star4Path.ClosePath(); UIColor.White.SetFill(); star4Path.Fill(); UIColor.Black.SetStroke(); star4Path.LineWidth = 2.5f; star4Path.Stroke(); //// Star 5 Drawing UIBezierPath star5Path = new UIBezierPath(); star5Path.MoveTo(new PointF(62.5f, 36.5f)); star5Path.AddLineTo(new PointF(64.97f, 40.1f)); star5Path.AddLineTo(new PointF(69.16f, 41.34f)); star5Path.AddLineTo(new PointF(66.49f, 44.8f)); star5Path.AddLineTo(new PointF(66.61f, 49.16f)); star5Path.AddLineTo(new PointF(62.5f, 47.7f)); star5Path.AddLineTo(new PointF(58.39f, 49.16f)); star5Path.AddLineTo(new PointF(58.51f, 44.8f)); star5Path.AddLineTo(new PointF(55.84f, 41.34f)); star5Path.AddLineTo(new PointF(60.03f, 40.1f)); star5Path.ClosePath(); UIColor.White.SetFill(); star5Path.Fill(); UIColor.Black.SetStroke(); star5Path.LineWidth = 2.5f; star5Path.Stroke(); }
void Draw(RectangleF rect) { //// Color Declarations //// Frames var bgFrame = new RectangleF(0, 0, rect.Width, rect.Height); //// Subframes var circleGroup = new RectangleF(bgFrame.GetMinX() + (float)Math.Floor(bgFrame.Width * 0.13437f + 0.5f), bgFrame.GetMinY() + (float)Math.Floor(bgFrame.Height * 0.12500f + 0.5f), (float)Math.Floor(bgFrame.Width * 0.85938f + 0.5f) - (float)Math.Floor(bgFrame.Width * 0.13437f + 0.5f), (float)Math.Floor(bgFrame.Height * 0.84688f + 0.5f) - (float)Math.Floor(bgFrame.Height * 0.12500f + 0.5f)); //// Abstracted Attributes var progressOvalEndAngle = Progress; //// circleGroup { //// outerOval Drawing var outerOvalPath = UIBezierPath.FromOval(new RectangleF(circleGroup.GetMinX() + (float)Math.Floor(circleGroup.Width * 0.00216f) + 0.5f, circleGroup.GetMinY() + (float)Math.Floor(circleGroup.Height * 0.00000f + 0.5f), (float)Math.Floor(circleGroup.Width * 0.99784f) - (float)Math.Floor(circleGroup.Width * 0.00216f), (float)Math.Floor(circleGroup.Height * 1.00000f + 0.5f) - (float)Math.Floor(circleGroup.Height * 0.00000f + 0.5f))); OuterColor.SetFill(); outerOvalPath.Fill(); //// progressOval Drawing var progressOvalRect = new RectangleF(circleGroup.GetMinX() + (float)Math.Floor(circleGroup.Width * 0.00216f) + 0.5f, circleGroup.GetMinY() + (float)Math.Floor(circleGroup.Height * 0.00000f + 0.5f), (float)Math.Floor(circleGroup.Width * 0.99784f) - (float)Math.Floor(circleGroup.Width * 0.00216f), (float)Math.Floor(circleGroup.Height * 1.00000f + 0.5f) - (float)Math.Floor(circleGroup.Height * 0.00000f + 0.5f)); var progressOvalPath = new UIBezierPath(); progressOvalPath.AddArc(new PointF(progressOvalRect.GetMidX(), progressOvalRect.GetMidY()), progressOvalRect.Width / 2, (float)(270 * Math.PI / 180), (float)(progressOvalEndAngle * Math.PI / 180), true); progressOvalPath.AddLineTo(new PointF(progressOvalRect.GetMidX(), progressOvalRect.GetMidY())); progressOvalPath.ClosePath(); InnerColor.SetFill(); progressOvalPath.Fill(); //// innerOval Drawing var innerOvalPath = UIBezierPath.FromOval(new RectangleF(circleGroup.GetMinX() + (float)Math.Floor(circleGroup.Width * 0.09052f + 0.5f), circleGroup.GetMinY() + (float)Math.Floor(circleGroup.Height * 0.09091f + 0.5f), (float)Math.Floor(circleGroup.Width * 0.90948f + 0.5f) - (float)Math.Floor(circleGroup.Width * 0.09052f + 0.5f), (float)Math.Floor(circleGroup.Height * 0.91342f + 0.5f) - (float)Math.Floor(circleGroup.Height * 0.09091f + 0.5f))); InsideColor.SetFill(); innerOvalPath.Fill(); } }
public static void DrawBlueShirt(RectangleF frame, float shirtAngle, float shirtScaleFactor) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var blueShirtBase = UIColor.FromRGBA(0.173f, 0.435f, 0.702f, 1.000f); var blueShirtBaseRGBA = new float[4]; blueShirtBase.GetRGBA(out blueShirtBaseRGBA[0], out blueShirtBaseRGBA[1], out blueShirtBaseRGBA[2], out blueShirtBaseRGBA[3]); var blueShirtStroke = UIColor.FromRGBA((blueShirtBaseRGBA[0] * 0.7f + 0.3f), (blueShirtBaseRGBA[1] * 0.7f + 0.3f), (blueShirtBaseRGBA[2] * 0.7f + 0.3f), (blueShirtBaseRGBA[3] * 0.7f + 0.3f)); //// Shadow Declarations var blueShirtShadow = blueShirtBase.CGColor; var blueShirtShadowOffset = new SizeF(2.1f, 2.1f); var blueShirtShadowBlurRadius = 3.0f; //// shirtBezier Drawing context.SaveState(); context.TranslateCTM(frame.GetMinX() + 61.94f, frame.GetMinY() + 59.36f); context.RotateCTM(-shirtAngle * (float)Math.PI / 180.0f); context.ScaleCTM(shirtScaleFactor, shirtScaleFactor); UIBezierPath shirtBezierPath = new UIBezierPath(); shirtBezierPath.MoveTo(new PointF(-27.46f, -43.29f)); shirtBezierPath.AddCurveToPoint(new PointF(-11.8f, -30.19f), new PointF(-27.46f, -43.29f), new PointF(-15.62f, -33.38f)); shirtBezierPath.AddLineTo(new PointF(-10.9f, -30.19f)); shirtBezierPath.AddCurveToPoint(new PointF(-10.59f, -29.78f), new PointF(-10.8f, -30.05f), new PointF(-10.7f, -29.92f)); shirtBezierPath.AddCurveToPoint(new PointF(10.42f, -29.78f), new PointF(-4.79f, -22.48f), new PointF(4.62f, -22.48f)); shirtBezierPath.AddCurveToPoint(new PointF(10.74f, -30.19f), new PointF(10.53f, -29.92f), new PointF(10.63f, -30.05f)); shirtBezierPath.AddCurveToPoint(new PointF(11.8f, -30.19f), new PointF(10.74f, -30.19f), new PointF(11.13f, -30.19f)); shirtBezierPath.AddCurveToPoint(new PointF(27.46f, -43.29f), new PointF(15.62f, -33.38f), new PointF(27.46f, -43.29f)); shirtBezierPath.AddLineTo(new PointF(48.92f, -10.09f)); shirtBezierPath.AddLineTo(new PointF(32.09f, 3.99f)); shirtBezierPath.AddCurveToPoint(new PointF(27.12f, -3.69f), new PointF(32.09f, 3.99f), new PointF(30.0f, 0.76f)); shirtBezierPath.AddCurveToPoint(new PointF(27.12f, 43.29f), new PointF(27.12f, 17.36f), new PointF(27.12f, 43.29f)); shirtBezierPath.AddLineTo(new PointF(-27.46f, 43.29f)); shirtBezierPath.AddCurveToPoint(new PointF(-27.46f, -3.18f), new PointF(-27.46f, 43.29f), new PointF(-27.46f, 17.78f)); shirtBezierPath.AddCurveToPoint(new PointF(-32.09f, 3.99f), new PointF(-30.16f, 1.0f), new PointF(-32.09f, 3.99f)); shirtBezierPath.AddLineTo(new PointF(-48.92f, -10.09f)); shirtBezierPath.AddLineTo(new PointF(-27.46f, -43.29f)); shirtBezierPath.ClosePath(); context.SaveState(); context.SetShadowWithColor(blueShirtShadowOffset, blueShirtShadowBlurRadius, blueShirtShadow); blueShirtBase.SetFill(); shirtBezierPath.Fill(); context.RestoreState(); blueShirtStroke.SetStroke(); shirtBezierPath.LineWidth = 8.0f; shirtBezierPath.Stroke(); context.RestoreState(); //// Text Drawing context.SaveState(); context.TranslateCTM(frame.GetMinX() + 62.0f, frame.GetMinY() + 61.95f); context.RotateCTM(-shirtAngle * (float)Math.PI / 180.0f); context.ScaleCTM(shirtScaleFactor, shirtScaleFactor); RectangleF textRect = new RectangleF(-24.7f, -25.61f, 50.0f, 50.0f); var textPath = UIBezierPath.FromRect(textRect); UIColor.Red.SetStroke(); textPath.LineWidth = 1.0f; textPath.Stroke(); { var textContent = "?"; UIColor.White.SetFill(); var textFont = UIFont.FromName("HelveticaNeue-Bold", 36.0f); textRect.Offset(0.0f, (textRect.Height - new NSString(textContent).StringSize(textFont, textRect.Size).Height) / 2.0f); new NSString(textContent).DrawString(textRect, textFont, UILineBreakMode.WordWrap, UITextAlignment.Center); } context.RestoreState(); }
public override void Draw(RectangleF rect) { // Draw two appropriate corners, with cornerBackgroundColor behind them. if (this.CornerRadius < 0) { return; } float fMaxX = this.Bounds.GetMaxX(); float fMaxY =this.Bounds.GetMaxY(); UIBezierPath oPath = new UIBezierPath(); PointF oPt = PointF.Empty; switch (this.CornersPosition) { case CORNERS_POSITION.LeadingVertical: // top of screen for a left/right split oPath.MoveTo(oPt); oPt.Y += this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(90), 0f, true)); oPt.X += this.CornerRadius; oPt.Y -= this.CornerRadius; oPath.AddLineTo(oPt); oPath.AddLineTo(PointF.Empty); oPath.ClosePath();; oPt.X = fMaxX - this.CornerRadius; oPt.Y = 0; oPath.MoveTo(oPt); oPt.Y = fMaxY; oPath.AddLineTo(oPt); oPt.X += this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(180f), this.Deg2Rad(90), true)); oPt.Y -= this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -= this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); break; case CORNERS_POSITION.TrailingVertical: // bottom of screen for a left/right split oPt.Y = fMaxY; oPath.MoveTo(oPt); oPt.Y -= this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(270f), this.Deg2Rad(360), false)); oPt.X +=this.CornerRadius; oPt.Y +=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); oPt.X = fMaxX -this.CornerRadius; oPt.Y = fMaxY; oPath.MoveTo(oPt); oPt.Y -=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X +=this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(180f), this.Deg2Rad(270f), false)); oPt.Y +=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); break; case CORNERS_POSITION.LeadingHorizontal: // left of screen for a top/bottom split oPt.X = 0; oPt.Y =this.CornerRadius; oPath.MoveTo(oPt); oPt.Y -=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X +=this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(180), this.Deg2Rad(270), false)); oPt.Y +=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); oPt.X = 0; oPt.Y = fMaxY -this.CornerRadius; oPath.MoveTo(oPt); oPt.Y = fMaxY; oPath.AddLineTo(oPt); oPt.X +=this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(180f), this.Deg2Rad(90f), true)); oPt.Y -=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); break; case CORNERS_POSITION.TrailingHorizontal: // right of screen for a top/bottom split oPt.Y =this.CornerRadius; oPath.MoveTo(oPt); oPt.Y -=this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(270f), this.Deg2Rad(360f), false)); oPt.X +=this.CornerRadius; oPt.Y +=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); oPt.Y = fMaxY -this.CornerRadius; oPath.MoveTo(oPt); oPt.Y +=this.CornerRadius; oPath.AppendPath(UIBezierPath.FromArc(oPt, this.CornerRadius, this.Deg2Rad(90), 0f, true)); oPt.X +=this.CornerRadius; oPt.Y -=this.CornerRadius; oPath.AddLineTo(oPt); oPt.X -=this.CornerRadius; oPath.AddLineTo(oPt); oPath.ClosePath(); break; default: break; } this.CornerBackgroundColor.SetFill(); this.CornerBackgroundColor.SetStroke(); oPath.Fill(); }
public override void Draw (RectangleF rect) { base.Draw (rect); // ------------- START PAINTCODE ---------------- //// General Declarations var colorSpace = CGColorSpace.CreateDeviceRGB (); var context = UIGraphics.GetCurrentContext (); //// Color Declarations UIColor gold = UIColor.FromRGBA (1.00f, 0.95f, 0.57f, 1.00f); UIColor brown = UIColor.FromRGBA (0.79f, 0.75f, 0.18f, 1.00f); UIColor lightBrown = UIColor.FromRGBA (0.69f, 0.57f, 0.23f, 1.00f); UIColor darkishBlue = UIColor.FromRGBA (0.20f, 0.39f, 0.98f, 1.00f); UIColor bottomColorDown = UIColor.FromRGBA (0.21f, 0.21f, 0.21f, 1.00f); //// Gradient Declarations var newGradientColors = new CGColor [] {UIColor.Black.CGColor, UIColor.White.CGColor}; var newGradientLocations = new float [] {0, 1}; var newGradient = new CGGradient (colorSpace, newGradientColors, newGradientLocations); var calendarGradientColors = new CGColor [] { UIColor.DarkGray.CGColor, UIColor.FromRGBA (0.72f, 0.72f, 0.72f, 1.00f).CGColor, UIColor.White.CGColor }; var calendarGradientLocations = new float [] {0, 0.26f, 0.26f}; var calendarGradient = new CGGradient (colorSpace, calendarGradientColors, calendarGradientLocations); //// Shadow Declarations var shadow = UIColor.DarkGray.CGColor; var shadowOffset = new SizeF (2, 2); var shadowBlurRadius = 2; //// Abstracted Graphic Attributes var monthContent = "MAR"; var dayContent = "24"; var dayFont = UIFont.FromName ("Helvetica-Bold", 24); var textContent = "News Headline"; //// Oval 11 Drawing var oval11Path = UIBezierPath.FromOval (new RectangleF (256.5f, 46.5f, 13, 14)); lightBrown.SetFill (); oval11Path.Fill (); UIColor.Black.SetStroke (); oval11Path.LineWidth = 1; oval11Path.Stroke (); //// Oval 12 Drawing var oval12Path = UIBezierPath.FromOval (new RectangleF (280.5f, 46.5f, 13, 14)); lightBrown.SetFill (); oval12Path.Fill (); UIColor.Black.SetStroke (); oval12Path.LineWidth = 1; oval12Path.Stroke (); //// Rounded Rectangle Drawing var roundedRectanglePath = UIBezierPath.FromRoundedRect (new RectangleF (8.5f, 60.5f, 37, 36), 4); context.SaveState (); context.SetShadowWithColor (shadowOffset, shadowBlurRadius, shadow); context.BeginTransparencyLayer (null); roundedRectanglePath.AddClip (); context.DrawLinearGradient (calendarGradient, new PointF (27, 96.5f), new PointF (27, 60.5f), 0); context.EndTransparencyLayer (); context.RestoreState (); UIColor.DarkGray.SetStroke (); roundedRectanglePath.LineWidth = 1; roundedRectanglePath.Stroke (); //// Rounded Rectangle 3 Drawing UIBezierPath roundedRectangle3Path = new UIBezierPath (); roundedRectangle3Path.MoveTo (new PointF (9, 91.2f)); roundedRectangle3Path.AddCurveToPoint (new PointF (12.56f, 95), new PointF (9, 93.3f), new PointF (10.32f, 95)); roundedRectangle3Path.AddLineTo (new PointF (40.94f, 95)); roundedRectangle3Path.AddCurveToPoint (new PointF (45, 91.2f), new PointF (43.18f, 95), new PointF (45, 93.3f)); roundedRectangle3Path.AddLineTo (new PointF (45, 87)); roundedRectangle3Path.AddCurveToPoint (new PointF (43.42f, 85.5f), new PointF (45, 84.9f), new PointF (45.66f, 85.5f)); roundedRectangle3Path.AddLineTo (new PointF (10.94f, 85.5f)); roundedRectangle3Path.AddCurveToPoint (new PointF (9, 87), new PointF (8.7f, 85.5f), new PointF (9, 84.9f)); roundedRectangle3Path.AddLineTo (new PointF (9, 91.2f)); roundedRectangle3Path.ClosePath (); UIColor.Red.SetFill (); roundedRectangle3Path.Fill (); //// Month Drawing var monthRect = new RectangleF (10, 84, 34, 15); UIColor.White.SetFill (); new NSString (monthContent).DrawString ( monthRect, UIFont.FromName("Helvetica-Bold", 9), UILineBreakMode.WordWrap, UITextAlignment.Center ); //// Day Drawing var dayRect = new RectangleF (0, 58, 54, 31); UIColor.Black.SetFill (); new NSString (dayContent).DrawString (dayRect, dayFont, UILineBreakMode.WordWrap, UITextAlignment.Center); //// Text Drawing var textRect = new RectangleF (54, 60, 75, 38); UIColor.Black.SetFill (); new NSString (textContent).DrawString ( textRect, UIFont.FromName("Helvetica", 16), UILineBreakMode.WordWrap, UITextAlignment.Left ); //// Star Drawing UIBezierPath starPath = new UIBezierPath (); starPath.MoveTo (new PointF (31, 14.5f)); starPath.AddLineTo (new PointF (26.24f, 21.45f)); starPath.AddLineTo (new PointF (18.16f, 23.83f)); starPath.AddLineTo (new PointF (23.3f, 30.5f)); starPath.AddLineTo (new PointF (23.06f, 38.92f)); starPath.AddLineTo (new PointF (31, 36.1f)); starPath.AddLineTo (new PointF (38.94f, 38.92f)); starPath.AddLineTo (new PointF (38.7f, 30.5f)); starPath.AddLineTo (new PointF (43.84f, 23.83f)); starPath.AddLineTo (new PointF (35.76f, 21.45f)); starPath.ClosePath (); gold.SetFill (); starPath.Fill (); brown.SetStroke (); starPath.LineWidth = 1; starPath.Stroke (); //// Blue blob Drawing UIBezierPath blueBlobPath = new UIBezierPath (); blueBlobPath.MoveTo (new PointF (256.5f, 16.5f)); blueBlobPath.AddCurveToPoint (new PointF (240.5f, 41.5f), new PointF (235.5f, 37.5f), new PointF (217.53f, 41.55f)); blueBlobPath.AddCurveToPoint (new PointF (265.5f, 30.5f), new PointF (263.47f, 41.45f), new PointF (265.5f, 30.5f)); blueBlobPath.AddCurveToPoint (new PointF (256.5f, 16.5f), new PointF (265.5f, 30.5f), new PointF (277.5f, -4.5f)); blueBlobPath.ClosePath (); blueBlobPath.MiterLimit = 2; blueBlobPath.LineJoinStyle = CGLineJoin.Round; darkishBlue.SetFill (); blueBlobPath.Fill (); bottomColorDown.SetStroke (); blueBlobPath.LineWidth = 1; blueBlobPath.Stroke (); //// Button Drawing var buttonPath = UIBezierPath.FromRoundedRect (new RectangleF (54.5f, 10.5f, 163, 31), 4); context.SaveState (); buttonPath.AddClip (); context.DrawRadialGradient (newGradient, new PointF (100.39f, 55.13f), 7.84f, new PointF (136, 26), 86.67f, CGGradientDrawingOptions.DrawsBeforeStartLocation | CGGradientDrawingOptions.DrawsAfterEndLocation); context.RestoreState (); UIColor.Black.SetStroke (); buttonPath.LineWidth = 1; buttonPath.Stroke (); //// Smiley face Drawing var smileyFacePath = UIBezierPath.FromOval (new RectangleF (159.5f, 49.5f, 47, 47)); gold.SetFill (); smileyFacePath.Fill (); UIColor.Black.SetStroke (); smileyFacePath.LineWidth = 1; smileyFacePath.Stroke (); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval (new RectangleF (169.5f, 64.5f, 8, 8)); UIColor.Black.SetFill (); oval2Path.Fill (); UIColor.Black.SetStroke (); oval2Path.LineWidth = 1; oval2Path.Stroke (); //// Oval 3 Drawing var oval3Path = UIBezierPath.FromOval (new RectangleF (188.5f, 64.5f, 8, 8)); UIColor.Black.SetFill (); oval3Path.Fill (); UIColor.Black.SetStroke (); oval3Path.LineWidth = 1; oval3Path.Stroke (); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath (); bezier2Path.MoveTo (new PointF (172.5f, 80.5f)); bezier2Path.AddCurveToPoint (new PointF (185.5f, 85.5f), new PointF (177.75f, 85), new PointF (182.04f, 86.03f)); bezier2Path.AddCurveToPoint (new PointF (194.5f, 79.5f), new PointF (191.27f, 84.62f), new PointF (194.5f, 79.5f)); UIColor.Black.SetStroke (); bezier2Path.LineWidth = 2; bezier2Path.Stroke (); //// Oval 5 Drawing var oval5Path = UIBezierPath.FromOval (new RectangleF (256.5f, 52.5f, 36, 33)); lightBrown.SetFill (); oval5Path.Fill (); UIColor.Black.SetStroke (); oval5Path.LineWidth = 1; oval5Path.Stroke (); //// Oval 6 Drawing var oval6Path = UIBezierPath.FromOval (new RectangleF (262.5f, 59.5f, 10, 19)); UIColor.White.SetFill (); oval6Path.Fill (); UIColor.Black.SetStroke (); oval6Path.LineWidth = 1; oval6Path.Stroke (); //// Oval 7 Drawing var oval7Path = UIBezierPath.FromOval (new RectangleF (275.5f, 59.5f, 10, 19)); UIColor.White.SetFill (); oval7Path.Fill (); UIColor.Black.SetStroke (); oval7Path.LineWidth = 1; oval7Path.Stroke (); //// Oval 9 Drawing var oval9Path = UIBezierPath.FromOval (new RectangleF (264.5f, 68.5f, 6, 5)); UIColor.Black.SetFill (); oval9Path.Fill (); UIColor.Black.SetStroke (); oval9Path.LineWidth = 1; oval9Path.Stroke (); //// Oval 10 Drawing var oval10Path = UIBezierPath.FromOval (new RectangleF (277.5f, 68.5f, 6, 5)); UIColor.Black.SetFill (); oval10Path.Fill (); UIColor.Black.SetStroke (); oval10Path.LineWidth = 1; oval10Path.Stroke (); //// Oval 4 Drawing var oval4Path = UIBezierPath.FromOval (new RectangleF (250.5f, 70.5f, 47, 24)); lightBrown.SetFill (); oval4Path.Fill (); UIColor.Black.SetStroke (); oval4Path.LineWidth = 1; oval4Path.Stroke (); //// Oval 8 Drawing var oval8Path = UIBezierPath.FromOval (new RectangleF (267.5f, 77.5f, 9, 4)); UIColor.Black.SetFill (); oval8Path.Fill (); UIColor.Black.SetStroke (); oval8Path.LineWidth = 1; oval8Path.Stroke (); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath (); bezier5Path.MoveTo (new PointF (270.5f, 81.5f)); bezier5Path.AddCurveToPoint (new PointF (267.5f, 88.5f), new PointF (269.5f, 85.5f), new PointF (267.5f, 88.5f)); UIColor.Black.SetStroke (); bezier5Path.LineWidth = 1; bezier5Path.Stroke (); //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath (); bezier6Path.MoveTo (new PointF (272.5f, 81.5f)); bezier6Path.AddLineTo (new PointF (274.5f, 87.5f)); UIColor.Black.SetStroke (); bezier6Path.LineWidth = 1; bezier6Path.Stroke (); // ------------- END PAINTCODE ---------------- }
// To intermix custom drawing with the drawing performed by an associated print formatter, // this method is called for each print formatter associated with a given page. // // We do this to intermix/overlay our custom drawing onto the recipe presentation. // We draw the upper portion of the recipe presentation by hand (image, title, desc), // and the bottom portion is drawn via the UIMarkupTextPrintFormatter. public override void DrawPrintFormatterForPage (UIPrintFormatter printFormatter, int page) { base.DrawPrintFormatterForPage (printFormatter, page); // To keep our custom drawing in sync with the printFormatter, base our drawing // on the formatters rect. RectangleF rect = printFormatter.RectangleForPage (page); // Use a bezier path to draw the borders. // We may potentially choose not to draw either the top or bottom line // of the border depending on whether our recipe extended from the previous // page, or carries onto the subsequent page. UIBezierPath border = new UIBezierPath (); if (page == printFormatter.StartPage) { // For border drawing, get the rect that includes the formatter area plus the header area. // Move the formatter's rect up the size of the custom drawn recipe presentation // and essentially grow the rect's height by this amount. rect.Height += RecipeInfoHeight; rect.Y -= RecipeInfoHeight; border.MoveTo (rect.Location); border.AddLineTo (new PointF (rect.Right, rect.Top)); Recipe recipe = recipeFormatterMap[printFormatter]; // Run custom code to draw upper portion of the recipe presentation (image, title, desc) DrawRecipe (recipe, rect); } // Draw the left border border.MoveTo (rect.Location); border.AddLineTo (new PointF (rect.Left, rect.Bottom)); // Draw the right border border.MoveTo (new PointF (rect.Right, rect.Top)); border.AddLineTo (new PointF (rect.Right, rect.Bottom)); if (page == printFormatter.StartPage + printFormatter.PageCount - 1) border.AddLineTo (new PointF (rect.Left, rect.Bottom)); // Set the UIColor to be used by the current graphics context, and then stroke // stroke the current path that is defined by the border bezier path. UIColor.Black.SetColor (); border.Stroke (); }
public static UIImage MakeLetter() { bool retina = (UIScreen.MainScreen.Scale > 1.0); if (retina) { UIGraphics.BeginImageContext (new System.Drawing.SizeF (44, 44)); //START PAINTCODE RETINA //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); UIColor color3 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Group { //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(3.5f, 6.5f, 36, 29)); color.SetFill(); rectanglePath.Fill(); color3.SetStroke(); rectanglePath.LineWidth = 2; rectanglePath.Stroke(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(4, 7)); bezierPath.AddLineTo(new PointF(22.52f, 22.37f)); bezierPath.AddLineTo(new PointF(40, 7)); color.SetFill(); bezierPath.Fill(); color3.SetStroke(); bezierPath.LineWidth = 2; bezierPath.Stroke(); } //END PAINTCODE RETINA } else { UIGraphics.BeginImageContext (new System.Drawing.SizeF (22, 22)); //start paintcode NON RETINA //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 0.000f); UIColor color3 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Group { //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new RectangleF(2.5f, 2.5f, 17, 17)); color.SetFill(); rectanglePath.Fill(); color3.SetStroke(); rectanglePath.LineWidth = 2; rectanglePath.Stroke(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new PointF(2.49f, 2.6f)); bezierPath.AddLineTo(new PointF(11.5f, 11.82f)); bezierPath.AddLineTo(new PointF(20, 2.6f)); color.SetFill(); bezierPath.Fill(); color3.SetStroke(); bezierPath.LineWidth = 2; bezierPath.Stroke(); } //END PAINTCODE NON RETINA } var converted = UIGraphics.GetImageFromCurrentImageContext (); UIGraphics.EndImageContext (); return converted; }
static void paintCodeNonRetina() { //// Color Declarations UIColor color = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new PointF(10.03f, 2.93f)); bezier2Path.AddCurveToPoint(new PointF(14, 3.7f), new PointF(11.38f, 2.78f), new PointF(12.76f, 3.04f)); bezier2Path.AddLineTo(new PointF(14.65f, 3.5f)); bezier2Path.AddLineTo(new PointF(15.34f, 2.43f)); bezier2Path.AddLineTo(new PointF(16.03f, 3.5f)); bezier2Path.AddLineTo(new PointF(17.2f, 3.86f)); bezier2Path.AddLineTo(new PointF(16.45f, 4.89f)); bezier2Path.AddLineTo(new PointF(16.48f, 5.84f)); bezier2Path.AddCurveToPoint(new PointF(17.12f, 6.84f), new PointF(16.72f, 6.16f), new PointF(16.93f, 6.49f)); bezier2Path.AddLineTo(new PointF(17.73f, 6.13f)); bezier2Path.AddLineTo(new PointF(18.65f, 7.2f)); bezier2Path.AddLineTo(new PointF(20.21f, 7.57f)); bezier2Path.AddLineTo(new PointF(19.21f, 8.6f)); bezier2Path.AddLineTo(new PointF(19.26f, 9.89f)); bezier2Path.AddLineTo(new PointF(18.04f, 9.55f)); bezier2Path.AddCurveToPoint(new PointF(17.78f, 13.58f), new PointF(18.26f, 10.89f), new PointF(18.17f, 12.28f)); bezier2Path.AddLineTo(new PointF(18.93f, 14.06f)); bezier2Path.AddLineTo(new PointF(18.19f, 15.43f)); bezier2Path.AddLineTo(new PointF(18.22f, 17.17f)); bezier2Path.AddLineTo(new PointF(17.08f, 16.59f)); bezier2Path.AddLineTo(new PointF(15.93f, 17.17f)); bezier2Path.AddLineTo(new PointF(15.93f, 16.78f)); bezier2Path.AddCurveToPoint(new PointF(14.98f, 17.65f), new PointF(15.63f, 17.1f), new PointF(15.31f, 17.39f)); bezier2Path.AddLineTo(new PointF(15.01f, 17.72f)); bezier2Path.AddLineTo(new PointF(15.91f, 18.05f)); bezier2Path.AddLineTo(new PointF(15.34f, 18.97f)); bezier2Path.AddLineTo(new PointF(15.36f, 20.12f)); bezier2Path.AddLineTo(new PointF(14.47f, 19.73f)); bezier2Path.AddLineTo(new PointF(13.57f, 20.12f)); bezier2Path.AddLineTo(new PointF(13.6f, 18.97f)); bezier2Path.AddLineTo(new PointF(13.36f, 18.58f)); bezier2Path.AddCurveToPoint(new PointF(10.72f, 19.08f), new PointF(12.51f, 18.92f), new PointF(11.61f, 19.09f)); bezier2Path.AddLineTo(new PointF(10.75f, 20.45f)); bezier2Path.AddLineTo(new PointF(9.47f, 19.92f)); bezier2Path.AddLineTo(new PointF(8.2f, 20.45f)); bezier2Path.AddLineTo(new PointF(8.23f, 18.86f)); bezier2Path.AddLineTo(new PointF(7.99f, 18.49f)); bezier2Path.AddCurveToPoint(new PointF(5.55f, 16.71f), new PointF(7.1f, 18.09f), new PointF(6.27f, 17.5f)); bezier2Path.AddLineTo(new PointF(5.53f, 16.68f)); bezier2Path.AddLineTo(new PointF(5.54f, 17.17f)); bezier2Path.AddLineTo(new PointF(4.26f, 16.59f)); bezier2Path.AddLineTo(new PointF(2.98f, 17.17f)); bezier2Path.AddLineTo(new PointF(3.02f, 15.43f)); bezier2Path.AddLineTo(new PointF(2.19f, 14.06f)); bezier2Path.AddLineTo(new PointF(3.49f, 13.57f)); bezier2Path.AddLineTo(new PointF(3.68f, 13.23f)); bezier2Path.AddCurveToPoint(new PointF(3.39f, 11.19f), new PointF(3.5f, 12.56f), new PointF(3.41f, 11.88f)); bezier2Path.AddLineTo(new PointF(2.64f, 11.37f)); bezier2Path.AddLineTo(new PointF(2.68f, 10.36f)); bezier2Path.AddLineTo(new PointF(1.77f, 9.56f)); bezier2Path.AddLineTo(new PointF(3.2f, 9.27f)); bezier2Path.AddLineTo(new PointF(3.65f, 8.82f)); bezier2Path.AddLineTo(new PointF(3.51f, 8.88f)); bezier2Path.AddLineTo(new PointF(3.55f, 7.29f)); bezier2Path.AddLineTo(new PointF(2.64f, 6.04f)); bezier2Path.AddLineTo(new PointF(4.07f, 5.59f)); bezier2Path.AddLineTo(new PointF(4.91f, 4.28f)); bezier2Path.AddLineTo(new PointF(5.55f, 5.27f)); bezier2Path.AddCurveToPoint(new PointF(6.69f, 4.24f), new PointF(5.91f, 4.87f), new PointF(6.29f, 4.53f)); bezier2Path.AddLineTo(new PointF(6.54f, 3.58f)); bezier2Path.AddLineTo(new PointF(8.6f, 1.5f)); bezier2Path.AddLineTo(new PointF(10.03f, 2.93f)); bezier2Path.ClosePath(); bezier2Path.MoveTo(new PointF(7.7f, 7.81f)); bezier2Path.AddCurveToPoint(new PointF(7.7f, 13.7f), new PointF(6.01f, 9.44f), new PointF(6.01f, 12.07f)); bezier2Path.AddCurveToPoint(new PointF(13.85f, 13.7f), new PointF(9.4f, 15.33f), new PointF(12.15f, 15.33f)); bezier2Path.AddCurveToPoint(new PointF(13.85f, 7.81f), new PointF(15.54f, 12.07f), new PointF(15.54f, 9.44f)); bezier2Path.AddCurveToPoint(new PointF(7.7f, 7.81f), new PointF(12.15f, 6.18f), new PointF(9.4f, 6.18f)); bezier2Path.ClosePath(); color.SetFill(); bezier2Path.Fill(); UIColor.Black.SetStroke(); bezier2Path.LineWidth = 1; bezier2Path.Stroke(); }