public override void Draw(CGRect frame) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX() + 14.0f, frame.GetMinY() + 2.0f, NMath.Floor((frame.Width - 14.0f) * 0.20776f + 0.5f), 21.0f), UIRectCorner.TopLeft | UIRectCorner.TopRight, new SizeF(4.0f, 4.0f)); rectanglePath.ClosePath(); Helpers.Colours.Green.SetFill(); rectanglePath.Fill(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX(), frame.GetMinY() + 23.0f, 375.0f, 1.0f)); Helpers.Colours.Green.SetFill(); rectangle2Path.Fill(); //// Text Drawing CGRect textRect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.03733f + 0.5f), frame.GetMinY() + 3.0f, NMath.Floor(frame.Width * 0.23733f + 0.5f) - NMath.Floor(frame.Width * 0.03733f + 0.5f), 21.0f); UIColor.White.SetFill(); var textStyle = new NSMutableParagraphStyle(); textStyle.Alignment = UITextAlignment.Center; var textFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Medium", UIFont.SmallSystemFontSize), ForegroundColor = UIColor.White, ParagraphStyle = textStyle }; var textTextHeight = new NSString(header).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height; context.SaveState(); context.ClipToRect(textRect); new NSString(header).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.FromName("Avenir-Medium", UIFont.SmallSystemFontSize), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); }
public static void TPKeyboardAvoiding_findTextFieldAfterTextFieldbeneathViewminYfoundView(this UIScrollView scrollView, UIView firstResponder, UIView beneathView, float minY, UIView foundView) { // Search recursively for text field or text view below firstResponder nfloat priorFieldOffset = scrollView.ConvertRectFromView(firstResponder.Frame, firstResponder.Superview).GetMinY(); foreach (UIView childView in beneathView.Subviews) { if (childView.Hidden) { continue; } if ((childView is UITextView || childView is UITextField) && childView.UserInteractionEnabled) { CGRect frame = scrollView.ConvertRectFromView(childView.Frame, beneathView); if (childView != firstResponder && frame.GetMinY() >= priorFieldOffset && frame.GetMinY() < minY && !(FEqual((float)frame.Y, (float)firstResponder.Frame.Y)) && frame.X < firstResponder.Frame.X) { minY = (float)frame.GetMinY(); foundView = childView; } } else { scrollView.TPKeyboardAvoiding_findTextFieldAfterTextFieldbeneathViewminYfoundView(firstResponder, childView, minY, foundView); } } }
//// Drawing Methods public static void DrawTimer(CGRect frame, float percentage) { var context = UIGraphics.GetCurrentContext(); var expression = 360.0f - percentage; var coverViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 5.0f, frame.GetMinY() + 4.0f, 230.0f, 230.0f)); DemoStyleKit.Purple.SetFill(); coverViewPath.Fill(); context.SaveState(); context.TranslateCTM(frame.GetMinX() + 120.0f, frame.GetMinY() + 119.0f); context.RotateCTM(-90.0f * NMath.PI / 180.0f); var completedViewRect = new CGRect(-115.0f, -115.0f, 230.0f, 230.0f); var completedViewPath = new UIBezierPath(); completedViewPath.AddArc(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY()), completedViewRect.Width / 2.0f, (nfloat)(-360.0f * NMath.PI/180), (nfloat)(-expression * NMath.PI/180.0f), true); completedViewPath.AddLineTo(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY())); completedViewPath.ClosePath(); DemoStyleKit.Green.SetFill(); completedViewPath.Fill(); context.RestoreState(); var backgroundViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 10.0f, frame.GetMinY() + 9.0f, 220.0f, 220.0f)); DemoStyleKit.Purple.SetFill(); backgroundViewPath.Fill(); }
private void DrawTakePhotoButton(CGRect frame) { var color = UIColor.White; var bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.08333f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.27302f * frame.Width, frame.GetMinY() + 0.15053f * frame.Height), new CGPoint(frame.GetMinX() + 0.41628f * frame.Width, frame.GetMinY() + 0.08333f * frame.Height), new CGPoint(frame.GetMinX() + 0.33832f * frame.Width, frame.GetMinY() + 0.10803f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.08333f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.15883f * frame.Width, frame.GetMinY() + 0.22484f * frame.Height), new CGPoint(frame.GetMinX() + 0.08333f * frame.Width, frame.GetMinY() + 0.35360f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.91667f * frame.Height), new CGPoint(frame.GetMinX() + 0.08333f * frame.Width, frame.GetMinY() + 0.73012f * frame.Height), new CGPoint(frame.GetMinX() + 0.26988f * frame.Width, frame.GetMinY() + 0.91667f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.91667f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.73012f * frame.Width, frame.GetMinY() + 0.91667f * frame.Height), new CGPoint(frame.GetMinX() + 0.91667f * frame.Width, frame.GetMinY() + 0.73012f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.08333f * frame.Height), new CGPoint(frame.GetMinX() + 0.91667f * frame.Width, frame.GetMinY() + 0.26988f * frame.Height), new CGPoint(frame.GetMinX() + 0.73012f * frame.Width, frame.GetMinY() + 0.08333f * frame.Height)); bezierPath.ClosePath(); bezierPath.MoveTo(new CGPoint(frame.GetMinX() + 1.00000f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 1.00000f * frame.Height), new CGPoint(frame.GetMinX() + 1.00000f * frame.Width, frame.GetMinY() + 0.77614f * frame.Height), new CGPoint(frame.GetMinX() + 0.77614f * frame.Width, frame.GetMinY() + 1.00000f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.00000f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.22386f * frame.Width, frame.GetMinY() + 1.00000f * frame.Height), new CGPoint(frame.GetMinX() + 0.00000f * frame.Width, frame.GetMinY() + 0.77614f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.19894f * frame.Width, frame.GetMinY() + 0.10076f * frame.Height), new CGPoint(frame.GetMinX() + 0.00000f * frame.Width, frame.GetMinY() + 0.33689f * frame.Height), new CGPoint(frame.GetMinX() + 0.07810f * frame.Width, frame.GetMinY() + 0.19203f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.50000f * frame.Width, frame.GetMinY() + 0.00000f * frame.Height), new CGPoint(frame.GetMinX() + 0.28269f * frame.Width, frame.GetMinY() + 0.03751f * frame.Height), new CGPoint(frame.GetMinX() + 0.38696f * frame.Width, frame.GetMinY() + 0.00000f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 1.00000f * frame.Width, frame.GetMinY() + 0.50000f * frame.Height), new CGPoint(frame.GetMinX() + 0.77614f * frame.Width, frame.GetMinY() + 0.00000f * frame.Height), new CGPoint(frame.GetMinX() + 1.00000f * frame.Width, frame.GetMinY() + 0.22386f * frame.Height)); bezierPath.ClosePath(); color.SetFill(); bezierPath.Fill(); UIColor.Black.SetStroke(); bezierPath.LineWidth = 1.0f; bezierPath.Stroke(); var ovalPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.12500f + 0.5f), frame.GetMinY() + NMath.Floor(frame.Height * 0.12500f + 0.5f), NMath.Floor(frame.Width * 0.87500f + 0.5f) - NMath.Floor(frame.Width * 0.12500f + 0.5f), NMath.Floor(frame.Height * 0.87500f + 0.5f) - NMath.Floor(frame.Height * 0.12500f + 0.5f))); color.SetFill(); ovalPath.Fill(); UIColor.Black.SetStroke(); ovalPath.LineWidth = 1.0f; ovalPath.Stroke(); }
void AdjustInputToolbarOnTextViewSizeChanged(nfloat dy) { bool isIncreasing = dy > 0; // Find commentArea view foreach (UIView view in this.View.Subviews) { if (view.GetType() == typeof(CommentAreaView)) { activeviewarea = view; } } // Bottom of the controller = initial position + height + offset (relative to the screen) UIView relativePositionView = UIApplication.SharedApplication.KeyWindow; CGRect relativeFrame = activeviewarea.Superview.ConvertRectToView(activeviewarea.Frame, relativePositionView); if ((relativeFrame.GetMinY() == TopLayoutGuide.Length) && isIncreasing) { return; } nfloat oldY = relativeFrame.GetMinY(); nfloat newY = oldY - dy; if (newY < TopLayoutGuide.Length) { dy = oldY - TopLayoutGuide.Length; } AdjustInputToolbar(dy); }
/// <summary> /// Constrains the bounds rect. /// </summary> /// <returns>The bounds rect.</returns> /// <param name="proposedBounds">Proposed bounds.</param> public override CoreGraphics.CGRect ConstrainBoundsRect(CoreGraphics.CGRect proposedBounds) { // Anything to process if (DocumentView == null) { return(base.ConstrainBoundsRect(proposedBounds)); } // Get new bounds and insets var newClipBoundsRect = base.ConstrainBoundsRect(proposedBounds); var insets = ConvertContentInsetsToProposedBoundsSize(newClipBoundsRect.Size); // Get the insets in terms of the view geometry edges var minYInset = IsFlipped ? insets.Top : insets.Bottom; var maxYInset = IsFlipped ? insets.Bottom : insets.Top; var minXInset = insets.Left; var maxXInset = insets.Right; // Get and outset the `documentView`'s frame by the scaled contentInsets. var documentFrame = DocumentView.Frame; var outsetDocumentFrame = new CGRect(documentFrame.GetMinX() - minXInset, documentFrame.GetMinY() - minYInset, (documentFrame.Width + (minXInset + maxXInset)), (documentFrame.Height + (minYInset + maxYInset))); if (newClipBoundsRect.Width > outsetDocumentFrame.Width) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX() - (newClipBoundsRect.Width - outsetDocumentFrame.Width) / 2.0f; } else if (newClipBoundsRect.Width < outsetDocumentFrame.Width) { if (newClipBoundsRect.GetMaxX() > outsetDocumentFrame.GetMaxX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMaxX() - newClipBoundsRect.Width; } else if (newClipBoundsRect.GetMinX() < outsetDocumentFrame.GetMinX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX(); } } if (newClipBoundsRect.Height > outsetDocumentFrame.Height) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY() - (newClipBoundsRect.Height - outsetDocumentFrame.Height) / 2.0f; } else if (newClipBoundsRect.Height < outsetDocumentFrame.Height) { if (newClipBoundsRect.GetMaxY() > outsetDocumentFrame.GetMaxY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMaxY() - newClipBoundsRect.Height; } else if (newClipBoundsRect.GetMinY() < outsetDocumentFrame.GetMinY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY(); } } return(BackingAlignedRect(newClipBoundsRect, NSAlignmentOptions.AllEdgesNearest)); }
public override CoreGraphics.CGRect ConstrainBoundsRect(CGRect proposedBounds) { if (DocumentView == null) { return(base.ConstrainBoundsRect(proposedBounds)); } CGRect newClipBoundsRect = base.ConstrainBoundsRect(proposedBounds); NSEdgeInsets insets = ConvertetContentInsetsToProposedBoundsSize(newClipBoundsRect.Size); nfloat minYInset = IsFlipped ? insets.Top : insets.Bottom; nfloat maxYInset = IsFlipped ? insets.Bottom : insets.Top; nfloat minXInset = insets.Left; nfloat maxXInset = insets.Right; CGRect documentFrame = DocumentView.Frame; CGRect outsetDocumentFrame = new CGRect( documentFrame.GetMinX() - minXInset, documentFrame.GetMinY() - minYInset, documentFrame.Width + (minXInset + maxXInset), documentFrame.Height + (minYInset + maxYInset)); if (newClipBoundsRect.Width > outsetDocumentFrame.Width) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX() - (newClipBoundsRect.Width - outsetDocumentFrame.Width) / 2.0f; } else if (newClipBoundsRect.Width < outsetDocumentFrame.Width) { if (newClipBoundsRect.GetMaxX() > outsetDocumentFrame.GetMaxX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMaxX() - newClipBoundsRect.Width; } else if (newClipBoundsRect.GetMinX() < outsetDocumentFrame.GetMinX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX(); } } if (newClipBoundsRect.Height > outsetDocumentFrame.Height) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY() - (newClipBoundsRect.Height - outsetDocumentFrame.Height) / 2.0f; } else if (newClipBoundsRect.Height < outsetDocumentFrame.Height) { if (newClipBoundsRect.GetMaxY() > outsetDocumentFrame.GetMaxY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMaxY() - newClipBoundsRect.Height; } else if (newClipBoundsRect.GetMinY() < outsetDocumentFrame.GetMinY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY(); } } return(BackingAlignedRect(newClipBoundsRect, NSAlignmentOptions.AllEdgesNearest)); }
public TrackedPolyRect(CGRect cgRect, UIColor color, TrackedPolyRectStyle style = TrackedPolyRectStyle.Solid) { this.topLeft = new CGPoint(cgRect.GetMinX(), cgRect.GetMaxY()); this.topRight = new CGPoint(cgRect.GetMaxX(), cgRect.GetMaxY()); this.bottomLeft = new CGPoint(cgRect.GetMinX(), cgRect.GetMinY()); this.bottomRight = new CGPoint(cgRect.GetMaxX(), cgRect.GetMinY()); this.Color = color; this.Style = style; }
public static float MaxDistance(CGPoint point, CGRect rect) { var tl = Distance(point, new CGPoint(x: rect.GetMinX(), y: rect.GetMinY())); var tr = Distance(point, new CGPoint(x: rect.GetMaxX(), y: rect.GetMinY())); var bl = Distance(point, new CGPoint(x: rect.GetMinX(), y: rect.GetMaxY())); var br = Distance(point, new CGPoint(x: rect.GetMaxX(), y: rect.GetMaxY())); return(Math.Max(tl, Math.Max(tr, Math.Max(bl, br)))); }
private void DrawFourWinged(CGRect rect) { //// Rectangle 2 Drawing UIBezierPath rectangle2Path = new UIBezierPath(); rectangle2Path.MoveTo(new CGPoint(rect.GetMinX() + 36.0f, rect.GetMinY() + 35.0f)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 51.0f, rect.GetMinY() + 22.0f), new CGPoint(rect.GetMinX() + 35.55f, rect.GetMinY() + 30.32f), new CGPoint(rect.GetMinX() + 38.68f, rect.GetMinY() + 22.0f)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 65.0f, rect.GetMinY() + 33.0f), new CGPoint(rect.GetMinX() + 62.87f, rect.GetMinY() + 22.0f), new CGPoint(rect.GetMinX() + 64.9f, rect.GetMinY() + 28.88f)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.44000f * rect.Height), new CGPoint(rect.GetMinX() + 65.14f, rect.GetMinY() + 38.95f), new CGPoint(rect.GetMinX() + 0.59613f * rect.Width, rect.GetMinY() + 0.42938f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.48344f * rect.Height), new CGPoint(rect.GetMinX() + 0.60712f * rect.Width, rect.GetMinY() + 0.46251f * rect.Height), new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.44163f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.69242f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.59378f * rect.Width, rect.GetMinY() + 0.76814f * rect.Height), new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.72837f * rect.Height), new CGPoint(rect.GetMinX() + 0.60000f * rect.Width, rect.GetMinY() + 0.74928f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.59288f * rect.Width, rect.GetMinY() + 0.77179f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.50975f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height), new CGPoint(rect.GetMinX() + 0.58016f * rect.Width, rect.GetMinY() + 0.80674f * rect.Height), new CGPoint(rect.GetMinX() + 0.54694f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.50500f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height), new CGPoint(rect.GetMinX() + 0.50500f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height), new CGPoint(rect.GetMinX() + 0.50500f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.50500f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.50500f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.50025f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.41712f * rect.Width, rect.GetMinY() + 0.77179f * rect.Height), new CGPoint(rect.GetMinX() + 0.46306f * rect.Width, rect.GetMinY() + 0.83000f * rect.Height), new CGPoint(rect.GetMinX() + 0.42984f * rect.Width, rect.GetMinY() + 0.80674f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.41000f * rect.Width, rect.GetMinY() + 0.68656f * rect.Height), new CGPoint(rect.GetMinX() + 0.41000f * rect.Width, rect.GetMinY() + 0.74928f * rect.Height), new CGPoint(rect.GetMinX() + 0.41000f * rect.Width, rect.GetMinY() + 0.72837f * rect.Height)); rectangle2Path.AddLineTo(new CGPoint(rect.GetMinX() + 0.41000f * rect.Width, rect.GetMinY() + 0.69242f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 0.42000f * rect.Width, rect.GetMinY() + 0.44000f * rect.Height), new CGPoint(rect.GetMinX() + 0.41000f * rect.Width, rect.GetMinY() + 0.44163f * rect.Height), new CGPoint(rect.GetMinX() + 0.42000f * rect.Width, rect.GetMinY() + 0.44000f * rect.Height)); rectangle2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 36.0f, rect.GetMinY() + 35.0f), new CGPoint(rect.GetMinX() + 0.42340f * rect.Width, rect.GetMinY() + 0.43067f * rect.Height), new CGPoint(rect.GetMinX() + 36.55f, rect.GetMinY() + 40.72f)); rectangle2Path.ClosePath(); UIColor.Gray.SetFill(); rectangle2Path.Fill(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.12000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.40000f + 0.5f), NMath.Floor(rect.Width * 0.45000f + 0.5f) - NMath.Floor(rect.Width * 0.12000f + 0.5f), NMath.Floor(rect.Height * 0.61000f + 0.5f) - NMath.Floor(rect.Height * 0.40000f + 0.5f))); UIColor.Gray.SetFill(); oval2Path.Fill(); //// Oval 3 Drawing var oval3Path = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.21000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.55000f + 0.5f), NMath.Floor(rect.Width * 0.45000f + 0.5f) - NMath.Floor(rect.Width * 0.21000f + 0.5f), NMath.Floor(rect.Height * 0.73000f + 0.5f) - NMath.Floor(rect.Height * 0.55000f + 0.5f))); UIColor.Gray.SetFill(); oval3Path.Fill(); //// Oval 4 Drawing var oval4Path = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.55000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.40000f + 0.5f), NMath.Floor(rect.Width * 0.88000f + 0.5f) - NMath.Floor(rect.Width * 0.55000f + 0.5f), NMath.Floor(rect.Height * 0.61000f + 0.5f) - NMath.Floor(rect.Height * 0.40000f + 0.5f))); UIColor.Gray.SetFill(); oval4Path.Fill(); //// Oval 5 Drawing var oval5Path = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.55000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.55000f + 0.5f), NMath.Floor(rect.Width * 0.79000f + 0.5f) - NMath.Floor(rect.Width * 0.55000f + 0.5f), NMath.Floor(rect.Height * 0.73000f + 0.5f) - NMath.Floor(rect.Height * 0.55000f + 0.5f))); UIColor.Gray.SetFill(); oval5Path.Fill(); }
void InitializeFramePositions() { CGRect moverRect = Bounds.Inset(Bounds.Size.Width / 4, Bounds.Size.Height / 4); CGPoint origin = moverRect.Location; origin.X = 0; moverRect.Location = origin; mover = new NSImageView(moverRect); leftPosition = new CGPoint(0, moverRect.GetMinY()); rightPosition = new CGPoint(Bounds.GetMaxX() - moverRect.Width, moverRect.GetMinY()); isRight = false; }
public override void DrawInContext(CoreGraphics.CGContext ctx) { CGRect rect = this.BoundsRect(); CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB(); nfloat [] colors = new nfloat[] { 0.42f, 0.66f, 0.31f, 1.0f, 0.95f, 0.76f, 0.20f, 1.0f, 0.80f, 0.25f, 0.15f, 1.0f }; CGGradient gradient = new CGGradient(colorSpace, colors, null); nuint tickSpaces = this.Axis.MajorTickCount - 1; nuint pointsCount = 5; if (this.Chart.Frame.Size.Height < this.Chart.Frame.Size.Width) { pointsCount = 3; } nfloat diameter = 8; nfloat spaceHeight = rect.Size.Height / tickSpaces; nfloat spacing = (spaceHeight - (pointsCount * diameter)) / (pointsCount + 1); nuint allPointsCount = pointsCount * tickSpaces; CGPath multipleCirclePath = new CGPath(); double y = rect.GetMinY() + diameter / 2.0f + spacing; for (uint i = 1; i <= allPointsCount; i++) { CGPoint center = new CGPoint(rect.GetMidX(), y); CGPath path = new CGPath(); path.AddArc(center.X, center.Y, (nfloat)diameter / 2.0f, 0, (nfloat)Math.PI * 2, true); multipleCirclePath.AddPath(path); y += spacing + diameter; if (i % pointsCount == 0) { y += spacing; } } ctx.SaveState(); ctx.AddPath(multipleCirclePath); ctx.Clip(); CGPoint startPoint = new CGPoint(rect.GetMidX(), rect.GetMinY()); CGPoint endPoint = new CGPoint(rect.GetMidX(), rect.GetMaxY()); ctx.DrawLinearGradient(gradient, startPoint, endPoint, 0); ctx.RestoreState(); base.DrawInContext(ctx); }
internal static CGPath CreateClippingPath(CGRect rect, float radius) { var path = new CGPath(); path.MoveToPoint(rect.GetMinX(), rect.GetMinY()); path.AddLineToPoint(rect.GetMinX(), rect.GetMaxY() - radius); path.AddArcToPoint(rect.GetMinX(), rect.GetMaxY(), rect.GetMinX() + radius, rect.GetMaxY(), radius); path.AddLineToPoint(rect.GetMaxX() - radius, rect.GetMaxY()); path.AddArcToPoint(rect.GetMaxX(), rect.GetMaxY(), rect.GetMaxX(), rect.GetMaxY() - radius, radius); path.AddLineToPoint(rect.GetMaxX(), rect.GetMinY()); path.CloseSubpath(); 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); }
public override void Draw(CGRect rect) { base.Draw(rect); if (BorderWidthAll > 0) { BorderWidth = new UIEdgeInsets(BorderWidthAll, BorderWidthAll, BorderWidthAll, BorderWidthAll); } if (BorderColorAll != null) { BorderColorTop = BorderColorBottom = BorderColorLeft = BorderColorRight = BorderColorAll; } var xMin = rect.GetMinX(); var xMax = rect.GetMaxX(); var yMin = rect.GetMinY(); var yMax = rect.GetMaxY(); var fWidth = this.Frame.Size.Width; var fHeight = this.Frame.Size.Height; var context = UIGraphics.GetCurrentContext(); DrawBorders(context, xMin, xMax, yMin, yMax, fWidth, fHeight); }
public AnimationFrameBase FrameForTimeTransform(AnimatedView view, int time, AnimationFrameBase startKeyFrameBase, AnimationFrameBase endKeyFrameBase) { var startKeyFrame = startKeyFrameBase as AnimationFrame; var endKeyFrame = endKeyFrameBase as AnimationFrame; int startTime = startKeyFrame.Time; int endTime = endKeyFrame.Time; CGRect startLocation = new CGRect(startKeyFrame.xPosition, startKeyFrame.yPosition, startKeyFrame.frameSize.ToSizeF().Width, startKeyFrame.frameSize.ToSizeF().Height); CGRect endLocation = new CGRect(endKeyFrame.xPosition, endKeyFrame.yPosition, endKeyFrame.frameSize.ToSizeF().Width, endKeyFrame.frameSize.ToSizeF().Height); CGRect nativeViewSize = new CGRect(view.X, view.Y, view.Width, view.Height); UIView nativeView = ConvertFormsToNative(view, nativeViewSize); CGRect frame = nativeView.Frame; frame.Location = new PointF( Animation.TweenValueForStartTime(startTime, endTime, (Single)startLocation.GetMinX(), (Single)endLocation.GetMinX(), time), Animation.TweenValueForStartTime(startTime, endTime, (Single)startLocation.GetMinY(), (Single)endLocation.GetMinY(), time)); frame.Size = new SizeF(Animation.TweenValueForStartTime(startTime, endTime, (Single)startLocation.Width, (Single)endLocation.Width, time), Animation.TweenValueForStartTime(startTime, endTime, (Single)startLocation.Height, (Single)endLocation.Height, time)); AnimationFrame animationFrame = new AnimationFrame(); animationFrame.xPosition = (int)nativeView.Center.X; animationFrame.yPosition = (int)nativeView.Center.Y; animationFrame.frameSize = new Xamarin.Forms.Size(frame.Width, frame.Height); return(animationFrame); }
private void DrawBox(CGContext context, CGRect trect, float fRadius) { float fWidth = (float)trect.Width; float fHeight = (float)trect.Height; if (fRadius > fWidth / 2.0f) { fRadius = fWidth / 2.0f; } if (fRadius > fHeight / 2.0f) { fRadius = fHeight / 2.0f; } float fMinX = (float)trect.GetMinX(); float fMidX = (float)trect.GetMidX(); float fMaxX = (float)trect.GetMaxX(); float fMinY = (float)trect.GetMinY(); float fMidY = (float)trect.GetMidY(); float fMaxY = (float)trect.GetMaxY(); context.MoveTo(fMinX, fMidY); context.AddArcToPoint(fMinX, fMinY, fMidX / 2, fMinY, fRadius); context.AddLineToPoint(fMidX - 5, fMinY); context.AddLineToPoint(fMidX, fMinY - 5); context.AddLineToPoint(fMidX + 5, fMinY); context.AddArcToPoint(fMaxX, fMinY, fMaxX, fMidY, fRadius); context.AddArcToPoint(fMaxX, fMaxY, fMidX, fMaxY, fRadius); context.AddArcToPoint(fMinX, fMaxY, fMinX, fMidY, fRadius); }
//// Drawing Methods public static void DrawTimer(CGRect frame, float percentage) { var context = UIGraphics.GetCurrentContext(); var expression = 360.0f - percentage; var coverViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 5.0f, frame.GetMinY() + 4.0f, 230.0f, 230.0f)); DemoStyleKit.Purple.SetFill(); coverViewPath.Fill(); context.SaveState(); context.TranslateCTM(frame.GetMinX() + 120.0f, frame.GetMinY() + 119.0f); context.RotateCTM(-90.0f * NMath.PI / 180.0f); var completedViewRect = new CGRect(-115.0f, -115.0f, 230.0f, 230.0f); var completedViewPath = new UIBezierPath(); completedViewPath.AddArc(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY()), completedViewRect.Width / 2.0f, (nfloat)(-360.0f * NMath.PI / 180), (nfloat)(-expression * NMath.PI / 180.0f), true); completedViewPath.AddLineTo(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY())); completedViewPath.ClosePath(); DemoStyleKit.Green.SetFill(); completedViewPath.Fill(); context.RestoreState(); var backgroundViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 10.0f, frame.GetMinY() + 9.0f, 220.0f, 220.0f)); DemoStyleKit.Purple.SetFill(); backgroundViewPath.Fill(); }
private void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler) { if (CGRect.Intersect (newRect, oldRect) != CGRect.Empty) { var oldMaxY = oldRect.GetMaxY (); var oldMinY = oldRect.GetMinY (); var newMaxY = newRect.GetMaxY (); var newMinY = newRect.GetMinY (); if (newMaxY > oldMaxY) { var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Size.Width, (newMaxY - oldMaxY)); addedHandler (rectToAdd); } if (oldMinY > newMinY) { var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Size.Width, (oldMinY - newMinY)); addedHandler (rectToAdd); } if (newMaxY < oldMaxY) { var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Size.Width, (oldMaxY - newMaxY)); removedHandler (rectToRemove); } if (oldMinY < newMinY) { var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Size.Width, (newMinY - oldMinY)); removedHandler (rectToRemove); } } else { addedHandler (newRect); removedHandler (oldRect); } }
/*** * Expand `rect' to the smallest standardized rect containing it with pixel-aligned origin and size. * If @c scale is zero, then a scale of 1 will be used instead. * * @param rect the rectangle to align. * @param scale the scale factor to use for pixel alignment. * * @return the input rectangle aligned to the nearest pixels using the provided scale factor. * * @see CGRectIntegral */ public static CGRect MDCRectAlignToScale(CGRect rect, nfloat scale) { if (rect.IsNull()) { return(CGRect.Null); } if (MDCCGFloatEqual(scale, 0)) { scale = 1; } if (MDCCGFloatEqual(scale, 1)) { return(rect.Integral()); } CGPoint originalMinimumPoint = new CGPoint(rect.GetMinX(), rect.GetMinY()); CGPoint newOrigin = new CGPoint(MDCFloor(originalMinimumPoint.X * scale) / scale, MDCFloor(originalMinimumPoint.Y * scale) / scale); CGSize adjustWidthHeight = new CGSize(originalMinimumPoint.X - newOrigin.X, originalMinimumPoint.Y - newOrigin.Y); return(new CGRect(newOrigin.X, newOrigin.Y, MDCCeil((rect.Width + adjustWidthHeight.Width) * scale) / scale, MDCCeil((rect.Height + adjustWidthHeight.Height) * scale) / scale)); }
//Generated with PaintCode 2.2 public override void Draw(CGRect rect) { base.Draw(rect); // General Declarations var colorSpace = CGColorSpace.CreateDeviceRGB(); var context = UIGraphics.GetCurrentContext(); // Color Declarations var darkBlue = UIColor.FromRGBA(0.053f, 0.123f, 0.198f, 1.000f); var lightBlue = UIColor.FromRGBA(0.191f, 0.619f, 0.845f, 1.000f); // Gradient Declarations var backgroundGradientColors = new CGColor [] {lightBlue.CGColor, darkBlue.CGColor}; var backgroundGradientLocations = new nfloat [] {0.0f, 1.0f}; var backgroundGradient = new CGGradient(colorSpace, backgroundGradientColors, backgroundGradientLocations); // Rectangle Drawing var rectangleRect = new CGRect(rect.GetMinX() + (float)Math.Floor(rect.Width * -0.12917f + 0.5f), rect.GetMinY() + (float)Math.Floor(rect.Height * 0.00000f + 0.5f), (float)Math.Floor(rect.Width * 1.00000f + 0.5f) - (float)Math.Floor(rect.Width * -0.12917f + 0.5f), (float)Math.Floor(rect.Height * 1.00000f + 0.5f) - (float)Math.Floor(rect.Height * 0.00000f + 0.5f)); var rectanglePath = UIBezierPath.FromRect(rectangleRect); context.SaveState(); rectanglePath.AddClip(); context.DrawLinearGradient(backgroundGradient, new PointF((float)rectangleRect.GetMidX(), (float)rectangleRect.GetMinY()), new PointF((float)rectangleRect.GetMidX(), (float)rectangleRect.GetMaxY()), 0); context.RestoreState(); }
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(); }
public override void Draw(CGRect rect) { base.Draw(rect); if (BorderWidthAll > 0) { BorderWidth = new UIEdgeInsets(BorderWidthAll, BorderWidthAll, BorderWidthAll, BorderWidthAll); } if (BorderColorAll != null) { BorderColorTop = BorderColorBottom = BorderColorLeft = BorderColorRight = BorderColorAll; } var xMin = rect.GetMinX(); var xMax = rect.GetMaxX(); var yMin = rect.GetMinY(); var yMax = rect.GetMaxY(); var fWidth = this.Frame.Size.Width; var fHeight = this.Frame.Size.Height; var context = UIGraphics.GetCurrentContext(); if (context != null) DrawBorders(context, xMin, xMax, yMin, yMax, fWidth, fHeight); }
void MoveJaguarPrintToPresentedPosition(bool presentedPosition) { CGSize horizontalJaguarSize = jaguarPrintImageH.Size; CGSize verticalJaguarSize = jaguarPrintImageV.Size; CGRect frameOfView = FrameOfPresentedViewInContainerView; CGRect containerFrame = ContainerView.Frame; CGRect topFrame, bottomFrame, leftFrame, rightFrame; topFrame = bottomFrame = leftFrame = rightFrame = CGRect.Empty; topFrame.Height = bottomFrame.Height = horizontalJaguarSize.Height; topFrame.Width = bottomFrame.Width = frameOfView.Width; leftFrame.Width = rightFrame.Width = verticalJaguarSize.Width; leftFrame.Height = rightFrame.Height = frameOfView.Height; topFrame.X = frameOfView.X; bottomFrame.X = frameOfView.X; leftFrame.Y = frameOfView.Y; rightFrame.Y = frameOfView.Y; CGRect frameToAlignAround = presentedPosition ? frameOfView : containerFrame; topFrame.Y = frameToAlignAround.GetMinY() - horizontalJaguarSize.Height; bottomFrame.Y = frameToAlignAround.GetMaxY(); leftFrame.X = frameToAlignAround.GetMinX() - verticalJaguarSize.Width; rightFrame.X = frameToAlignAround.GetMaxX(); topJaguarPrintImageView.Frame = topFrame; bottomJaguarPrintImageView.Frame = bottomFrame; leftJaguarPrintImageView.Frame = leftFrame; rightJaguarPrintImageView.Frame = rightFrame; }
public override AnimationFrameBase FrameForTime(int time, AnimationFrameBase startKeyFrameBase, AnimationFrameBase endKeyFrameBase) { var startKeyFrame = startKeyFrameBase as AnimationFrame; var endKeyFrame = endKeyFrameBase as AnimationFrame; int startTime = startKeyFrame.Time; int endTime = endKeyFrame.Time; CGRect startLocation = startKeyFrame.Frame; CGRect endLocation = endKeyFrame.Frame; CGRect frame = View.Frame; frame.Location = new PointF( TweenValueForStartTime(startTime, endTime, (Single)startLocation.GetMinX(), (Single)endLocation.GetMinX(), time), TweenValueForStartTime(startTime, endTime, (Single)startLocation.GetMinY(), (Single)endLocation.GetMinY(), time)); frame.Size = new SizeF(TweenValueForStartTime(startTime, endTime, (Single)startLocation.Width, (Single)endLocation.Width, time), TweenValueForStartTime(startTime, endTime, (Single)startLocation.Height, (Single)endLocation.Height, time)); AnimationFrame animationFrame = new AnimationFrame(); animationFrame.Frame = frame; return(animationFrame); }
public override void Draw(CGRect frame) { //base.Draw(frame); Initialize(); var rectanglePath = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + (float)Math.Floor(frame.Width * 0.00000f + 0.5f), frame.GetMinY() + (float)Math.Floor(frame.Height * 0.00000f + 0.5f), (float)Math.Floor(frame.Width * 1.00000f + 0.5f) - (float)Math.Floor(frame.Width * 0.00000f + 0.5f), (float)Math.Floor(frame.Height * 1.00000f + 0.5f) - (float)Math.Floor(frame.Height * 0.00000f + 0.5f))); _tmpCol.SetFill(); rectanglePath.Fill(); }
public override void Draw(CGRect frame) { // General Declarations var context = UIGraphics.GetCurrentContext(); // Color Declarations var color4 = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var color5 = UIColor.FromRGBA(0.793f, 0.793f, 0.793f, 1.000f); // Shadow Declarations var shadow = new NSShadow(); shadow.ShadowColor = UIColor.Black.ColorWithAlpha(0.28f); shadow.ShadowOffset = new CGSize(3.1f, 3.1f); shadow.ShadowBlurRadius = 5.0f; // Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect( new CGRect(frame.GetMinX() + 10.5f, frame.GetMinY() + 7.5f, frame.Width - 20.0f, 76.0f), 4.0f); context.SaveState(); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor); color4.SetFill(); rectanglePath.Fill(); context.RestoreState(); color5.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); // Bezier 2 Drawing var bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(frame.GetMinX() + 0.02386f*frame.Width, frame.GetMinY() + 0.50543f*frame.Height)); bezier2Path.AddLineTo(new CGPoint(frame.GetMinX() + 0.97841f*frame.Width, frame.GetMinY() + 0.50543f*frame.Height)); context.SaveState(); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor); color4.SetFill(); bezier2Path.Fill(); context.RestoreState(); color5.SetStroke(); bezier2Path.LineWidth = 1.0f; bezier2Path.Stroke(); }
//// Drawing Methods public static void DrawCanvas1(CGRect frame, float percentage, int currentIndex, int totalPages) { if (totalPages <= 10) { var newFrameWidth = frame.Width / 2; var newFrame = new CGRect(newFrameWidth - (newFrameWidth / 2), frame.Y, newFrameWidth, frame.Height); frame = newFrame; } //// Color Declarations var color = FromHex(0x4F8C13); //UIColor.Green;//FromRGBA(255, 252, 127, 255); //// Rectangle Drawing //var rectanglePath = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + 20.0f, frame.GetMinY() + NMath.Floor((frame.Height - 1.0f) * 0.47619f + 0.5f), frame.Width - 40.0f, 1.0f)); //UIColor.Gray.SetFill(); //rectanglePath.Fill(); nfloat mainIndicatorWidth = 14.0f; for (int i = 0; i < totalPages; i++) { if (i != 0 && i != (totalPages - 1)) { var cPage = i; var cPercentage = (nfloat)cPage / ((nfloat)totalPages - 1f); DrawIndicatorAtPercentage(frame, mainIndicatorWidth / 6, cPercentage, cPage); } } //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 1f, frame.GetMinY() + NMath.Floor((frame.Height - 20.0f) * 0.50000f + 0.5f), 15.0f, 15.0f)); UIColor.LightGray.SetStroke(); ovalPath.LineWidth = 1f; ovalPath.Stroke(); color.SetFill(); ovalPath.Fill(); ////// Oval 4 Drawing var oval4Path = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + frame.Width - 21f, frame.GetMinY() + NMath.Floor((frame.Height - 20.0f) * 0.50000f + 0.5f), 15.0f, 15.0f)); UIColor.LightGray.SetStroke(); oval4Path.LineWidth = 1f; oval4Path.Stroke(); color.SetFill(); oval4Path.Fill(); DrawIndicatorAtPercentage(frame, mainIndicatorWidth, percentage, currentIndex); }
void DrawFish(CGRect rect) { // Oval Drawing var ovalPath = UIBezierPath.FromOval(new CGRect(rect.GetMinX() + NMath.Floor(rect.Width * 0.07000f + 0.5f), rect.GetMinY() + NMath.Floor(rect.Height * 0.30000f + 0.5f), NMath.Floor(rect.Width * 0.75000f + 0.5f) - NMath.Floor(rect.Width * 0.07000f + 0.5f), NMath.Floor(rect.Height * 0.69000f + 0.5f) - NMath.Floor(rect.Height * 0.30000f + 0.5f))); UIColor.Gray.SetFill(); ovalPath.Fill(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(rect.GetMinX() + 0.49020f * rect.Width, rect.GetMinY() + 0.50000f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.88235f * rect.Width, rect.GetMinY() + 0.32000f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.88235f * rect.Width, rect.GetMinY() + 0.69000f * rect.Height)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 0.49020f * rect.Width, rect.GetMinY() + 0.50000f * rect.Height)); UIColor.Gray.SetFill(); bezierPath.Fill(); }
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(); }
public override void Draw(CGRect rect) { if (SplitViewController.DividerStyle == MGSplitViewDividerStyle.Thin) { base.Draw(rect); } else if (SplitViewController.DividerStyle == MGSplitViewDividerStyle.PaneSplitter) { // Draw gradient background. CGRect bounds = Bounds; CGColorSpace rgb = CGColorSpace.CreateDeviceRGB(); nfloat[] locations = { 0, 1 }; nfloat[] components = { 0.988f, 0.988f, 0.988f, 1.0f, // light 0.875f, 0.875f, 0.875f, 1.0f }; // dark CGGradient gradient = new CGGradient(rgb, components, locations); CGContext context = UIGraphics.GetCurrentContext(); CGPoint start, end; if (SplitViewController.Vertical) { // Light left to dark right. start = new CGPoint(bounds.GetMinX(), bounds.GetMidY()); end = new CGPoint(bounds.GetMaxX(), bounds.GetMidY()); } else { // Light top to dark bottom. start = new CGPoint(bounds.GetMidX(), bounds.GetMinY()); end = new CGPoint(bounds.GetMidX(), bounds.GetMaxY()); } context.DrawLinearGradient(gradient, start, end, CGGradientDrawingOptions.DrawsBeforeStartLocation); // Draw borders. float borderThickness = 10; UIColor.FromWhiteAlpha(0.7f, 1).SetColor(); CGRect borderRect = bounds; if (SplitViewController.Vertical) { borderRect.Width = borderThickness; context.FillRect(borderRect); borderRect.X = bounds.GetMaxX() - borderThickness; context.FillRect(borderRect); } else { borderRect.Height = borderThickness; context.FillRect(borderRect); borderRect.Y = bounds.GetMaxY() - borderThickness; context.FillRect(borderRect); } // Draw grip. DrawGripThumbInRect(bounds); } }
public override void Draw(CGRect frame) { var context = UIGraphics.GetCurrentContext(); var expression = 377.0f - percentage; // coverView Drawing var coverViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 5.0f, frame.GetMinY() + 4.0f, frame.Width - 10.0f, frame.Height - 10.0f)); UIColor.FromRGB(21, 169, 254).SetFill(); coverViewPath.Fill(); // completedView Drawing context.SaveState(); context.SaveState(); context.TranslateCTM(frame.GetMaxX() - 65.0f, frame.GetMinY() + 64.0f); context.RotateCTM(-90.0f * NMath.PI / 180.0f); var completedViewRect = new CGRect(-60.0f, -60.0f, 120.0f, 120.0f); var completedViewPath = new UIBezierPath(); completedViewPath.AddArc(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY()), completedViewRect.Width / 2.0f, -360.0f * NMath.PI / 180, -(expression - 17.0f) * NMath.PI / 180.0f, true); completedViewPath.AddLineTo(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY())); completedViewPath.ClosePath(); UIColor.FromRGB(247, 247, 247).SetFill(); completedViewPath.Fill(); context.RestoreState(); // backgroundView Drawing var backgroundViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 12.0f, frame.GetMinY() + 11.0f, frame.Width - 24.0f, frame.Height - 24.0f)); UIColor.FromRGB(21, 169, 254).SetFill(); backgroundViewPath.Fill(); }
private void DrawArc(CGContext context, CGRect rect) { var radius = rect.GetMaxY() * badgeCornerRoundness; var puffer = new nfloat(Padding(rect)); var maxX = rect.GetMaxX() - puffer; var maxY = rect.GetMaxY() - puffer; var minX = rect.GetMinX() + puffer; var minY = rect.GetMinY() + puffer; double pi = Math.PI; context.AddArc(new nfloat(maxX - radius), new nfloat(minY + radius), new nfloat(radius), new nfloat(pi + (pi / 2)), 0, false); context.AddArc(new nfloat(maxX - radius), new nfloat(minY - radius), new nfloat(radius), 0, new nfloat(pi / 2), false); }
void DrawLeftBorder(CGContext ctx, CGRect rect) { if (ViewInfo.LeftBorderThickness <= 0) { return; } ctx.SetStrokeColor(ViewInfo.LeftBorderColor.CGColor); ctx.SetLineWidth((nfloat)ViewInfo.LeftBorderThickness); ctx.BeginPath(); ctx.MoveTo(rect.GetMinX(), rect.GetMinY()); ctx.AddLineToPoint(rect.GetMinX(), rect.GetMaxY()); ctx.StrokePath(); }
public CGRect GetLocation(CGRect faceBounds) { var imgSize = Image.Size; switch (Type) { case NoveltyType.Mustache: return(new CGRect(faceBounds.X, faceBounds.GetMinY(), faceBounds.Width, imgSize.Height)); case NoveltyType.Hat: return(new CGRect(faceBounds.X, faceBounds.Y - imgSize.Height, faceBounds.Width, imgSize.Height)); } return(new CGRect(faceBounds.Location, imgSize)); }
public override void Draw(CGRect rect) { BackgroundColor = UIColor.Clear; //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var borderColor = UIColor.FromRGBA(0.856f, 0.856f, 0.856f, 1.000f); var textColor = UIColor.FromRGBA(0.404f, 0.404f, 0.404f, 1.000f); //// Shadow Declarations var shadow = new NSShadow(); shadow.ShadowColor = UIColor.Black.ColorWithAlpha(0.07f); shadow.ShadowOffset = new CGSize(0.1f, -0.1f); shadow.ShadowBlurRadius = 10.0f; //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 10.0f, rect.GetMinY() + 10.0f, rect.Width - 26.0f, rect.Height - 21.5f), 4.0f); context.SaveState(); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor); UIColor.White.SetFill(); rectanglePath.Fill(); context.RestoreState(); borderColor.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); //// Text Drawing CGRect textRect = new CGRect(rect.GetMinX() + 28.0f, rect.GetMinY() + 10.0f, rect.Width - 62.0f, rect.Height - 22.0f); textColor.SetFill(); var textStyle = new NSMutableParagraphStyle(); textStyle.Alignment = UITextAlignment.Center; var textFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("AvenirNext-Regular", UIFont.LabelFontSize), ForegroundColor = textColor, ParagraphStyle = textStyle }; var textTextHeight = new NSString(title).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height; context.SaveState(); context.ClipToRect(textRect); new NSString(title).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.FromName("AvenirNext-Regular", UIFont.LabelFontSize), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); }
public override void Draw(CGRect frame) { var context = UIGraphics.GetCurrentContext(); var expression = 377.0f - percentage; // coverView Drawing var coverViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 5.0f, frame.GetMinY() + 4.0f, frame.Width - 10.0f, frame.Height - 10.0f)); UIColor.FromRGB(21, 169, 254).SetFill(); coverViewPath.Fill(); // completedView Drawing context.SaveState(); context.SaveState(); context.TranslateCTM(frame.GetMaxX() - 65.0f, frame.GetMinY() + 64.0f); context.RotateCTM(-90.0f*NMath.PI/180.0f); var completedViewRect = new CGRect(-60.0f, -60.0f, 120.0f, 120.0f); var completedViewPath = new UIBezierPath(); completedViewPath.AddArc(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY()), completedViewRect.Width/2.0f, -360.0f*NMath.PI/180, -(expression - 17.0f)*NMath.PI/180.0f, true); completedViewPath.AddLineTo(new CGPoint(completedViewRect.GetMidX(), completedViewRect.GetMidY())); completedViewPath.ClosePath(); UIColor.FromRGB(247, 247, 247).SetFill(); completedViewPath.Fill(); context.RestoreState(); // backgroundView Drawing var backgroundViewPath = UIBezierPath.FromOval(new CGRect(frame.GetMinX() + 12.0f, frame.GetMinY() + 11.0f, frame.Width - 24.0f, frame.Height - 24.0f)); UIColor.FromRGB(21, 169, 254).SetFill(); backgroundViewPath.Fill(); }
public override void Draw(CGRect rect) { using (var context = UIGraphics.GetCurrentContext ()) { // get the scale from the context by getting the current transform matrix, then asking for // its "a" component, which is one of the two scale components. We could also ask for "d". // This assumes (safely) that the view is being scaled equally in both dimensions. var scale = context.GetCTM ().xx; CATiledLayer tiledLayer = (CATiledLayer)this.Layer; var tileSize = tiledLayer.TileSize; // Even at scales lower than 100%, we are drawing into a rect in the coordinate system of the full // image. One tile at 50% covers the width (in original image coordinates) of two tiles at 100%. // So at 50% we need to stretch our tiles to double the width and height; at 25% we need to stretch // them to quadruple the width and height; and so on. // (Note that this means that we are drawing very blurry images as the scale gets low. At 12.5%, // our lowest scale, we are stretching about 6 small tiles to fill the entire original image area. // But this is okay, because the big blurry image we're drawing here will be scaled way down before // it is displayed.) tileSize.Width /= scale; tileSize.Height /= scale; // calculate the rows and columns of tiles that intersect the rect we have been asked to draw int firstCol = (int)Math.Floor (rect.GetMinX () / tileSize.Width); int lastCol = (int)Math.Floor ((rect.GetMaxX () - 1) / tileSize.Width); int firstRow = (int)Math.Floor (rect.GetMinY () / tileSize.Height); int lastRow = (int)Math.Floor ((rect.GetMaxY () - 1) / tileSize.Height); for (int row = firstRow; row <= lastRow; row++) { for (int col = firstCol; col <= lastCol; col++) { UIImage tile = TileForScale ((float)scale, row, col); var tileRect = new CGRect (tileSize.Width * col, tileSize.Height * row, tileSize.Width, tileSize.Height); // if the tile would stick outside of our bounds, we need to truncate it so as to avoid // stretching out the partial tiles at the right and bottom edges tileRect.Intersect (this.Bounds); tile.Draw (tileRect); } } } }
static void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler) { if (!oldRect.IntersectsWith (newRect)) { addedHandler (newRect); removedHandler (oldRect); } else { nfloat oldMaxY = oldRect.GetMaxY (); nfloat oldMinY = oldRect.GetMinY (); nfloat newMaxY = newRect.GetMaxY (); nfloat newMinY = newRect.GetMinY (); if (newMaxY > oldMaxY) { var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY); addedHandler(rectToAdd); } if (oldMinY > newMinY) { var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY); addedHandler(rectToAdd); } if (newMaxY < oldMaxY) { var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY); removedHandler(rectToRemove); } if (oldMinY < newMinY) { var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY); removedHandler(rectToRemove); } } }
public override void Draw(CGRect rect) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var fillColor = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var strokeColor = UIColor.FromRGBA(0.807f, 0.807f, 0.807f, 1.000f); var strokeColor2 = UIColor.FromRGBA(0.851f, 0.851f, 0.851f, 1.000f); //// Frames CGRect frame = new CGRect(0.0f, 0.0f, 772.0f, 356.0f); //// Group 2 { //// Group 3 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 2 UIBezierPath clip2Path = new UIBezierPath(); clip2Path.MoveTo(new CGPoint(frame.GetMinX() - 41.0f, frame.GetMinY() - 45.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 730.0f, frame.GetMinY() - 45.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 730.0f, frame.GetMinY() + 310.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 41.0f, frame.GetMinY() + 310.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 41.0f, frame.GetMinY() - 45.0f)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(frame.GetMinX() - 20.0f, frame.GetMinY() - 20.5f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() - 24.0f), new CGPoint(frame.GetMinX() - 20.0f, frame.GetMinY() - 22.44f), new CGPoint(frame.GetMinX() - 18.44f, frame.GetMinY() - 24.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() - 24.0f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 709.0f, frame.GetMinY() - 20.5f), new CGPoint(frame.GetMinX() + 707.44f, frame.GetMinY() - 24.0f), new CGPoint(frame.GetMinX() + 709.0f, frame.GetMinY() - 22.44f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 709.0f, frame.GetMinY() + 285.5f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() + 289.0f), new CGPoint(frame.GetMinX() + 709.0f, frame.GetMinY() + 287.44f), new CGPoint(frame.GetMinX() + 707.44f, frame.GetMinY() + 289.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() + 289.0f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 20.0f, frame.GetMinY() + 285.5f), new CGPoint(frame.GetMinX() - 18.44f, frame.GetMinY() + 289.0f), new CGPoint(frame.GetMinX() - 20.0f, frame.GetMinY() + 287.44f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 20.0f, frame.GetMinY() - 20.5f)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(frame.GetMinX() - 21.0f, frame.GetMinY() - 20.5f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 21.0f, frame.GetMinY() + 285.5f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() + 290.0f), new CGPoint(frame.GetMinX() - 21.0f, frame.GetMinY() + 287.99f), new CGPoint(frame.GetMinX() - 18.99f, frame.GetMinY() + 290.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() + 290.0f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 710.0f, frame.GetMinY() + 285.5f), new CGPoint(frame.GetMinX() + 707.99f, frame.GetMinY() + 290.0f), new CGPoint(frame.GetMinX() + 710.0f, frame.GetMinY() + 287.99f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() + 710.0f, frame.GetMinY() - 20.5f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() - 25.0f), new CGPoint(frame.GetMinX() + 710.0f, frame.GetMinY() - 22.99f), new CGPoint(frame.GetMinX() + 707.99f, frame.GetMinY() - 25.0f)); clip2Path.AddLineTo(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() - 25.0f)); clip2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 21.0f, frame.GetMinY() - 20.5f), new CGPoint(frame.GetMinX() - 18.99f, frame.GetMinY() - 25.0f), new CGPoint(frame.GetMinX() - 21.0f, frame.GetMinY() - 22.99f)); clip2Path.ClosePath(); clip2Path.UsesEvenOddFillRule = true; clip2Path.AddClip(); //// Group 4 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip UIBezierPath clipPath = new UIBezierPath(); clipPath.MoveTo(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 20.5f)); clipPath.AddCurveToPoint(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() - 24.5f), new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 22.71f), new CGPoint(frame.GetMinX() - 18.72f, frame.GetMinY() - 24.5f)); clipPath.AddLineTo(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() - 24.5f)); clipPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() - 20.5f), new CGPoint(frame.GetMinX() + 707.71f, frame.GetMinY() - 24.5f), new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() - 22.71f)); clipPath.AddLineTo(new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() + 285.5f)); clipPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() + 289.5f), new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() + 287.71f), new CGPoint(frame.GetMinX() + 707.72f, frame.GetMinY() + 289.5f)); clipPath.AddLineTo(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() + 289.5f)); clipPath.AddCurveToPoint(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() + 285.5f), new CGPoint(frame.GetMinX() - 18.71f, frame.GetMinY() + 289.5f), new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() + 287.71f)); clipPath.AddLineTo(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 20.5f)); clipPath.ClosePath(); clipPath.UsesEvenOddFillRule = true; clipPath.AddClip(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 20.5f)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() - 24.5f), new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 22.71f), new CGPoint(frame.GetMinX() - 18.72f, frame.GetMinY() - 24.5f)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() - 24.5f)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() - 20.5f), new CGPoint(frame.GetMinX() + 707.71f, frame.GetMinY() - 24.5f), new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() - 22.71f)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() + 285.5f)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 705.51f, frame.GetMinY() + 289.5f), new CGPoint(frame.GetMinX() + 709.5f, frame.GetMinY() + 287.71f), new CGPoint(frame.GetMinX() + 707.72f, frame.GetMinY() + 289.5f)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() - 16.51f, frame.GetMinY() + 289.5f)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() + 285.5f), new CGPoint(frame.GetMinX() - 18.71f, frame.GetMinY() + 289.5f), new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() + 287.71f)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() - 20.5f, frame.GetMinY() - 20.5f)); bezierPath.ClosePath(); fillColor.SetFill(); bezierPath.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } context.EndTransparencyLayer(); context.RestoreState(); } //// Group 5 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 3 UIBezierPath clip3Path = new UIBezierPath(); clip3Path.MoveTo(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 11.14f)); clip3Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 9.35f, frame.GetMinY() - 15.5f), new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 13.55f), new CGPoint(frame.GetMinX() - 11.65f, frame.GetMinY() - 15.5f)); clip3Path.AddLineTo(new CGPoint(frame.GetMinX() + 740.35f, frame.GetMinY() - 15.5f)); clip3Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() - 11.14f), new CGPoint(frame.GetMinX() + 742.64f, frame.GetMinY() - 15.5f), new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() - 13.56f)); clip3Path.AddLineTo(new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() + 322.14f)); clip3Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 740.35f, frame.GetMinY() + 326.5f), new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() + 324.55f), new CGPoint(frame.GetMinX() + 742.65f, frame.GetMinY() + 326.5f)); clip3Path.AddLineTo(new CGPoint(frame.GetMinX() - 9.35f, frame.GetMinY() + 326.5f)); clip3Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() + 322.14f), new CGPoint(frame.GetMinX() - 11.64f, frame.GetMinY() + 326.5f), new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() + 324.56f)); clip3Path.AddLineTo(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 11.14f)); clip3Path.ClosePath(); clip3Path.UsesEvenOddFillRule = true; clip3Path.AddClip(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 11.14f)); bezier4Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 9.35f, frame.GetMinY() - 15.5f), new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 13.55f), new CGPoint(frame.GetMinX() - 11.65f, frame.GetMinY() - 15.5f)); bezier4Path.AddLineTo(new CGPoint(frame.GetMinX() + 740.35f, frame.GetMinY() - 15.5f)); bezier4Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() - 11.14f), new CGPoint(frame.GetMinX() + 742.64f, frame.GetMinY() - 15.5f), new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() - 13.56f)); bezier4Path.AddLineTo(new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() + 322.14f)); bezier4Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 740.35f, frame.GetMinY() + 326.5f), new CGPoint(frame.GetMinX() + 744.5f, frame.GetMinY() + 324.55f), new CGPoint(frame.GetMinX() + 742.65f, frame.GetMinY() + 326.5f)); bezier4Path.AddLineTo(new CGPoint(frame.GetMinX() - 9.35f, frame.GetMinY() + 326.5f)); bezier4Path.AddCurveToPoint(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() + 322.14f), new CGPoint(frame.GetMinX() - 11.64f, frame.GetMinY() + 326.5f), new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() + 324.56f)); bezier4Path.AddLineTo(new CGPoint(frame.GetMinX() - 13.5f, frame.GetMinY() - 11.14f)); bezier4Path.ClosePath(); strokeColor2.SetStroke(); bezier4Path.LineWidth = 2.0f; bezier4Path.Stroke(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new CGPoint(frame.GetMinX() + 36.0f, frame.GetMinY() + 155.6f)); bezier6Path.AddLineTo(new CGPoint(frame.GetMinX() + 696.0f, frame.GetMinY() + 155.6f)); bezier6Path.LineCapStyle = CGLineCap.Square; strokeColor.SetStroke(); bezier6Path.LineWidth = 1.0f; bezier6Path.Stroke(); } }
void DrawBeerLoader(CGRect frame, float percentage) { var fillColor4 = UIColor.FromRGBA(0.963f, 0.836f, 0.300f, 1.000f); var fillColor9 = UIColor.FromRGBA(0.833f, 0.723f, 0.260f, 1.000f); var expression = 450.0f - 360.0f / 100.0f * percentage; var expression2 = 180.0f - 360.0f / 100.0f * percentage; CGRect background = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.00017f + 0.41f) + 0.09f, frame.GetMinY() + NMath.Floor(frame.Height * 0.00016f + 0.23f) + 0.27f, NMath.Floor(frame.Width * 0.99950f - 0.24f) - NMath.Floor(frame.Width * 0.00017f + 0.41f) + 0.65f, NMath.Floor(frame.Height * 0.98998f - 0.42f) - NMath.Floor(frame.Height * 0.00016f + 0.23f) + 0.65f); CGRect beer = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.33565f - 0.05f) + 0.55f, frame.GetMinY() + NMath.Floor(frame.Height * 0.22329f + 0.0f) + 0.5f, NMath.Floor(frame.Width * 0.71844f - 0.4f) - NMath.Floor(frame.Width * 0.33565f - 0.05f) + 0.35f, NMath.Floor(frame.Height * 0.72339f - 0.05f) - NMath.Floor(frame.Height * 0.22329f + 0.0f) + 0.05f); { UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(background.GetMinX() + 0.94794f * background.Width, background.GetMinY() + 0.58913f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.96205f * background.Width, background.GetMinY() + 0.69140f * background.Height), new CGPoint(background.GetMinX() + 0.94178f * background.Width, background.GetMinY() + 0.62023f * background.Height), new CGPoint(background.GetMinX() + 0.97392f * background.Width, background.GetMinY() + 0.66278f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.87973f * background.Width, background.GetMinY() + 0.75370f * background.Height), new CGPoint(background.GetMinX() + 0.94998f * background.Width, background.GetMinY() + 0.72052f * background.Height), new CGPoint(background.GetMinX() + 0.89706f * background.Width, background.GetMinY() + 0.72781f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.85355f * background.Width, background.GetMinY() + 0.85355f * background.Height), new CGPoint(background.GetMinX() + 0.86227f * background.Width, background.GetMinY() + 0.77977f * background.Height), new CGPoint(background.GetMinX() + 0.87567f * background.Width, background.GetMinY() + 0.83144f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.75369f * background.Width, background.GetMinY() + 0.87973f * background.Height), new CGPoint(background.GetMinX() + 0.83144f * background.Width, background.GetMinY() + 0.87567f * background.Height), new CGPoint(background.GetMinX() + 0.77977f * background.Width, background.GetMinY() + 0.86227f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.69139f * background.Width, background.GetMinY() + 0.96205f * background.Height), new CGPoint(background.GetMinX() + 0.72781f * background.Width, background.GetMinY() + 0.89706f * background.Height), new CGPoint(background.GetMinX() + 0.72051f * background.Width, background.GetMinY() + 0.94998f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.63742f * background.Width, background.GetMinY() + 0.95593f * background.Height), new CGPoint(background.GetMinX() + 0.67609f * background.Width, background.GetMinY() + 0.96840f * background.Height), new CGPoint(background.GetMinX() + 0.65681f * background.Width, background.GetMinY() + 0.96216f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.58913f * background.Width, background.GetMinY() + 0.94793f * background.Height), new CGPoint(background.GetMinX() + 0.62055f * background.Width, background.GetMinY() + 0.95050f * background.Height), new CGPoint(background.GetMinX() + 0.60360f * background.Width, background.GetMinY() + 0.94507f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.50000f * background.Width, background.GetMinY() + 1.00000f * background.Height), new CGPoint(background.GetMinX() + 0.55894f * background.Width, background.GetMinY() + 0.95391f * background.Height), new CGPoint(background.GetMinX() + 0.53194f * background.Width, background.GetMinY() + 1.00000f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.41087f * background.Width, background.GetMinY() + 0.94793f * background.Height), new CGPoint(background.GetMinX() + 0.46806f * background.Width, background.GetMinY() + 1.00000f * background.Height), new CGPoint(background.GetMinX() + 0.44106f * background.Width, background.GetMinY() + 0.95391f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.36258f * background.Width, background.GetMinY() + 0.95593f * background.Height), new CGPoint(background.GetMinX() + 0.39640f * background.Width, background.GetMinY() + 0.94507f * background.Height), new CGPoint(background.GetMinX() + 0.37945f * background.Width, background.GetMinY() + 0.95050f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.30861f * background.Width, background.GetMinY() + 0.96205f * background.Height), new CGPoint(background.GetMinX() + 0.34319f * background.Width, background.GetMinY() + 0.96216f * background.Height), new CGPoint(background.GetMinX() + 0.32391f * background.Width, background.GetMinY() + 0.96840f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.24631f * background.Width, background.GetMinY() + 0.87973f * background.Height), new CGPoint(background.GetMinX() + 0.27949f * background.Width, background.GetMinY() + 0.94998f * background.Height), new CGPoint(background.GetMinX() + 0.27219f * background.Width, background.GetMinY() + 0.89705f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.14645f * background.Width, background.GetMinY() + 0.85355f * background.Height), new CGPoint(background.GetMinX() + 0.22023f * background.Width, background.GetMinY() + 0.86227f * background.Height), new CGPoint(background.GetMinX() + 0.16856f * background.Width, background.GetMinY() + 0.87567f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.12027f * background.Width, background.GetMinY() + 0.75369f * background.Height), new CGPoint(background.GetMinX() + 0.12433f * background.Width, background.GetMinY() + 0.83144f * background.Height), new CGPoint(background.GetMinX() + 0.13773f * background.Width, background.GetMinY() + 0.77977f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.03795f * background.Width, background.GetMinY() + 0.69139f * background.Height), new CGPoint(background.GetMinX() + 0.10294f * background.Width, background.GetMinY() + 0.72781f * background.Height), new CGPoint(background.GetMinX() + 0.05002f * background.Width, background.GetMinY() + 0.72051f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.05207f * background.Width, background.GetMinY() + 0.58913f * background.Height), new CGPoint(background.GetMinX() + 0.02608f * background.Width, background.GetMinY() + 0.66277f * background.Height), new CGPoint(background.GetMinX() + 0.05822f * background.Width, background.GetMinY() + 0.62023f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.00000f * background.Width, background.GetMinY() + 0.50000f * background.Height), new CGPoint(background.GetMinX() + 0.04609f * background.Width, background.GetMinY() + 0.55894f * background.Height), new CGPoint(background.GetMinX() + 0.00000f * background.Width, background.GetMinY() + 0.53194f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.05207f * background.Width, background.GetMinY() + 0.41087f * background.Height), new CGPoint(background.GetMinX() + 0.00000f * background.Width, background.GetMinY() + 0.46806f * background.Height), new CGPoint(background.GetMinX() + 0.04609f * background.Width, background.GetMinY() + 0.44106f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.03795f * background.Width, background.GetMinY() + 0.30861f * background.Height), new CGPoint(background.GetMinX() + 0.05822f * background.Width, background.GetMinY() + 0.37976f * background.Height), new CGPoint(background.GetMinX() + 0.02608f * background.Width, background.GetMinY() + 0.33723f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.12027f * background.Width, background.GetMinY() + 0.24631f * background.Height), new CGPoint(background.GetMinX() + 0.05002f * background.Width, background.GetMinY() + 0.27949f * background.Height), new CGPoint(background.GetMinX() + 0.10294f * background.Width, background.GetMinY() + 0.27219f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.14645f * background.Width, background.GetMinY() + 0.14644f * background.Height), new CGPoint(background.GetMinX() + 0.13773f * background.Width, background.GetMinY() + 0.22023f * background.Height), new CGPoint(background.GetMinX() + 0.12433f * background.Width, background.GetMinY() + 0.16856f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.24631f * background.Width, background.GetMinY() + 0.12027f * background.Height), new CGPoint(background.GetMinX() + 0.16856f * background.Width, background.GetMinY() + 0.12433f * background.Height), new CGPoint(background.GetMinX() + 0.22023f * background.Width, background.GetMinY() + 0.13773f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.30861f * background.Width, background.GetMinY() + 0.03795f * background.Height), new CGPoint(background.GetMinX() + 0.27219f * background.Width, background.GetMinY() + 0.10294f * background.Height), new CGPoint(background.GetMinX() + 0.27949f * background.Width, background.GetMinY() + 0.05002f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.36258f * background.Width, background.GetMinY() + 0.04407f * background.Height), new CGPoint(background.GetMinX() + 0.32391f * background.Width, background.GetMinY() + 0.03160f * background.Height), new CGPoint(background.GetMinX() + 0.34319f * background.Width, background.GetMinY() + 0.03784f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.41087f * background.Width, background.GetMinY() + 0.05206f * background.Height), new CGPoint(background.GetMinX() + 0.37945f * background.Width, background.GetMinY() + 0.04950f * background.Height), new CGPoint(background.GetMinX() + 0.39640f * background.Width, background.GetMinY() + 0.05493f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.50000f * background.Width, background.GetMinY() + 0.00000f * background.Height), new CGPoint(background.GetMinX() + 0.44106f * background.Width, background.GetMinY() + 0.04609f * background.Height), new CGPoint(background.GetMinX() + 0.46806f * background.Width, background.GetMinY() + 0.00000f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.58913f * background.Width, background.GetMinY() + 0.05206f * background.Height), new CGPoint(background.GetMinX() + 0.53194f * background.Width, background.GetMinY() + 0.00000f * background.Height), new CGPoint(background.GetMinX() + 0.55894f * background.Width, background.GetMinY() + 0.04609f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.63742f * background.Width, background.GetMinY() + 0.04407f * background.Height), new CGPoint(background.GetMinX() + 0.60360f * background.Width, background.GetMinY() + 0.05493f * background.Height), new CGPoint(background.GetMinX() + 0.62055f * background.Width, background.GetMinY() + 0.04950f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.69140f * background.Width, background.GetMinY() + 0.03795f * background.Height), new CGPoint(background.GetMinX() + 0.65681f * background.Width, background.GetMinY() + 0.03784f * background.Height), new CGPoint(background.GetMinX() + 0.67609f * background.Width, background.GetMinY() + 0.03160f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.75369f * background.Width, background.GetMinY() + 0.12027f * background.Height), new CGPoint(background.GetMinX() + 0.72051f * background.Width, background.GetMinY() + 0.05002f * background.Height), new CGPoint(background.GetMinX() + 0.72781f * background.Width, background.GetMinY() + 0.10294f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.85356f * background.Width, background.GetMinY() + 0.14645f * background.Height), new CGPoint(background.GetMinX() + 0.77977f * background.Width, background.GetMinY() + 0.13773f * background.Height), new CGPoint(background.GetMinX() + 0.83144f * background.Width, background.GetMinY() + 0.12433f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.87973f * background.Width, background.GetMinY() + 0.24631f * background.Height), new CGPoint(background.GetMinX() + 0.87567f * background.Width, background.GetMinY() + 0.16856f * background.Height), new CGPoint(background.GetMinX() + 0.86227f * background.Width, background.GetMinY() + 0.22023f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.96206f * background.Width, background.GetMinY() + 0.30861f * background.Height), new CGPoint(background.GetMinX() + 0.89706f * background.Width, background.GetMinY() + 0.27219f * background.Height), new CGPoint(background.GetMinX() + 0.94998f * background.Width, background.GetMinY() + 0.27949f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.94794f * background.Width, background.GetMinY() + 0.41087f * background.Height), new CGPoint(background.GetMinX() + 0.97392f * background.Width, background.GetMinY() + 0.33723f * background.Height), new CGPoint(background.GetMinX() + 0.94178f * background.Width, background.GetMinY() + 0.37976f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 1.00000f * background.Width, background.GetMinY() + 0.50000f * background.Height), new CGPoint(background.GetMinX() + 0.95391f * background.Width, background.GetMinY() + 0.44106f * background.Height), new CGPoint(background.GetMinX() + 1.00000f * background.Width, background.GetMinY() + 0.46806f * background.Height)); bezierPath.AddCurveToPoint(new CGPoint(background.GetMinX() + 0.94794f * background.Width, background.GetMinY() + 0.58913f * background.Height), new CGPoint(background.GetMinX() + 1.00000f * background.Width, background.GetMinY() + 0.53194f * background.Height), new CGPoint(background.GetMinX() + 0.95391f * background.Width, background.GetMinY() + 0.55894f * background.Height)); bezierPath.ClosePath(); bezierPath.UsesEvenOddFillRule = true; this.Green.SetFill(); bezierPath.Fill(); var whitePath = UIBezierPath.FromOval(new CGRect(background.GetMinX() + NMath.Floor(background.Width * 0.09115f - 0.41f) + 0.91f, background.GetMinY() + NMath.Floor(background.Height * 0.09203f + 0.47f) + 0.03f, NMath.Floor(background.Width * 0.91052f - 0.11f) - NMath.Floor(background.Width * 0.09115f - 0.41f) - 0.3f, NMath.Floor(background.Height * 0.90967f - 0.23f) - NMath.Floor(background.Height * 0.09203f + 0.47f) + 0.7f)); this.SimpleWhite.SetFill(); whitePath.Fill(); var white2Rect = new CGRect(background.GetMinX() + NMath.Floor(background.Width * 0.08925f - 0.41f) + 0.91f, background.GetMinY() + NMath.Floor(background.Height * 0.09011f + 0.47f) + 0.03f, NMath.Floor(background.Width * 0.91052f - 0.11f) - NMath.Floor(background.Width * 0.08925f - 0.41f) - 0.3f, NMath.Floor(background.Height * 0.90967f - 0.23f) - NMath.Floor(background.Height * 0.09011f + 0.47f) + 0.7f); var white2Path = new UIBezierPath(); white2Path.AddArc(new CGPoint(0.0f, 0.0f), white2Rect.Width / 2.0f, (nfloat)(-expression * NMath.PI/180), (nfloat)(-expression2 * NMath.PI/180.0f), true); white2Path.AddLineTo(new CGPoint(0.0f, 0.0f)); white2Path.ClosePath(); var white2Transform = CGAffineTransform.MakeScale(1.0f, white2Rect.Height / white2Rect.Width); white2Transform.Translate(white2Rect.GetMidX(), white2Rect.GetMidY()); white2Path.ApplyTransform(white2Transform); this.Green.SetFill(); white2Path.Fill(); var greenFillerPath = UIBezierPath.FromOval(new CGRect(background.GetMinX() + NMath.Floor(background.Width * 0.09686f - 0.41f) + 0.91f, background.GetMinY() + NMath.Floor(background.Height * 0.09780f - 0.23f) + 0.73f, NMath.Floor(background.Width * 0.90348f - 0.41f) - NMath.Floor(background.Width * 0.09686f - 0.41f), NMath.Floor(background.Height * 0.90257f - 0.23f) - NMath.Floor(background.Height * 0.09780f - 0.23f))); this.Green.SetFill(); greenFillerPath.Fill(); } { var ovalPath = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.07499f + 0.4f) + 0.1f, beer.GetMinY() + NMath.Floor(beer.Height * 0.06273f + 0.45f) + 0.05f, NMath.Floor(beer.Width * 0.26124f - 0.1f) - NMath.Floor(beer.Width * 0.07499f + 0.4f) + 0.5f, NMath.Floor(beer.Height * 0.20908f - 0.05f) - NMath.Floor(beer.Height * 0.06273f + 0.45f) + 0.5f)); OffWhite.SetFill(); ovalPath.Fill(); var oval2Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.00000f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.15263f + 0.1f) + 0.4f, NMath.Floor(beer.Width * 0.18624f) - NMath.Floor(beer.Width * 0.00000f + 0.5f) + 0.5f, NMath.Floor(beer.Height * 0.29899f - 0.4f) - NMath.Floor(beer.Height * 0.15263f + 0.1f) + 0.5f)); OffWhite.SetFill(); oval2Path.Fill(); var oval3Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.00000f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.24881f + 0.5f) + 0.0f, NMath.Floor(beer.Width * 0.13211f - 0.1f) - NMath.Floor(beer.Width * 0.00000f + 0.5f) + 0.6f, NMath.Floor(beer.Height * 0.35373f - 0.1f) - NMath.Floor(beer.Height * 0.24881f + 0.5f) + 0.6f)); OffWhite.SetFill(); oval3Path.Fill(); var oval4Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.00000f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.32541f - 0.35f) + 0.85f, NMath.Floor(beer.Width * 0.13211f - 0.1f) - NMath.Floor(beer.Width * 0.00000f + 0.5f) + 0.6f, NMath.Floor(beer.Height * 0.43033f + 0.05f) - NMath.Floor(beer.Height * 0.32541f - 0.35f) - 0.4f)); OffWhite.SetFill(); oval4Path.Fill(); var oval5Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.03526f + 0.4f) + 0.1f, beer.GetMinY() + NMath.Floor(beer.Height * 0.40068f + 0.45f) + 0.05f, NMath.Floor(beer.Width * 0.16737f - 0.2f) - NMath.Floor(beer.Width * 0.03526f + 0.4f) + 0.6f, NMath.Floor(beer.Height * 0.50560f - 0.15f) - NMath.Floor(beer.Height * 0.40068f + 0.45f) + 0.6f)); OffWhite.SetFill(); oval5Path.Fill(); UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(beer.GetMinX() + 0.71340f * beer.Width, beer.GetMinY() + 0.27402f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.75623f * beer.Width, beer.GetMinY() + 0.31182f * beer.Height), new CGPoint(beer.GetMinX() + 0.71340f * beer.Width, beer.GetMinY() + 0.27402f * beer.Height), new CGPoint(beer.GetMinX() + 0.72564f * beer.Width, beer.GetMinY() + 0.30342f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.91991f * beer.Width, beer.GetMinY() + 0.33162f * beer.Height), new CGPoint(beer.GetMinX() + 0.78618f * beer.Width, beer.GetMinY() + 0.32004f * beer.Height), new CGPoint(beer.GetMinX() + 0.85931f * beer.Width, beer.GetMinY() + 0.30847f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.99028f * beer.Width, beer.GetMinY() + 0.67241f * beer.Height), new CGPoint(beer.GetMinX() + 0.97956f * beer.Width, beer.GetMinY() + 0.35442f * beer.Height), new CGPoint(beer.GetMinX() + 1.01934f * beer.Width, beer.GetMinY() + 0.58000f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.74374f * beer.Width, beer.GetMinY() + 0.90110f * beer.Height), new CGPoint(beer.GetMinX() + 0.96121f * beer.Width, beer.GetMinY() + 0.76480f * beer.Height), new CGPoint(beer.GetMinX() + 0.71157f * beer.Width, beer.GetMinY() + 0.83870f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.70703f * beer.Width, beer.GetMinY() + 0.67071f * beer.Height), new CGPoint(beer.GetMinX() + 0.71927f * beer.Width, beer.GetMinY() + 0.95149f * beer.Height), new CGPoint(beer.GetMinX() + 0.68742f * beer.Width, beer.GetMinY() + 0.70678f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.86866f * beer.Width, beer.GetMinY() + 0.70181f * beer.Height), new CGPoint(beer.GetMinX() + 0.72080f * beer.Width, beer.GetMinY() + 0.74270f * beer.Height), new CGPoint(beer.GetMinX() + 0.83654f * beer.Width, beer.GetMinY() + 0.72700f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.91685f * beer.Width, beer.GetMinY() + 0.55481f * beer.Height), new CGPoint(beer.GetMinX() + 0.90079f * beer.Width, beer.GetMinY() + 0.67660f * beer.Height), new CGPoint(beer.GetMinX() + 0.93284f * beer.Width, beer.GetMinY() + 0.65992f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.87095f * beer.Width, beer.GetMinY() + 0.38322f * beer.Height), new CGPoint(beer.GetMinX() + 0.90085f * beer.Width, beer.GetMinY() + 0.44970f * beer.Height), new CGPoint(beer.GetMinX() + 0.90002f * beer.Width, beer.GetMinY() + 0.39521f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.76540f * beer.Width, beer.GetMinY() + 0.38082f * beer.Height), new CGPoint(beer.GetMinX() + 0.84188f * beer.Width, beer.GetMinY() + 0.37122f * beer.Height), new CGPoint(beer.GetMinX() + 0.78988f * beer.Width, beer.GetMinY() + 0.37602f * beer.Height)); bezier2Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.70116f * beer.Width, beer.GetMinY() + 0.43331f * beer.Height), new CGPoint(beer.GetMinX() + 0.74093f * beer.Width, beer.GetMinY() + 0.38562f * beer.Height), new CGPoint(beer.GetMinX() + 0.70116f * beer.Width, beer.GetMinY() + 0.43331f * beer.Height)); bezier2Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.71340f * beer.Width, beer.GetMinY() + 0.27402f * beer.Height)); bezier2Path.ClosePath(); bezier2Path.UsesEvenOddFillRule = true; SimpleWhite.SetFill(); bezier2Path.Fill(); UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new CGPoint(beer.GetMinX() + 0.08316f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height)); bezier3Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.05563f * beer.Width, beer.GetMinY() + 0.95199f * beer.Height)); bezier3Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.40975f * beer.Width, beer.GetMinY() + 0.98741f * beer.Height), new CGPoint(beer.GetMinX() + 0.05563f * beer.Width, beer.GetMinY() + 0.95199f * beer.Height), new CGPoint(beer.GetMinX() + 0.10382f * beer.Width, beer.GetMinY() + 0.98741f * beer.Height)); bezier3Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.75623f * beer.Width, beer.GetMinY() + 0.95199f * beer.Height), new CGPoint(beer.GetMinX() + 0.71569f * beer.Width, beer.GetMinY() + 0.98741f * beer.Height), new CGPoint(beer.GetMinX() + 0.75623f * beer.Width, beer.GetMinY() + 0.95199f * beer.Height)); bezier3Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.73787f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height)); bezier3Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.41893f * beer.Width, beer.GetMinY() + 0.86680f * beer.Height), new CGPoint(beer.GetMinX() + 0.73787f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height), new CGPoint(beer.GetMinX() + 0.68510f * beer.Width, beer.GetMinY() + 0.86680f * beer.Height)); bezier3Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.08316f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height), new CGPoint(beer.GetMinX() + 0.15277f * beer.Width, beer.GetMinY() + 0.86680f * beer.Height), new CGPoint(beer.GetMinX() + 0.08316f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height)); bezier3Path.ClosePath(); bezier3Path.UsesEvenOddFillRule = true; SimpleWhite.SetFill(); bezier3Path.Fill(); UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(beer.GetMinX() + 0.08189f * beer.Width, beer.GetMinY() + 0.84290f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.11024f * beer.Width, beer.GetMinY() + 0.26059f * beer.Height), new CGPoint(beer.GetMinX() + 0.08189f * beer.Width, beer.GetMinY() + 0.84290f * beer.Height), new CGPoint(beer.GetMinX() + 0.11789f * beer.Width, beer.GetMinY() + 0.37817f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.72869f * beer.Width, beer.GetMinY() + 0.28120f * beer.Height), new CGPoint(beer.GetMinX() + 0.56915f * beer.Width, beer.GetMinY() + 0.27150f * beer.Height), new CGPoint(beer.GetMinX() + 0.72869f * beer.Width, beer.GetMinY() + 0.28120f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.71951f * beer.Width, beer.GetMinY() + 0.56362f * beer.Height), new CGPoint(beer.GetMinX() + 0.72869f * beer.Width, beer.GetMinY() + 0.28120f * beer.Height), new CGPoint(beer.GetMinX() + 0.71951f * beer.Width, beer.GetMinY() + 0.43635f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.73787f * beer.Width, beer.GetMinY() + 0.83756f * beer.Height), new CGPoint(beer.GetMinX() + 0.71951f * beer.Width, beer.GetMinY() + 0.69090f * beer.Height), new CGPoint(beer.GetMinX() + 0.73787f * beer.Width, beer.GetMinY() + 0.83756f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.40593f * beer.Width, beer.GetMinY() + 0.88119f * beer.Height), new CGPoint(beer.GetMinX() + 0.73787f * beer.Width, beer.GetMinY() + 0.83756f * beer.Height), new CGPoint(beer.GetMinX() + 0.63538f * beer.Width, beer.GetMinY() + 0.88726f * beer.Height)); bezier4Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.08189f * beer.Width, beer.GetMinY() + 0.84290f * beer.Height), new CGPoint(beer.GetMinX() + 0.17648f * beer.Width, beer.GetMinY() + 0.87513f * beer.Height), new CGPoint(beer.GetMinX() + 0.08189f * beer.Width, beer.GetMinY() + 0.84290f * beer.Height)); bezier4Path.ClosePath(); bezier4Path.UsesEvenOddFillRule = true; fillColor4.SetFill(); bezier4Path.Fill(); UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new CGPoint(beer.GetMinX() + 0.72835f * beer.Width, beer.GetMinY() + 0.29331f * beer.Height)); bezier5Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.72835f * beer.Width, beer.GetMinY() + 0.19362f * beer.Height)); bezier5Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.11621f * beer.Width, beer.GetMinY() + 0.19110f * beer.Height)); bezier5Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.11073f * beer.Width, beer.GetMinY() + 0.28260f * beer.Height)); bezier5Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.72835f * beer.Width, beer.GetMinY() + 0.29331f * beer.Height)); bezier5Path.ClosePath(); bezier5Path.UsesEvenOddFillRule = true; SimpleWhite.SetFill(); bezier5Path.Fill(); UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new CGPoint(beer.GetMinX() + 0.07471f * beer.Width, beer.GetMinY() + 0.94603f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.40975f * beer.Width, beer.GetMinY() + 0.97479f * beer.Height), new CGPoint(beer.GetMinX() + 0.09876f * beer.Width, beer.GetMinY() + 0.95447f * beer.Height), new CGPoint(beer.GetMinX() + 0.18051f * beer.Width, beer.GetMinY() + 0.97479f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.73863f * beer.Width, beer.GetMinY() + 0.94607f * beer.Height), new CGPoint(beer.GetMinX() + 0.64454f * beer.Width, beer.GetMinY() + 0.97479f * beer.Height), new CGPoint(beer.GetMinX() + 0.71869f * beer.Width, beer.GetMinY() + 0.95411f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.72181f * beer.Width, beer.GetMinY() + 0.83863f * beer.Height), new CGPoint(beer.GetMinX() + 0.73399f * beer.Width, beer.GetMinY() + 0.92454f * beer.Height), new CGPoint(beer.GetMinX() + 0.72199f * beer.Width, beer.GetMinY() + 0.86626f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.70346f * beer.Width, beer.GetMinY() + 0.56681f * beer.Height), new CGPoint(beer.GetMinX() + 0.72051f * beer.Width, beer.GetMinY() + 0.82816f * beer.Height), new CGPoint(beer.GetMinX() + 0.70346f * beer.Width, beer.GetMinY() + 0.68784f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.70999f * beer.Width, beer.GetMinY() + 0.21141f * beer.Height), new CGPoint(beer.GetMinX() + 0.70346f * beer.Width, beer.GetMinY() + 0.45862f * beer.Height), new CGPoint(beer.GetMinX() + 0.70858f * beer.Width, beer.GetMinY() + 0.26290f * beer.Height)); bezier6Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.13157f * beer.Width, beer.GetMinY() + 0.20390f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.09795f * beer.Width, beer.GetMinY() + 0.84329f * beer.Height), new CGPoint(beer.GetMinX() + 0.12671f * beer.Width, beer.GetMinY() + 0.29022f * beer.Height), new CGPoint(beer.GetMinX() + 0.09795f * beer.Width, beer.GetMinY() + 0.80316f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.07471f * beer.Width, beer.GetMinY() + 0.94603f * beer.Height), new CGPoint(beer.GetMinX() + 0.09795f * beer.Width, beer.GetMinY() + 0.87907f * beer.Height), new CGPoint(beer.GetMinX() + 0.08216f * beer.Width, beer.GetMinY() + 0.92590f * beer.Height)); bezier6Path.ClosePath(); bezier6Path.MoveTo(new CGPoint(beer.GetMinX() + 0.40975f * beer.Width, beer.GetMinY() + 1.00000f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.04465f * beer.Width, beer.GetMinY() + 0.96119f * beer.Height), new CGPoint(beer.GetMinX() + 0.10624f * beer.Width, beer.GetMinY() + 1.00000f * beer.Height), new CGPoint(beer.GetMinX() + 0.05006f * beer.Width, beer.GetMinY() + 0.96517f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.04033f * beer.Width, beer.GetMinY() + 0.94815f * beer.Height), new CGPoint(beer.GetMinX() + 0.04013f * beer.Width, beer.GetMinY() + 0.95786f * beer.Height), new CGPoint(beer.GetMinX() + 0.03844f * beer.Width, beer.GetMinY() + 0.95279f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.06583f * beer.Width, beer.GetMinY() + 0.84329f * beer.Height), new CGPoint(beer.GetMinX() + 0.04059f * beer.Width, beer.GetMinY() + 0.94752f * beer.Height), new CGPoint(beer.GetMinX() + 0.06583f * beer.Width, beer.GetMinY() + 0.88517f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.10017f * beer.Width, beer.GetMinY() + 0.19054f * beer.Height), new CGPoint(beer.GetMinX() + 0.06583f * beer.Width, beer.GetMinY() + 0.79913f * beer.Height), new CGPoint(beer.GetMinX() + 0.09876f * beer.Width, beer.GetMinY() + 0.21537f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.11648f * beer.Width, beer.GetMinY() + 0.17850f * beer.Height), new CGPoint(beer.GetMinX() + 0.10055f * beer.Width, beer.GetMinY() + 0.18373f * beer.Height), new CGPoint(beer.GetMinX() + 0.10770f * beer.Width, beer.GetMinY() + 0.17845f * beer.Height)); bezier6Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.72667f * beer.Width, beer.GetMinY() + 0.18643f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.73798f * beer.Width, beer.GetMinY() + 0.19029f * beer.Height), new CGPoint(beer.GetMinX() + 0.73094f * beer.Width, beer.GetMinY() + 0.18648f * beer.Height), new CGPoint(beer.GetMinX() + 0.73501f * beer.Width, beer.GetMinY() + 0.18787f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.74246f * beer.Width, beer.GetMinY() + 0.19931f * beer.Height), new CGPoint(beer.GetMinX() + 0.74094f * beer.Width, beer.GetMinY() + 0.19271f * beer.Height), new CGPoint(beer.GetMinX() + 0.74255f * beer.Width, beer.GetMinY() + 0.19595f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.73559f * beer.Width, beer.GetMinY() + 0.56681f * beer.Height), new CGPoint(beer.GetMinX() + 0.74239f * beer.Width, beer.GetMinY() + 0.20172f * beer.Height), new CGPoint(beer.GetMinX() + 0.73559f * beer.Width, beer.GetMinY() + 0.44240f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.75155f * beer.Width, beer.GetMinY() + 0.81696f * beer.Height), new CGPoint(beer.GetMinX() + 0.73559f * beer.Width, beer.GetMinY() + 0.66362f * beer.Height), new CGPoint(beer.GetMinX() + 0.74661f * beer.Width, beer.GetMinY() + 0.77302f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.75393f * beer.Width, beer.GetMinY() + 0.82358f * beer.Height), new CGPoint(beer.GetMinX() + 0.75305f * beer.Width, beer.GetMinY() + 0.81888f * beer.Height), new CGPoint(beer.GetMinX() + 0.75393f * beer.Width, beer.GetMinY() + 0.82115f * beer.Height)); bezier6Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.75393f * beer.Width, beer.GetMinY() + 0.83800f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.77205f * beer.Width, beer.GetMinY() + 0.94980f * beer.Height), new CGPoint(beer.GetMinX() + 0.75393f * beer.Width, beer.GetMinY() + 0.86897f * beer.Height), new CGPoint(beer.GetMinX() + 0.77186f * beer.Width, beer.GetMinY() + 0.94900f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.76818f * beer.Width, beer.GetMinY() + 0.96041f * beer.Height), new CGPoint(beer.GetMinX() + 0.77291f * beer.Width, beer.GetMinY() + 0.95363f * beer.Height), new CGPoint(beer.GetMinX() + 0.77148f * beer.Width, beer.GetMinY() + 0.95754f * beer.Height)); bezier6Path.AddCurveToPoint(new CGPoint(beer.GetMinX() + 0.40975f * beer.Width, beer.GetMinY() + 1.00000f * beer.Height), new CGPoint(beer.GetMinX() + 0.76061f * beer.Width, beer.GetMinY() + 0.96702f * beer.Height), new CGPoint(beer.GetMinX() + 0.70776f * beer.Width, beer.GetMinY() + 1.00000f * beer.Height)); bezier6Path.ClosePath(); bezier6Path.UsesEvenOddFillRule = true; SimpleWhite.SetFill(); bezier6Path.Fill(); UIBezierPath bezier7Path = new UIBezierPath(); bezier7Path.MoveTo(new CGPoint(beer.GetMinX() + 0.70988f * beer.Width, beer.GetMinY() + 0.21792f * beer.Height)); bezier7Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.13068f * beer.Width, beer.GetMinY() + 0.21792f * beer.Height)); bezier7Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.13068f * beer.Width, beer.GetMinY() + 0.16404f * beer.Height)); bezier7Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.70988f * beer.Width, beer.GetMinY() + 0.17446f * beer.Height)); bezier7Path.AddLineTo(new CGPoint(beer.GetMinX() + 0.70988f * beer.Width, beer.GetMinY() + 0.21792f * beer.Height)); bezier7Path.ClosePath(); bezier7Path.UsesEvenOddFillRule = true; SimpleWhite.SetFill(); bezier7Path.Fill(); var oval6Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.42910f + 0.1f) + 0.4f, beer.GetMinY() + NMath.Floor(beer.Height * 0.65196f - 0.45f) + 0.95f, NMath.Floor(beer.Width * 0.48175f + 0.5f) - NMath.Floor(beer.Width * 0.42910f + 0.1f) - 0.4f, NMath.Floor(beer.Height * 0.69226f - 0.05f) - NMath.Floor(beer.Height * 0.65196f - 0.45f) - 0.4f)); fillColor9.SetFill(); oval6Path.Fill(); var oval7Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.34542f - 0.05f) + 0.55f, beer.GetMinY() + NMath.Floor(beer.Height * 0.55521f - 0.3f) + 0.8f, NMath.Floor(beer.Width * 0.42091f - 0.25f) - NMath.Floor(beer.Width * 0.34542f - 0.05f) + 0.2f, NMath.Floor(beer.Height * 0.61300f + 0.5f) - NMath.Floor(beer.Height * 0.55521f - 0.3f) - 0.8f)); fillColor9.SetFill(); oval7Path.Fill(); var oval8Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.14651f) + 0.5f, beer.GetMinY() + NMath.Floor(beer.Height * 0.76810f - 0.4f) + 0.9f, NMath.Floor(beer.Width * 0.23144f - 0.1f) - NMath.Floor(beer.Width * 0.14651f) + 0.1f, NMath.Floor(beer.Height * 0.83311f + 0.5f) - NMath.Floor(beer.Height * 0.76810f - 0.4f) - 0.9f)); fillColor9.SetFill(); oval8Path.Fill(); var oval9Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.61162f + 0.35f) + 0.15f, beer.GetMinY() + NMath.Floor(beer.Height * 0.74700f + 0.05f) + 0.45f, NMath.Floor(beer.Width * 0.66725f + 0.15f) - NMath.Floor(beer.Width * 0.61162f + 0.35f) + 0.2f, NMath.Floor(beer.Height * 0.78920f - 0.05f) - NMath.Floor(beer.Height * 0.74700f + 0.05f) + 0.1f)); fillColor9.SetFill(); oval9Path.Fill(); var oval10Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.56891f - 0.05f) + 0.55f, beer.GetMinY() + NMath.Floor(beer.Height * 0.62250f + 0.2f) + 0.3f, NMath.Floor(beer.Width * 0.63348f - 0.05f) - NMath.Floor(beer.Width * 0.56891f - 0.05f), NMath.Floor(beer.Height * 0.67192f + 0.2f) - NMath.Floor(beer.Height * 0.62250f + 0.2f))); fillColor9.SetFill(); oval10Path.Fill(); var oval11Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.34393f + 0.25f) + 0.25f, beer.GetMinY() + NMath.Floor(beer.Height * 0.75631f + 0.2f) + 0.3f, NMath.Floor(beer.Width * 0.42240f + 0.45f) - NMath.Floor(beer.Width * 0.34393f + 0.25f) - 0.2f, NMath.Floor(beer.Height * 0.81638f + 0.4f) - NMath.Floor(beer.Height * 0.75631f + 0.2f) - 0.2f)); fillColor9.SetFill(); oval11Path.Fill(); var oval12Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.61162f + 0.35f) + 0.15f, beer.GetMinY() + NMath.Floor(beer.Height * 0.43661f + 0.5f) + 0.0f, NMath.Floor(beer.Width * 0.64242f + 0.15f) - NMath.Floor(beer.Width * 0.61162f + 0.35f) + 0.2f, NMath.Floor(beer.Height * 0.46018f + 0.3f) - NMath.Floor(beer.Height * 0.43661f + 0.5f) + 0.2f)); fillColor9.SetFill(); oval12Path.Fill(); var oval13Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.22821f - 0.45f) + 0.95f, beer.GetMinY() + NMath.Floor(beer.Height * 0.42482f + 0.4f) + 0.1f, NMath.Floor(beer.Width * 0.25900f + 0.35f) - NMath.Floor(beer.Width * 0.22821f - 0.45f) - 0.8f, NMath.Floor(beer.Height * 0.44839f + 0.2f) - NMath.Floor(beer.Height * 0.42482f + 0.4f) + 0.2f)); fillColor9.SetFill(); oval13Path.Fill(); var oval14Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.43705f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.44820f - 0.45f) + 0.95f, NMath.Floor(beer.Width * 0.46784f + 0.3f) - NMath.Floor(beer.Width * 0.43705f + 0.5f) + 0.2f, NMath.Floor(beer.Height * 0.47177f + 0.35f) - NMath.Floor(beer.Height * 0.44820f - 0.45f) - 0.8f)); fillColor9.SetFill(); oval14Path.Fill(); var oval15Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.15818f - 0.35f) + 0.85f, beer.GetMinY() + NMath.Floor(beer.Height * 0.50940f - 0.35f) + 0.85f, NMath.Floor(beer.Width * 0.18897f + 0.45f) - NMath.Floor(beer.Width * 0.15818f - 0.35f) - 0.8f, NMath.Floor(beer.Height * 0.53297f + 0.45f) - NMath.Floor(beer.Height * 0.50940f - 0.35f) - 0.8f)); fillColor9.SetFill(); oval15Path.Fill(); var oval16Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.52794f + 0.2f) + 0.3f, beer.GetMinY() + NMath.Floor(beer.Height * 0.52803f - 0.45f) + 0.95f, NMath.Floor(beer.Width * 0.55873f) - NMath.Floor(beer.Width * 0.52794f + 0.2f) + 0.2f, NMath.Floor(beer.Height * 0.55160f + 0.35f) - NMath.Floor(beer.Height * 0.52803f - 0.45f) - 0.8f)); fillColor9.SetFill(); oval16Path.Fill(); var oval17Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.25875f + 0.4f) + 0.1f, beer.GetMinY() + NMath.Floor(beer.Height * 0.69207f - 0.3f) + 0.8f, NMath.Floor(beer.Width * 0.28955f + 0.2f) - NMath.Floor(beer.Width * 0.25875f + 0.4f) + 0.2f, NMath.Floor(beer.Height * 0.71564f + 0.5f) - NMath.Floor(beer.Height * 0.69207f - 0.3f) - 0.8f)); fillColor9.SetFill(); oval17Path.Fill(); var oval18Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.50013f - 0.2f) + 0.7f, beer.GetMinY() + NMath.Floor(beer.Height * 0.81638f - 0.1f) + 0.6f, NMath.Floor(beer.Width * 0.54333f + 0.1f) - NMath.Floor(beer.Width * 0.50013f - 0.2f) - 0.3f, NMath.Floor(beer.Height * 0.84945f + 0.2f) - NMath.Floor(beer.Height * 0.81638f - 0.1f) - 0.3f)); fillColor9.SetFill(); oval18Path.Fill(); var oval19Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.20512f + 0.2f) + 0.3f, beer.GetMinY() + NMath.Floor(beer.Height * 0.55863f - 0.0f) + 0.5f, NMath.Floor(beer.Width * 0.25776f - 0.4f) - NMath.Floor(beer.Width * 0.20512f + 0.2f) + 0.6f, NMath.Floor(beer.Height * 0.59893f + 0.4f) - NMath.Floor(beer.Height * 0.55863f - 0.0f) - 0.4f)); fillColor9.SetFill(); oval19Path.Fill(); var oval20Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.55004f - 0.25f) + 0.75f, beer.GetMinY() + NMath.Floor(beer.Height * 0.07318f + 0.2f) + 0.3f, NMath.Floor(beer.Width * 0.73628f + 0.25f) - NMath.Floor(beer.Width * 0.55004f - 0.25f) - 0.5f, NMath.Floor(beer.Height * 0.21954f - 0.3f) - NMath.Floor(beer.Height * 0.07318f + 0.2f) + 0.5f)); OffWhite.SetFill(); oval20Path.Fill(); var oval21Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.52148f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.11272f - 0.4f) + 0.9f, NMath.Floor(beer.Width * 0.70772f) - NMath.Floor(beer.Width * 0.52148f + 0.5f) + 0.5f, NMath.Floor(beer.Height * 0.25907f + 0.1f) - NMath.Floor(beer.Height * 0.11272f - 0.4f) - 0.5f)); OffWhite.SetFill(); oval21Path.Fill(); var oval22Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.45568f - 0.25f) + 0.75f, beer.GetMinY() + NMath.Floor(beer.Height * 0.01673f + 0.35f) + 0.15f, NMath.Floor(beer.Width * 0.64192f + 0.25f) - NMath.Floor(beer.Width * 0.45568f - 0.25f) - 0.5f, NMath.Floor(beer.Height * 0.16309f - 0.15f) - NMath.Floor(beer.Height * 0.01673f + 0.35f) + 0.5f)); OffWhite.SetFill(); oval22Path.Fill(); var oval23Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.30097f - 0.1f) + 0.6f, beer.GetMinY() + NMath.Floor(beer.Height * 0.00000f - 0.05f) + 0.55f, NMath.Floor(beer.Width * 0.48721f + 0.4f) - NMath.Floor(beer.Width * 0.30097f - 0.1f) - 0.5f, NMath.Floor(beer.Height * 0.14636f + 0.45f) - NMath.Floor(beer.Height * 0.00000f - 0.05f) - 0.5f)); OffWhite.SetFill(); oval23Path.Fill(); var oval24Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.15843f - 0.4f) + 0.9f, beer.GetMinY() + NMath.Floor(beer.Height * 0.01178f + 0.05f) + 0.45f, NMath.Floor(beer.Width * 0.34467f + 0.1f) - NMath.Floor(beer.Width * 0.15843f - 0.4f) - 0.5f, NMath.Floor(beer.Height * 0.15814f - 0.45f) - NMath.Floor(beer.Height * 0.01178f + 0.05f) + 0.5f)); OffWhite.SetFill(); oval24Path.Fill(); var oval25Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.23169f - 0.15f) + 0.65f, beer.GetMinY() + NMath.Floor(beer.Height * 0.14199f + 0.3f) + 0.2f, NMath.Floor(beer.Width * 0.41793f + 0.35f) - NMath.Floor(beer.Width * 0.23169f - 0.15f) - 0.5f, NMath.Floor(beer.Height * 0.28835f - 0.2f) - NMath.Floor(beer.Height * 0.14199f + 0.3f) + 0.5f)); OffWhite.SetFill(); oval25Path.Fill(); var oval26Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.25329f + 0.5f), beer.GetMinY() + NMath.Floor(beer.Height * 0.09504f - 0.05f) + 0.55f, NMath.Floor(beer.Width * 0.43953f) - NMath.Floor(beer.Width * 0.25329f + 0.5f) + 0.5f, NMath.Floor(beer.Height * 0.24140f + 0.45f) - NMath.Floor(beer.Height * 0.09504f - 0.05f) - 0.5f)); OffWhite.SetFill(); oval26Path.Fill(); var oval27Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.12218f - 0.1f) + 0.6f, beer.GetMinY() + NMath.Floor(beer.Height * 0.09504f - 0.05f) + 0.55f, NMath.Floor(beer.Width * 0.30842f + 0.4f) - NMath.Floor(beer.Width * 0.12218f - 0.1f) - 0.5f, NMath.Floor(beer.Height * 0.24140f + 0.45f) - NMath.Floor(beer.Height * 0.09504f - 0.05f) - 0.5f)); OffWhite.SetFill(); oval27Path.Fill(); var oval28Path = UIBezierPath.FromOval(new CGRect(beer.GetMinX() + NMath.Floor(beer.Width * 0.36702f - 0.4f) + 0.9f, beer.GetMinY() + NMath.Floor(beer.Height * 0.10910f - 0.35f) + 0.85f, NMath.Floor(beer.Width * 0.55327f + 0.1f) - NMath.Floor(beer.Width * 0.36702f - 0.4f) - 0.5f, NMath.Floor(beer.Height * 0.25546f + 0.15f) - NMath.Floor(beer.Height * 0.10910f - 0.35f) - 0.5f)); OffWhite.SetFill(); oval28Path.Fill(); } }
void DrawCanvas(CGRect frame) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var color = UIColor.FromRGBA(0.851f, 0.851f, 0.851f, 1.000f); var fillColor3 = UIColor.FromRGBA(0.333f, 0.333f, 0.333f, 1.000f); var fillColor4 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); var fillColor5 = UIColor.FromRGBA(0.867f, 0.867f, 0.863f, 1.000f); var fillColor6 = UIColor.FromRGBA(0.671f, 0.671f, 0.671f, 1.000f); var fillColor7 = UIColor.FromRGBA(0.467f, 0.467f, 0.467f, 1.000f); var fillColor8 = UIColor.FromRGBA(0.918f, 0.478f, 0.149f, 1.000f); var fillColor9 = UIColor.FromRGBA(0.529f, 0.529f, 0.529f, 1.000f); var fillColor10 = UIColor.FromRGBA(0.271f, 0.271f, 0.271f, 1.000f); var color2 = UIColor.FromRGBA(0.941f, 0.941f, 0.941f, 1.000f); var color5 = UIColor.FromRGBA(0.275f, 0.275f, 0.275f, 1.000f); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX(), frame.GetMinY() + NMath.Floor((frame.Height) * 0.00000f + 0.5f), frame.Width - 0.5f, frame.Height - NMath.Floor((frame.Height) * 0.00000f + 0.5f)), 4.0f); color2.SetFill(); rectanglePath.Fill(); color.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); //// Group 2 { context.SaveState(); context.TranslateCTM(frame.GetMinX() + 0.43716f * frame.Width, frame.GetMinY() + 0.12195f * frame.Height); context.ScaleCTM(0.4f, 0.4f); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRect(new CGRect(0.0f, 36.0f, 112.0f, 36.0f)); fillColor3.SetFill(); rectangle2Path.Fill(); //// Rectangle 3 Drawing var rectangle3Path = UIBezierPath.FromRect(new CGRect(0.0f, 72.0f, 112.0f, 8.0f)); fillColor4.SetFill(); rectangle3Path.Fill(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(0.0f, 80.0f)); bezierPath.AddCurveToPoint(new CGPoint(8.0f, 88.0f), new CGPoint(0.0f, 84.42f), new CGPoint(3.58f, 88.0f)); bezierPath.AddLineTo(new CGPoint(104.0f, 88.0f)); bezierPath.AddCurveToPoint(new CGPoint(112.0f, 80.0f), new CGPoint(108.42f, 88.0f), new CGPoint(112.0f, 84.42f)); bezierPath.AddLineTo(new CGPoint(0.0f, 80.0f)); bezierPath.AddLineTo(new CGPoint(0.0f, 80.0f)); bezierPath.ClosePath(); bezierPath.UsesEvenOddFillRule = true; fillColor5.SetFill(); bezierPath.Fill(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(56.3f, 88.0f)); bezier2Path.AddLineTo(new CGPoint(104.0f, 88.0f)); bezier2Path.AddCurveToPoint(new CGPoint(112.0f, 80.0f), new CGPoint(108.42f, 88.0f), new CGPoint(112.0f, 84.42f)); bezier2Path.AddLineTo(new CGPoint(48.3f, 80.0f)); bezier2Path.AddLineTo(new CGPoint(56.3f, 88.0f)); bezier2Path.AddLineTo(new CGPoint(56.3f, 88.0f)); bezier2Path.ClosePath(); bezier2Path.UsesEvenOddFillRule = true; fillColor6.SetFill(); bezier2Path.Fill(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRect(new CGRect(0.0f, 28.0f, 112.0f, 8.0f)); fillColor4.SetFill(); rectangle4Path.Fill(); //// Bezier 3 Drawing UIBezierPath bezier3Path = new UIBezierPath(); bezier3Path.MoveTo(new CGPoint(104.0f, 8.0f)); bezier3Path.AddLineTo(new CGPoint(76.0f, 8.0f)); bezier3Path.AddLineTo(new CGPoint(68.0f, 0.0f)); bezier3Path.AddLineTo(new CGPoint(44.0f, 0.0f)); bezier3Path.AddLineTo(new CGPoint(36.0f, 8.0f)); bezier3Path.AddLineTo(new CGPoint(8.0f, 8.0f)); bezier3Path.AddCurveToPoint(new CGPoint(0.0f, 16.0f), new CGPoint(3.6f, 8.0f), new CGPoint(0.0f, 11.6f)); bezier3Path.AddLineTo(new CGPoint(0.0f, 28.0f)); bezier3Path.AddLineTo(new CGPoint(112.0f, 28.0f)); bezier3Path.AddLineTo(new CGPoint(112.0f, 16.0f)); bezier3Path.AddCurveToPoint(new CGPoint(104.0f, 8.0f), new CGPoint(112.0f, 11.58f), new CGPoint(108.42f, 8.0f)); bezier3Path.AddLineTo(new CGPoint(104.0f, 8.0f)); bezier3Path.ClosePath(); bezier3Path.UsesEvenOddFillRule = true; fillColor5.SetFill(); bezier3Path.Fill(); //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new CGRect(28.0f, 20.0f, 56.0f, 56.0f)); fillColor7.SetFill(); ovalPath.Fill(); //// Oval 2 Drawing var oval2Path = UIBezierPath.FromOval(new CGRect(32.0f, 24.0f, 48.0f, 48.0f)); fillColor4.SetFill(); oval2Path.Fill(); //// Oval 3 Drawing var oval3Path = UIBezierPath.FromOval(new CGRect(8.0f, 16.0f, 8.0f, 8.0f)); fillColor8.SetFill(); oval3Path.Fill(); //// Group 3 { context.SaveState(); context.SetAlpha(0.4f); context.BeginTransparencyLayer(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(104.0f, 24.0f)); bezier4Path.AddLineTo(new CGPoint(96.0f, 24.0f)); bezier4Path.AddLineTo(new CGPoint(104.0f, 16.0f)); bezier4Path.AddLineTo(new CGPoint(104.0f, 24.0f)); bezier4Path.ClosePath(); bezier4Path.UsesEvenOddFillRule = true; fillColor3.SetFill(); bezier4Path.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new CGPoint(96.0f, 24.0f)); bezier5Path.AddLineTo(new CGPoint(96.0f, 16.0f)); bezier5Path.AddLineTo(new CGPoint(104.0f, 16.0f)); bezier5Path.AddLineTo(new CGPoint(96.0f, 24.0f)); bezier5Path.ClosePath(); bezier5Path.UsesEvenOddFillRule = true; fillColor9.SetFill(); bezier5Path.Fill(); //// Oval 4 Drawing var oval4Path = UIBezierPath.FromOval(new CGRect(40.0f, 32.0f, 32.0f, 32.0f)); fillColor3.SetFill(); oval4Path.Fill(); //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new CGPoint(60.0f, 36.0f)); bezier6Path.AddCurveToPoint(new CGPoint(44.0f, 52.0f), new CGPoint(51.16f, 36.0f), new CGPoint(44.0f, 43.16f)); bezier6Path.AddCurveToPoint(new CGPoint(46.88f, 61.12f), new CGPoint(44.0f, 55.4f), new CGPoint(45.07f, 58.53f)); bezier6Path.AddCurveToPoint(new CGPoint(56.0f, 64.0f), new CGPoint(49.47f, 62.93f), new CGPoint(52.6f, 64.0f)); bezier6Path.AddCurveToPoint(new CGPoint(72.0f, 48.0f), new CGPoint(64.84f, 64.0f), new CGPoint(72.0f, 56.84f)); bezier6Path.AddCurveToPoint(new CGPoint(69.12f, 38.88f), new CGPoint(72.0f, 44.6f), new CGPoint(70.93f, 41.47f)); bezier6Path.AddCurveToPoint(new CGPoint(60.0f, 36.0f), new CGPoint(66.53f, 37.07f), new CGPoint(63.4f, 36.0f)); bezier6Path.AddLineTo(new CGPoint(60.0f, 36.0f)); bezier6Path.ClosePath(); bezier6Path.UsesEvenOddFillRule = true; fillColor7.SetFill(); bezier6Path.Fill(); //// Oval 5 Drawing var oval5Path = UIBezierPath.FromOval(new CGRect(48.0f, 40.0f, 12.0f, 12.0f)); fillColor6.SetFill(); oval5Path.Fill(); //// Oval 6 Drawing var oval6Path = UIBezierPath.FromOval(new CGRect(60.0f, 48.0f, 8.0f, 8.0f)); fillColor5.SetFill(); oval6Path.Fill(); //// Group 4 { context.SaveState(); context.SetAlpha(0.4f); context.BeginTransparencyLayer(); //// Bezier 7 Drawing UIBezierPath bezier7Path = new UIBezierPath(); bezier7Path.MoveTo(new CGPoint(41.65f, 72.0f)); bezier7Path.AddCurveToPoint(new CGPoint(35.96f, 67.54f), new CGPoint(39.57f, 70.75f), new CGPoint(37.65f, 69.26f)); bezier7Path.AddLineTo(new CGPoint(35.9f, 67.6f)); bezier7Path.AddLineTo(new CGPoint(40.3f, 72.0f)); bezier7Path.AddLineTo(new CGPoint(41.65f, 72.0f)); bezier7Path.AddLineTo(new CGPoint(41.65f, 72.0f)); bezier7Path.ClosePath(); bezier7Path.UsesEvenOddFillRule = true; fillColor3.SetFill(); bezier7Path.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier 8 Drawing UIBezierPath bezier8Path = new UIBezierPath(); bezier8Path.MoveTo(new CGPoint(81.26f, 36.0f)); bezier8Path.AddCurveToPoint(new CGPoint(84.0f, 48.0f), new CGPoint(83.0f, 39.64f), new CGPoint(84.0f, 43.7f)); bezier8Path.AddCurveToPoint(new CGPoint(70.36f, 72.0f), new CGPoint(84.0f, 58.2f), new CGPoint(78.52f, 67.1f)); bezier8Path.AddLineTo(new CGPoint(112.0f, 72.0f)); bezier8Path.AddLineTo(new CGPoint(112.0f, 64.5f)); bezier8Path.AddLineTo(new CGPoint(83.5f, 36.0f)); bezier8Path.AddLineTo(new CGPoint(81.26f, 36.0f)); bezier8Path.AddLineTo(new CGPoint(81.26f, 36.0f)); bezier8Path.ClosePath(); bezier8Path.UsesEvenOddFillRule = true; fillColor10.SetFill(); bezier8Path.Fill(); context.RestoreState(); } //// Text Drawing CGRect textRect = new CGRect(frame.GetMinX() + 7.0f, frame.GetMinY() + NMath.Floor((frame.Height - 8.0f) * 0.67568f + 0.5f), frame.Width - 14.0f, frame.Height - 8.0f - NMath.Floor((frame.Height - 8.0f) * 0.67568f + 0.5f)); { var textContent = "Picture Search"; color5.SetFill(); var textStyle = new NSMutableParagraphStyle(); textStyle.Alignment = UITextAlignment.Center; var textFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Medium", UIFont.ButtonFontSize), ForegroundColor = color5, ParagraphStyle = textStyle }; var textTextHeight = new NSString(textContent).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height; context.SaveState(); context.ClipToRect(textRect); new NSString(textContent).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.FromName("Avenir-Medium", UIFont.ButtonFontSize), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); } }
//// Drawing Methods public static void DrawUISwitch(bool inFocus, bool switchOn) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Shadow Declarations var shadow = new NSShadow(); shadow.ShadowColor = CustomControlsStyleKit.ShadowColor; shadow.ShadowOffset = new CGSize(0.1f, 5.1f); shadow.ShadowBlurRadius = 5.0f; //// Variable Declarations var thumbHeight = inFocus ? 85.0f : 65.0f; var thumbY = inFocus ? 6.0f : 16.0f; var thumbColor = inFocus ? CustomControlsStyleKit.InFocusThumbColor : CustomControlsStyleKit.UnFocusedThumbColor; var textColor = inFocus ? CustomControlsStyleKit.InFocusTextColor : CustomControlsStyleKit.UnFocusedTextColor; var gutterColor = switchOn ? (inFocus ? CustomControlsStyleKit.OnColor : CustomControlsStyleKit.OnColorUnFocused) : (inFocus ? CustomControlsStyleKit.OffColor : CustomControlsStyleKit.OffColorUnFocused); var thumbX = switchOn ? 147.0f : 11.0f; var switchOff = !switchOn; //// Gutter Drawing var gutterPath = UIBezierPath.FromRoundedRect(new CGRect(11.0f, 16.0f, 227.0f, 67.0f), 4.0f); gutterColor.SetFill(); gutterPath.Fill(); ////// Gutter Inner Shadow context.SaveState(); context.ClipToRect(gutterPath.Bounds); context.SetShadow(new CGSize(0, 0), 0); context.SetAlpha(shadow.ShadowColor.CGColor.Alpha); context.BeginTransparencyLayer(); { var opaqueShadow = new CGColor(shadow.ShadowColor.CGColor, 1.0f); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, opaqueShadow); context.SetBlendMode(CGBlendMode.SourceOut); context.BeginTransparencyLayer(); context.SetFillColor(opaqueShadow); gutterPath.Fill(); context.EndTransparencyLayer(); } context.EndTransparencyLayer(); context.RestoreState(); CustomControlsStyleKit.BorderColor.SetStroke(); gutterPath.LineWidth = 2.0f; gutterPath.Stroke(); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(thumbX, thumbY, 91.0f, thumbHeight), 4.0f); context.SaveState(); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor); thumbColor.SetFill(); rectanglePath.Fill(); context.RestoreState(); CustomControlsStyleKit.BorderColor.SetStroke(); rectanglePath.LineWidth = 2.0f; rectanglePath.Stroke(); if (switchOn) { //// OnText Drawing CGRect onTextRect = new CGRect(26.0f, 27.0f, 99.0f, 49.0f); { var textContent = "ON"; textColor.SetFill(); var onTextStyle = new NSMutableParagraphStyle (); onTextStyle.Alignment = UITextAlignment.Center; var onTextFontAttributes = new UIStringAttributes () {Font = UIFont.BoldSystemFontOfSize(27.0f), ForegroundColor = textColor, ParagraphStyle = onTextStyle}; var onTextTextHeight = new NSString(textContent).GetBoundingRect(new CGSize(onTextRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, onTextFontAttributes, null).Height+10; context.SaveState(); context.ClipToRect(onTextRect); new NSString(textContent).DrawString(new CGRect(onTextRect.GetMinX(), onTextRect.GetMinY() + (onTextRect.Height - onTextTextHeight) / 2.0f, onTextRect.Width, onTextTextHeight), UIFont.BoldSystemFontOfSize(27.0f), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); } } if (switchOff) { //// OffText Drawing CGRect offTextRect = new CGRect(123.0f, 27.0f, 99.0f, 49.0f); { var textContent = "OFF"; textColor.SetFill(); var offTextStyle = new NSMutableParagraphStyle (); offTextStyle.Alignment = UITextAlignment.Center; var offTextFontAttributes = new UIStringAttributes () {Font = UIFont.BoldSystemFontOfSize(27.0f), ForegroundColor = textColor, ParagraphStyle = offTextStyle}; var offTextTextHeight = new NSString(textContent).GetBoundingRect(new CGSize(offTextRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, offTextFontAttributes, null).Height+10; context.SaveState(); context.ClipToRect(offTextRect); new NSString(textContent).DrawString(new CGRect(offTextRect.GetMinX(), offTextRect.GetMinY() + (offTextRect.Height - offTextTextHeight) / 2.0f, offTextRect.Width, offTextTextHeight), UIFont.BoldSystemFontOfSize(27.0f), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); } } }
private void DrawCanvas(CGRect frame, string beerName) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var fillColor = UIColor.FromRGBA(0.500f, 0.500f, 0.500f, 1.000f); var shadowTint = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); var fillColor2 = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var strokeColor = UIColor.FromRGBA(0.531f, 0.531f, 0.531f, 1.000f); var textForeground2 = UIColor.FromRGBA(0.408f, 0.408f, 0.408f, 1.000f); //// Shadow Declarations var shadow2 = new NSShadow(); shadow2.ShadowColor = shadowTint.ColorWithAlpha(shadowTint.CGColor.Alpha * 0.3f); shadow2.ShadowOffset = new CGSize(930.1f, -0.1f); shadow2.ShadowBlurRadius = 10.0f; //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(-921.0f, 9.0f, 395.0f, 418.0f), 8.0f); context.SaveState(); context.SetShadow(shadow2.ShadowOffset, shadow2.ShadowBlurRadius, shadow2.ShadowColor.CGColor); fillColor.SetFill(); rectanglePath.Fill(); context.RestoreState(); //// Group { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 2 UIBezierPath clip2Path = new UIBezierPath(); clip2Path.MoveTo(new CGPoint(-11.5f, -11.5f)); clip2Path.AddLineTo(new CGPoint(424.5f, -11.5f)); clip2Path.AddLineTo(new CGPoint(424.5f, 447.5f)); clip2Path.AddLineTo(new CGPoint(-11.5f, 447.5f)); clip2Path.AddLineTo(new CGPoint(-11.5f, -11.5f)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(9.5f, 17.0f)); clip2Path.AddCurveToPoint(new CGPoint(17.0f, 9.5f), new CGPoint(9.5f, 12.86f), new CGPoint(12.86f, 9.5f)); clip2Path.AddLineTo(new CGPoint(396.0f, 9.5f)); clip2Path.AddCurveToPoint(new CGPoint(403.5f, 17.0f), new CGPoint(400.14f, 9.5f), new CGPoint(403.5f, 12.86f)); clip2Path.AddLineTo(new CGPoint(403.5f, 419.0f)); clip2Path.AddCurveToPoint(new CGPoint(396.0f, 426.5f), new CGPoint(403.5f, 423.14f), new CGPoint(400.14f, 426.5f)); clip2Path.AddLineTo(new CGPoint(17.0f, 426.5f)); clip2Path.AddCurveToPoint(new CGPoint(9.5f, 419.0f), new CGPoint(12.86f, 426.5f), new CGPoint(9.5f, 423.14f)); clip2Path.AddLineTo(new CGPoint(9.5f, 17.0f)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(8.5f, 17.0f)); clip2Path.AddLineTo(new CGPoint(8.5f, 419.0f)); clip2Path.AddCurveToPoint(new CGPoint(17.0f, 427.5f), new CGPoint(8.5f, 423.69f), new CGPoint(12.31f, 427.5f)); clip2Path.AddLineTo(new CGPoint(396.0f, 427.5f)); clip2Path.AddCurveToPoint(new CGPoint(404.5f, 419.0f), new CGPoint(400.69f, 427.5f), new CGPoint(404.5f, 423.69f)); clip2Path.AddLineTo(new CGPoint(404.5f, 17.0f)); clip2Path.AddCurveToPoint(new CGPoint(396.0f, 8.5f), new CGPoint(404.5f, 12.31f), new CGPoint(400.69f, 8.5f)); clip2Path.AddLineTo(new CGPoint(17.0f, 8.5f)); clip2Path.AddCurveToPoint(new CGPoint(8.5f, 17.0f), new CGPoint(12.31f, 8.5f), new CGPoint(8.5f, 12.31f)); clip2Path.ClosePath(); clip2Path.UsesEvenOddFillRule = true; clip2Path.AddClip(); //// Group 2 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip var clipPath = UIBezierPath.FromRoundedRect(new CGRect(9.0f, 9.0f, 395.0f, 418.0f), 8.0f); clipPath.AddClip(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRoundedRect(new CGRect(9.0f, 9.0f, 395.0f, 418.0f), 8.0f); fillColor2.SetFill(); rectangle2Path.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } context.EndTransparencyLayer(); context.RestoreState(); } //// background { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 3 var clip3Path = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX(), frame.GetMinY() + 9.0f, 395.0f, 418.0f), 8.0f); clip3Path.AddClip(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX(), frame.GetMinY() + 9.0f, 395.0f, 418.0f), 8.0f); strokeColor.SetStroke(); rectangle4Path.LineWidth = 2.0f; rectangle4Path.Stroke(); context.EndTransparencyLayer(); context.RestoreState(); } //// title Drawing CGRect titleRect = new CGRect(frame.GetMinX() + 0.38f, frame.GetMinY() + 19.0f, 394.62f, 41.0f); textForeground2.SetFill(); var titleStyle = new NSMutableParagraphStyle (); titleStyle.Alignment = UITextAlignment.Center; var titleFontAttributes = new UIStringAttributes () {Font = UIFont.FromName("Avenir-Medium", 24.0f), ForegroundColor = textForeground2, ParagraphStyle = titleStyle}; var titleTextHeight = new NSString(beerName).GetBoundingRect(new CGSize(titleRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, titleFontAttributes, null).Height; context.SaveState(); context.ClipToRect(titleRect); new NSString(beerName).DrawString(new CGRect(titleRect.GetMinX(), titleRect.GetMinY() + (titleRect.Height - titleTextHeight) / 2.0f, titleRect.Width, titleTextHeight), UIFont.FromName("Avenir-Medium", 24.0f), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); }
public static void DrawUIControlWell(CGRect frame, bool inFocus, string title) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var wellColor = UIColor.FromRGBA(0.029f, 0.029f, 0.029f, 0.189f); //// Variable Declarations var textColor = inFocus ? CustomControlsStyleKit.InFocusTextColor : CustomControlsStyleKit.UnFocusedTextColor; //// Background Drawing var backgroundPath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX() + 1.0f, frame.GetMinY() + 1.0f, NMath.Floor((frame.Width - 1.0f) * 0.99749f + 0.5f), NMath.Floor((frame.Height - 1.0f) * 0.98990f + 0.5f)), 4.0f); wellColor.SetFill(); backgroundPath.Fill(); //// Text Drawing CGRect textRect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.03250f + 0.5f), frame.GetMinY() + NMath.Floor(frame.Height * 0.19000f + 0.5f), NMath.Floor(frame.Width * 0.97250f + 0.5f) - NMath.Floor(frame.Width * 0.03250f + 0.5f), NMath.Floor(frame.Height * 0.80000f + 0.5f) - NMath.Floor(frame.Height * 0.19000f + 0.5f)); textColor.SetFill(); var textStyle = new NSMutableParagraphStyle (); textStyle.Alignment = UITextAlignment.Center; var textFontAttributes = new UIStringAttributes () {Font = UIFont.BoldSystemFontOfSize(27.0f), ForegroundColor = textColor, ParagraphStyle = textStyle}; var textTextHeight = new NSString(title).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height; context.SaveState(); context.ClipToRect(textRect); new NSString(title).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.BoldSystemFontOfSize(27.0f), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); }
public override void Draw(CGRect rect) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var fillColor = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var strokeColor3 = UIColor.FromRGBA(0.716f, 0.716f, 0.716f, 1.000f); var shadowTint2 = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f); var strokeColor4 = UIColor.FromRGBA(0.807f, 0.807f, 0.807f, 1.000f); var fillColor4 = UIColor.FromRGBA(0.969f, 0.969f, 0.969f, 1.000f); var fillColor6 = UIColor.FromRGBA(0.314f, 0.824f, 0.761f, 1.000f); var strokeColor5 = UIColor.FromRGBA(0.855f, 0.855f, 0.855f, 1.000f); //// Shadow Declarations var shadow3 = new NSShadow(); shadow3.ShadowColor = shadowTint2.ColorWithAlpha(shadowTint2.CGColor.Alpha * 0.13f); shadow3.ShadowOffset = new CGSize(1450.1f, 2.1f); shadow3.ShadowBlurRadius = 4.0f; //// Group 5 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 5 var clip5Path = UIBezierPath.FromRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 248.55f, 686.9f, 265.6f)); clip5Path.AddClip(); //// Rectangle 6 Drawing var rectangle6Path = UIBezierPath.FromRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 248.55f, 686.9f, 265.6f)); strokeColor4.SetStroke(); rectangle6Path.LineWidth = 2.0f; rectangle6Path.Stroke(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(rect.GetMinX() + 687.41f, rect.GetMinY() + 349.29f)); bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 353.29f)); bezierPath.LineCapStyle = CGLineCap.Square; strokeColor3.SetStroke(); bezierPath.LineWidth = 1.0f; bezierPath.Stroke(); //// Group { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip var clipPath = UIBezierPath.FromRect(new CGRect(rect.GetMinX() - 13.0f, rect.GetMinY() - 17.0f, 725.0f, 556.0f)); clipPath.AddClip(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 2.0f)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 1444.0f, rect.GetMinY() - 2.0f), new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() - 0.21f), new CGPoint(rect.GetMinX() - 1446.2f, rect.GetMinY() - 2.0f)); bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 765.08f, rect.GetMinY() - 2.0f)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() - 762.87f, rect.GetMinY() - 2.0f), new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() - 0.21f)); bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 509.16f)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 765.08f, rect.GetMinY() + 513.16f), new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 511.37f), new CGPoint(rect.GetMinX() - 762.88f, rect.GetMinY() + 513.16f)); bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 1444.0f, rect.GetMinY() + 513.16f)); bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() - 1446.21f, rect.GetMinY() + 513.16f), new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 511.37f)); bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 2.0f)); bezier2Path.ClosePath(); bezier2Path.UsesEvenOddFillRule = true; context.SaveState(); context.SetShadow(shadow3.ShadowOffset, shadow3.ShadowBlurRadius, shadow3.ShadowColor.CGColor); fillColor.SetFill(); bezier2Path.Fill(); context.RestoreState(); context.EndTransparencyLayer(); context.RestoreState(); } //// Group 2 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 3 UIBezierPath clip3Path = new UIBezierPath(); clip3Path.MoveTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() - 22.5f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 712.41f, rect.GetMinY() - 22.5f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 712.41f, rect.GetMinY() + 533.66f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() + 533.66f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() - 22.5f)); clip3Path.ClosePath(); clip3Path.MoveTo(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 2.0f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() - 1.5f), new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 0.07f), new CGPoint(rect.GetMinX() + 7.07f, rect.GetMinY() - 1.5f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() - 1.5f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() + 689.85f, rect.GetMinY() - 1.5f), new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 0.07f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 509.16f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() + 512.66f), new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 511.09f), new CGPoint(rect.GetMinX() + 689.85f, rect.GetMinY() + 512.66f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() + 512.66f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() + 7.07f, rect.GetMinY() + 512.66f), new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 511.09f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 2.0f)); clip3Path.ClosePath(); clip3Path.MoveTo(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 2.0f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 509.16f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 511.65f), new CGPoint(rect.GetMinX() + 6.52f, rect.GetMinY() + 513.66f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() + 513.66f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() + 690.4f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 511.64f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 2.0f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() - 2.5f), new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() - 0.49f), new CGPoint(rect.GetMinX() + 690.4f, rect.GetMinY() - 2.5f)); clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() - 2.5f)); clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() + 6.52f, rect.GetMinY() - 2.5f), new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() - 0.48f)); clip3Path.ClosePath(); clip3Path.UsesEvenOddFillRule = true; clip3Path.AddClip(); //// Group 3 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 2 var clip2Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 5.0f, rect.GetMinY() - 1.98f, 686.9f, 515.15f), 4.0f); clip2Path.AddClip(); //// Rectangle 2 Drawing var rectangle2Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 5.0f, rect.GetMinY() - 1.98f, 686.9f, 515.15f), 4.0f); fillColor.SetFill(); rectangle2Path.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } context.EndTransparencyLayer(); context.RestoreState(); } //// Group 4 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 4 var clip4Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 3.02f, 686.9f, 515.15f), 4.0f); clip4Path.AddClip(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 3.02f, 686.9f, 515.15f), 4.0f); strokeColor4.SetStroke(); rectangle4Path.LineWidth = 2.0f; rectangle4Path.Stroke(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.57f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 249.06f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 249.06f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.73f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.57f)); bezier4Path.ClosePath(); bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.57f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.73f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 249.06f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 261.48f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 501.24f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 513.66f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 514.16f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 514.16f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.99f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 501.24f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 261.48f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 249.06f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.56f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.57f)); bezier4Path.ClosePath(); bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f)); bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 514.16f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.99f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 514.16f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 513.66f)); bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f)); bezier4Path.ClosePath(); fillColor4.SetFill(); bezier4Path.Fill(); //// Bezier 5 Drawing UIBezierPath bezier5Path = new UIBezierPath(); bezier5Path.MoveTo(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 513.16f)); bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 513.16f)); bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 589.34f)); bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 686.91f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 591.55f), new CGPoint(rect.GetMinX() + 689.13f, rect.GetMinY() + 593.34f)); bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 350.63f, rect.GetMinY() + 593.34f)); bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 342.63f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 348.42f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 344.84f, rect.GetMinY() + 593.34f)); bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 8.01f, rect.GetMinY() + 593.34f)); bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 589.34f), new CGPoint(rect.GetMinX() + 5.8f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 591.55f)); bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 513.16f)); bezier5Path.ClosePath(); bezier5Path.UsesEvenOddFillRule = true; fillColor6.SetFill(); bezier5Path.Fill(); //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new CGPoint(rect.GetMinX() + 345.0f, rect.GetMinY() + 110.0f)); bezier6Path.AddLineTo(new CGPoint(rect.GetMinX() + 345.46f, rect.GetMinY() + 4.0f)); bezier6Path.LineCapStyle = CGLineCap.Square; strokeColor5.SetStroke(); bezier6Path.LineWidth = 2.0f; bezier6Path.Stroke(); //// Bezier 7 Drawing UIBezierPath bezier7Path = new UIBezierPath(); bezier7Path.MoveTo(new CGPoint(rect.GetMinX() + 689.01f, rect.GetMinY() + 399.9f)); bezier7Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 399.9f)); bezier7Path.LineCapStyle = CGLineCap.Square; strokeColor5.SetStroke(); bezier7Path.LineWidth = 2.0f; bezier7Path.Stroke(); //// Bezier 8 Drawing UIBezierPath bezier8Path = new UIBezierPath(); bezier8Path.MoveTo(new CGPoint(rect.GetMinX() + 688.91f, rect.GetMinY() + 110.25f)); bezier8Path.AddLineTo(new CGPoint(rect.GetMinX() + 6.01f, rect.GetMinY() + 110.25f)); bezier8Path.LineCapStyle = CGLineCap.Square; strokeColor5.SetStroke(); bezier8Path.LineWidth = 2.0f; bezier8Path.Stroke(); }
//// Drawing Methods public static void DrawLightMapPoint(float lightColorR, float lightColorG, float lightColorB, float lightColorA, string rank, float fontSize) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var lightBaseColor = UIColor.FromRGBA(0.009f, 0.471f, 0.009f, 1.000f); //// Shadow Declarations var shadow = new NSShadow(); shadow.ShadowColor = UIColor.Black.ColorWithAlpha(0.62f); shadow.ShadowOffset = new CGSize(0.1f, -0.1f); shadow.ShadowBlurRadius = 5.0f; //// Variable Declarations var lightColor = UIColor.FromRGBA(lightColorR, lightColorG, lightColorB, lightColorA); //// LightIcon { //// Oval Drawing var ovalPath = UIBezierPath.FromOval(new CGRect(1.0f, 1.0f, 18.0f, 38.0f)); lightColor.SetFill(); ovalPath.Fill(); ////// Oval Inner Shadow context.SaveState(); context.ClipToRect(ovalPath.Bounds); context.SetShadow(new CGSize(0, 0), 0); context.SetAlpha(shadow.ShadowColor.CGColor.Alpha); context.BeginTransparencyLayer(); { var opaqueShadow = new CGColor(shadow.ShadowColor.CGColor, 1.0f); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, opaqueShadow); context.SetBlendMode(CGBlendMode.SourceOut); context.BeginTransparencyLayer(); context.SetFillColor(opaqueShadow); ovalPath.Fill(); context.EndTransparencyLayer(); } context.EndTransparencyLayer(); context.RestoreState(); //// Rectangle Drawing var rectanglePath = UIBezierPath.FromRect(new CGRect(3.0f, 34.0f, 14.0f, 12.0f)); lightBaseColor.SetFill(); rectanglePath.Fill(); ////// Rectangle Inner Shadow context.SaveState(); context.ClipToRect(rectanglePath.Bounds); context.SetShadow(new CGSize(0, 0), 0); context.SetAlpha(shadow.ShadowColor.CGColor.Alpha); context.BeginTransparencyLayer(); { var opaqueShadow = new CGColor(shadow.ShadowColor.CGColor, 1.0f); context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, opaqueShadow); context.SetBlendMode(CGBlendMode.SourceOut); context.BeginTransparencyLayer(); context.SetFillColor(opaqueShadow); rectanglePath.Fill(); context.EndTransparencyLayer(); } context.EndTransparencyLayer(); context.RestoreState(); } //// Text Drawing CGRect textRect = new CGRect(0.0f, 8.0f, 20.0f, 23.0f); UIColor.White.SetFill(); var textStyle = new NSMutableParagraphStyle (); textStyle.Alignment = UITextAlignment.Center; var textFontAttributes = new UIStringAttributes () {Font = UIFont.SystemFontOfSize(fontSize), ForegroundColor = UIColor.White, ParagraphStyle = textStyle}; var textTextHeight = new NSString(rank).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height; context.SaveState(); context.ClipToRect(textRect); new NSString(rank).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.SystemFontOfSize(fontSize), UILineBreakMode.WordWrap, UITextAlignment.Center); context.RestoreState(); }
private void drawArc(CGContext context, CGRect rect) { var radius = rect.GetMaxY() * badgeCornerRoundness; var puffer = new nfloat(Padding(rect)); var maxX = rect.GetMaxX() - puffer; var maxY = rect.GetMaxY() - puffer; var minX = rect.GetMinX() + puffer; var minY = rect.GetMinY() + puffer; double pi = Math.PI; context.AddArc(new nfloat(maxX - radius), new nfloat(minY + radius), new nfloat(radius), new nfloat(pi + (pi / 2)), 0, false); context.AddArc(new nfloat(maxX - radius), new nfloat(minY - radius), new nfloat(radius), 0, new nfloat(pi / 2), false); }
public override void Draw(CGRect frame) { // General Declarations var context = UIGraphics.GetCurrentContext(); // Color Declarations var minimumTrackColor = UIColor.FromRGBA(0.502f, 0.812f, 0.769f, 1.000f); var maximumTrackColor = UIColor.FromRGBA(0.314f, 0.314f, 0.314f, 1.000f); var color = UIColor.FromRGBA(0.376f, 0.490f, 0.722f, 1.000f); // Variable Declarations var expression2 = percentage*2.0f; var expression = new CGPoint(25.0f + expression2, 61.0f); var expression3 = 200.0f - percentage*2.0f; // Minimum Track Drawing var minimumTrackPath = UIBezierPath.FromRoundedRect( new CGRect(frame.GetMinX(), frame.GetMinY() + 24.0f, frame.Width, frame.Height - 29.0f), 2.0f); minimumTrackColor.SetFill(); minimumTrackPath.Fill(); // Maximum Track Drawing context.SaveState(); context.TranslateCTM(frame.GetMinX() + 1.00000f*frame.Width, frame.GetMinY() + 0.85714f*frame.Height); context.RotateCTM(-180.0f*NMath.PI/180.0f); var maximumTrackPath = UIBezierPath.FromRoundedRect(new CGRect(0.0f, 0.0f, expression3, 6.0f), UIRectCorner.TopLeft | UIRectCorner.BottomLeft, new CGSize(2.0f, 2.0f)); maximumTrackPath.ClosePath(); maximumTrackColor.SetFill(); maximumTrackPath.Fill(); context.RestoreState(); // Bezier Drawing context.SaveState(); context.TranslateCTM(expression.X, expression.Y); UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(0.0f, 2.01f)); bezierPath.AddCurveToPoint(new CGPoint(2.6f, 0.0f), new CGPoint(0.0f, 0.9f), new CGPoint(1.17f, 0.0f)); bezierPath.AddLineTo(new CGPoint(10.4f, 0.0f)); bezierPath.AddCurveToPoint(new CGPoint(13.0f, 2.01f), new CGPoint(11.84f, 0.0f), new CGPoint(13.0f, 0.9f)); bezierPath.AddLineTo(new CGPoint(13.0f, 13.04f)); bezierPath.AddCurveToPoint(new CGPoint(11.29f, 16.56f), new CGPoint(13.0f, 14.15f), new CGPoint(12.23f, 15.73f)); bezierPath.AddLineTo(new CGPoint(6.5f, 20.81f)); bezierPath.AddLineTo(new CGPoint(6.5f, 23.65f)); bezierPath.AddLineTo(new CGPoint(6.5f, 20.81f)); bezierPath.AddLineTo(new CGPoint(1.71f, 16.56f)); bezierPath.AddCurveToPoint(new CGPoint(0.0f, 13.04f), new CGPoint(0.76f, 15.73f), new CGPoint(0.0f, 14.15f)); bezierPath.AddLineTo(new CGPoint(0.0f, 2.01f)); bezierPath.ClosePath(); bezierPath.UsesEvenOddFillRule = true; color.SetFill(); bezierPath.Fill(); UIColor.White.SetStroke(); bezierPath.LineWidth = 1.5f; bezierPath.Stroke(); context.RestoreState(); }
private void ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect, Action<CGRect> removedHandler, Action<CGRect> addedHandler) { if (CGRect.Intersect (newRect, oldRect) != CGRect.Empty) { var oldMaxY = oldRect.GetMaxY (); var oldMinY = oldRect.GetMinY (); var newMaxY = newRect.GetMaxY (); var newMinY = newRect.GetMinY (); if (newMaxY > oldMaxY) { var rectToAdd = new CGRect (newRect.X, oldMaxY, newRect.Size.Width, (newMaxY - oldMaxY)); addedHandler (rectToAdd); } if (oldMinY > newMinY) { var rectToAdd = new CGRect (newRect.X, newMinY, newRect.Size.Width, (oldMinY - newMinY)); addedHandler (rectToAdd); } if (newMaxY < oldMaxY) { var rectToRemove = new CGRect (newRect.X, newMaxY, newRect.Size.Width, (oldMaxY - newMaxY)); removedHandler (rectToRemove); } if (oldMinY < newMinY) { var rectToRemove = new CGRect (newRect.X, oldMinY, newRect.Size.Width, (newMinY - oldMinY)); removedHandler (rectToRemove); } } else { addedHandler (newRect); removedHandler (oldRect); } }
public override void Draw (CGRect rect) { base.Draw (rect); _highTemps = null; _lowTemps = null; _hourlyTemps = null; if (Forecasts.Count == 0 || Hourly.Count == 0) return; graphRect = new CGRect (rect.X + padding, rect.Y + padding, rect.Width - (padding * 2), rect.Height - (padding * 2)); var days = Hourly.GroupBy (h => h.FCTTIME.mday).Select (g => g.First ().FCTTIME.weekday_name_abbrev).ToList (); var dayCount = hourly ? days.Count : Forecasts.Count; var xAxisScale = (graphRect.Width + padding / 2) / dayCount; inset = xAxisScale / 2; var highest = (nfloat)(hourly ? HourlyTemps.Max () : HighTemps.Max ()); var lowest = (nfloat)(hourly ? HourlyTemps.Min () : LowTemps.Min ()); scaleHigh = NMath.Round (highest, MidpointRounding.AwayFromZero); scaleLow = lowest < 0 ? NMath.Round (lowest, MidpointRounding.AwayFromZero) : NMath.Round (lowest); var rangePadding = Settings.UomTemperature.IsImperial () ? scalePadding : (scalePadding / 2); scaleHigh += rangePadding; scaleLow -= rangePadding; scaleRange = scaleHigh - scaleLow; var scaleIncrement = scaleRange / dividerCount; scaleX = (graphRect.Width - inset) / (hourly ? HourlyTemps.Count : Forecasts.Count); scaleY = graphRect.Height / dividerCount; nfloat x, y; using (CGContext ctx = UIGraphics.GetCurrentContext ()) { // Draw x and y axis using (UIColor color = UIColor.White) { color.SetStroke (); ctx.SetLineWidth (1); using (CGPath p = new CGPath ()) { p.MoveToPoint (graphRect.GetMinX (), graphRect.GetMaxY ()); p.AddLines (new [] { new CGPoint (graphRect.GetMinX (), graphRect.GetMinY ()), new CGPoint (graphRect.GetMinX (), graphRect.GetMaxY ()), new CGPoint (graphRect.GetMaxX (), graphRect.GetMaxY ()) }); ctx.AddPath (p); ctx.DrawPath (CGPathDrawingMode.Stroke); } } // Draw horizontal gridlines using (UIColor color = UIColor.Black.ColorWithAlpha (0.08f)) { for (int i = 1; i < dividerCount; i += 2) { y = (i + 1) * scaleY; color.SetFill (); ctx.FillRect (new CGRect (graphRect.GetMinX (), graphRect.GetMaxY () - y, graphRect.Width, scaleY)); ctx.StrokePath (); } } drawLines (); // Draw y-axis labels nfloat yStep = scaleLow; ctx.SaveState (); ctx.TranslateCTM (0, rect.Height); ctx.ScaleCTM (1, -1); for (int i = 0; i <= dividerCount; i++) { y = padding + (i * scaleY); var step = NMath.Round (yStep).ToString (); drawLabel (ctx, rect, y, padding - 6, UITextAlignment.Right, step, false, true); yStep += scaleIncrement; } // Draw x-axis labels for (int i = 0; i < dayCount; i++) { x = padding + (i * xAxisScale); drawLabel (ctx, rect, padding - 6, x, UITextAlignment.Left, hourly ? days [i] : Forecasts [i]?.date?.weekday_short, false); } ctx.RestoreState (); } }
public override void Draw(CGRect frame) { this.BackgroundColor = "F5F5F5".ToUIColor(); var borderColor = UIColor.FromRGBA(0.808f, 0.808f, 0.808f, 1.000f); if (backgroundType == SearchCellBackgroundType.Header) { var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX() + 0.5f, frame.GetMinY() + 0.5f, frame.Width - 1.0f, frame.Height), UIRectCorner.TopLeft | UIRectCorner.TopRight, new SizeF(4.0f, 4.0f)); rectanglePath.ClosePath(); UIColor.White.SetFill(); rectanglePath.Fill(); borderColor.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); var rectangle2Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + 1.5f, frame.GetMinY() + NMath.Floor((frame.Height - 0.5f) * 0.76471f) + 0.5f, frame.Width - 3.0f, frame.Height - 1.0f - NMath.Floor((frame.Height - 0.5f) * 0.76471f))); UIColor.White.SetFill(); rectangle2Path.Fill(); UIColor.White.SetStroke(); rectangle2Path.LineWidth = 1.0f; rectangle2Path.Stroke(); } if (backgroundType == SearchCellBackgroundType.Default) { var rectanglePath = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + 0.5f, frame.GetMinY() + 0.5f, frame.Width - 1.0f, frame.Height)); UIColor.White.SetFill(); rectanglePath.Fill(); borderColor.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); var rectangle2Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + 1.5f, frame.GetMinY() + NMath.Floor((frame.Height - 0.5f) * 0.76471f) + 0.5f, frame.Width - 3.0f, frame.Height - 1.0f - NMath.Floor((frame.Height - 0.5f) * 0.76471f))); UIColor.White.SetFill(); rectangle2Path.Fill(); UIColor.White.SetStroke(); rectangle2Path.LineWidth = 1.0f; rectangle2Path.Stroke(); } if (backgroundType == SearchCellBackgroundType.Footer) { var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX() + 0.5f, frame.GetMinY() + 0.5f, frame.Width - 1.0f, frame.Height - 1.0f), UIRectCorner.BottomLeft | UIRectCorner.BottomRight, new SizeF(4.0f, 4.0f)); rectanglePath.ClosePath(); UIColor.White.SetFill(); rectanglePath.Fill(); borderColor.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); } if (backgroundType == SearchCellBackgroundType.Single) {//// Rectangle Drawing var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(frame.GetMinX() + 0.5f, frame.GetMinY() + 0.5f, frame.Width - 1.0f, frame.Height - 1.0f), 4.0f); UIColor.White.SetFill(); rectanglePath.Fill(); borderColor.SetStroke(); rectanglePath.LineWidth = 1.0f; rectanglePath.Stroke(); } }
void DrawControl(CGRect frame, string name, string country, string abv, string ibu, string srm) { BackgroundColor = UIColor.Clear; Layer.BackgroundColor = UIColor.Clear.CGColor; //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var fillColor = UIColor.FromRGBA(0.110f, 0.122f, 0.153f, 1.000f); var textForeground = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var fillColor2 = UIColor.FromRGBA(0.773f, 0.816f, 0.871f, 1.000f); var textForeground2 = UIColor.FromRGBA(0.773f, 0.816f, 0.871f, 1.000f); var fillColor3 = UIColor.FromRGBA(0.169f, 0.188f, 0.231f, 1.000f); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(frame.GetMinX() + 0.00145f * frame.Width, frame.GetMinY() + 0.04170f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.01299f * frame.Width, frame.GetMinY() + 0.00467f * frame.Height), new CGPoint(frame.GetMinX() + 0.00145f * frame.Width, frame.GetMinY() + 0.02125f * frame.Height), new CGPoint(frame.GetMinX() + 0.00664f * frame.Width, frame.GetMinY() + 0.00467f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.98701f * frame.Width, frame.GetMinY() + 0.00467f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.99855f * frame.Width, frame.GetMinY() + 0.04170f * frame.Height), new CGPoint(frame.GetMinX() + 0.99338f * frame.Width, frame.GetMinY() + 0.00467f * frame.Height), new CGPoint(frame.GetMinX() + 0.99855f * frame.Width, frame.GetMinY() + 0.02125f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.99855f * frame.Width, frame.GetMinY() + 0.95830f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.98701f * frame.Width, frame.GetMinY() + 0.99533f * frame.Height), new CGPoint(frame.GetMinX() + 0.99855f * frame.Width, frame.GetMinY() + 0.97875f * frame.Height), new CGPoint(frame.GetMinX() + 0.99336f * frame.Width, frame.GetMinY() + 0.99533f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.01299f * frame.Width, frame.GetMinY() + 0.99533f * frame.Height)); bezierPath.AddCurveToPoint(new CGPoint(frame.GetMinX() + 0.00145f * frame.Width, frame.GetMinY() + 0.95830f * frame.Height), new CGPoint(frame.GetMinX() + 0.00662f * frame.Width, frame.GetMinY() + 0.99533f * frame.Height), new CGPoint(frame.GetMinX() + 0.00145f * frame.Width, frame.GetMinY() + 0.97875f * frame.Height)); bezierPath.AddLineTo(new CGPoint(frame.GetMinX() + 0.00145f * frame.Width, frame.GetMinY() + 0.04170f * frame.Height)); bezierPath.ClosePath(); bezierPath.LineJoinStyle = CGLineJoin.Round; bezierPath.UsesEvenOddFillRule = true; fillColor.SetFill(); bezierPath.Fill(); fillColor3.SetStroke(); bezierPath.LineWidth = 0.5f; bezierPath.Stroke(); //// lblName Drawing CGRect lblNameRect = new CGRect(frame.GetMinX() + 13.25f, frame.GetMinY() + 9.45f, frame.Width - 23.25f, NMath.Floor((frame.Height - 9.45f) * 0.31777f + 9.39f) - 8.89f); textForeground.SetFill(); var lblNameStyle = new NSMutableParagraphStyle(); lblNameStyle.Alignment = UITextAlignment.Left; var lblNameFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 18.0f), ForegroundColor = textForeground, ParagraphStyle = lblNameStyle }; var lblNameTextHeight = new NSString(name).GetBoundingRect(new CGSize(lblNameRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, lblNameFontAttributes, null).Height; context.SaveState(); context.ClipToRect(lblNameRect); new NSString(name).DrawString(new CGRect(lblNameRect.GetMinX(), lblNameRect.GetMinY() + (lblNameRect.Height - lblNameTextHeight) / 2.0f, lblNameRect.Width, lblNameTextHeight), UIFont.FromName("Avenir-Heavy", 18.0f), UILineBreakMode.WordWrap, UITextAlignment.Left); context.RestoreState(); //// Bezier 2 Drawing UIBezierPath bezier2Path = new UIBezierPath(); bezier2Path.MoveTo(new CGPoint(frame.GetMinX() + 18.25f, frame.GetMinY() + 39.0f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 15.0f, frame.GetMinY() + 42.08f), new CGPoint(frame.GetMinX() + 16.46f, frame.GetMinY() + 39.0f), new CGPoint(frame.GetMinX() + 15.0f, frame.GetMinY() + 40.38f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 18.26f, frame.GetMinY() + 46.96f), new CGPoint(frame.GetMinX() + 15.0f, frame.GetMinY() + 44.42f), new CGPoint(frame.GetMinX() + 17.63f, frame.GetMinY() + 46.96f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 21.5f, frame.GetMinY() + 42.08f), new CGPoint(frame.GetMinX() + 18.89f, frame.GetMinY() + 46.96f), new CGPoint(frame.GetMinX() + 21.5f, frame.GetMinY() + 44.42f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 18.25f, frame.GetMinY() + 39.0f), new CGPoint(frame.GetMinX() + 21.5f, frame.GetMinY() + 40.38f), new CGPoint(frame.GetMinX() + 20.05f, frame.GetMinY() + 39.0f)); bezier2Path.ClosePath(); bezier2Path.MoveTo(new CGPoint(frame.GetMinX() + 18.25f, frame.GetMinY() + 43.98f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 20.0f, frame.GetMinY() + 42.23f), new CGPoint(frame.GetMinX() + 19.22f, frame.GetMinY() + 43.98f), new CGPoint(frame.GetMinX() + 20.0f, frame.GetMinY() + 43.2f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 18.25f, frame.GetMinY() + 40.49f), new CGPoint(frame.GetMinX() + 20.0f, frame.GetMinY() + 41.27f), new CGPoint(frame.GetMinX() + 19.22f, frame.GetMinY() + 40.49f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 16.5f, frame.GetMinY() + 42.23f), new CGPoint(frame.GetMinX() + 17.28f, frame.GetMinY() + 40.49f), new CGPoint(frame.GetMinX() + 16.5f, frame.GetMinY() + 41.27f)); bezier2Path.AddCurveToPoint(new CGPoint(frame.GetMinX() + 18.25f, frame.GetMinY() + 43.98f), new CGPoint(frame.GetMinX() + 16.5f, frame.GetMinY() + 43.2f), new CGPoint(frame.GetMinX() + 17.28f, frame.GetMinY() + 43.98f)); bezier2Path.ClosePath(); bezier2Path.UsesEvenOddFillRule = true; fillColor2.SetFill(); bezier2Path.Fill(); //// lblCountry Drawing CGRect lblCountryRect = new CGRect(frame.GetMinX() + 24.0f, frame.GetMinY() + 31.0f, frame.Width - 34.0f, NMath.Floor((frame.Height - 31.0f) * 0.30263f + 0.5f)); textForeground2.SetFill(); var lblCountryStyle = new NSMutableParagraphStyle(); lblCountryStyle.Alignment = UITextAlignment.Left; var lblCountryFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Medium", 13.0f), ForegroundColor = textForeground2, ParagraphStyle = lblCountryStyle }; var lblCountryTextHeight = new NSString(country).GetBoundingRect(new CGSize(lblCountryRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, lblCountryFontAttributes, null).Height; context.SaveState(); context.ClipToRect(lblCountryRect); new NSString(country).DrawString(new CGRect(lblCountryRect.GetMinX(), lblCountryRect.GetMinY() + (lblCountryRect.Height - lblCountryTextHeight) / 2.0f, lblCountryRect.Width, lblCountryTextHeight), UIFont.FromName("Avenir-Medium", 13.0f), UILineBreakMode.WordWrap, UITextAlignment.Left); context.RestoreState(); //// Rectangle 3 Drawing var rectangle3Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX(), frame.GetMinY() + NMath.Floor((frame.Height - 40.0f) * 0.98507f + 0.5f), frame.Width, frame.Height - 40.0f - NMath.Floor((frame.Height - 40.0f) * 0.98507f + 0.5f))); fillColor3.SetFill(); rectangle3Path.Fill(); //// Rectangle 4 Drawing var rectangle4Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + 114.3f, frame.GetMinY() + NMath.Floor((frame.Height) * 0.62804f + 0.5f), NMath.Floor((frame.Width - 114.3f) * 0.00433f + 0.5f), frame.Height - NMath.Floor((frame.Height) * 0.62804f + 0.5f))); fillColor3.SetFill(); rectangle4Path.Fill(); //// Rectangle 5 Drawing var rectangle5Path = UIBezierPath.FromRect(new CGRect(frame.GetMinX() + NMath.Floor((frame.Width - 114.25f) * 0.99567f - 0.25f) + 0.75f, frame.GetMinY() + NMath.Floor((frame.Height) * 0.62804f + 0.5f), frame.Width - 115.0f - NMath.Floor((frame.Width - 114.25f) * 0.99567f - 0.25f), frame.Height - NMath.Floor((frame.Height) * 0.62804f + 0.5f))); fillColor3.SetFill(); rectangle5Path.Fill(); //// lblAbv Drawing CGRect lblAbvRect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * -0.00000f - 0.5f) + 1.0f, frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, NMath.Floor(frame.Width * 0.16812f - 0.5f) - NMath.Floor(frame.Width * -0.00000f - 0.5f), frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); textForeground2.SetFill(); var lblAbvStyle = new NSMutableParagraphStyle(); lblAbvStyle.Alignment = UITextAlignment.Right; var lblAbvFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground2, ParagraphStyle = lblAbvStyle }; var lblAbvTextHeight = new NSString(abv).GetBoundingRect(new CGSize(lblAbvRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, lblAbvFontAttributes, null).Height; context.SaveState(); context.ClipToRect(lblAbvRect); new NSString(abv).DrawString(new CGRect(lblAbvRect.GetMinX(), lblAbvRect.GetMinY() + (lblAbvRect.Height - lblAbvTextHeight) / 2.0f, lblAbvRect.Width, lblAbvTextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Right); context.RestoreState(); //// Label 4 Drawing CGRect label4Rect = new CGRect(frame.GetMinX() + NMath.Floor((frame.Width - 231.0f) * 0.52961f + 0.12f) + 0.38f, frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, frame.Width - 231.38f - NMath.Floor((frame.Width - 231.0f) * 0.52961f + 0.12f), frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); { var textContent = "ABV"; textForeground.SetFill(); var label4Style = new NSMutableParagraphStyle(); label4Style.Alignment = UITextAlignment.Left; var label4FontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground, ParagraphStyle = label4Style }; var label4TextHeight = new NSString(textContent).GetBoundingRect(new CGSize(label4Rect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, label4FontAttributes, null).Height; context.SaveState(); context.ClipToRect(label4Rect); new NSString(textContent).DrawString(new CGRect(label4Rect.GetMinX(), label4Rect.GetMinY() + (label4Rect.Height - label4TextHeight) / 2.0f, label4Rect.Width, label4TextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Left); context.RestoreState(); } //// lblIbu Drawing CGRect lblIbuRect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.33623f + 0.5f), frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, NMath.Floor(frame.Width * 0.49855f + 0.5f) - NMath.Floor(frame.Width * 0.33623f + 0.5f), frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); textForeground2.SetFill(); var lblIbuStyle = new NSMutableParagraphStyle(); lblIbuStyle.Alignment = UITextAlignment.Right; var lblIbuFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground2, ParagraphStyle = lblIbuStyle }; var lblIbuTextHeight = new NSString(ibu).GetBoundingRect(new CGSize(lblIbuRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, lblIbuFontAttributes, null).Height; context.SaveState(); context.ClipToRect(lblIbuRect); new NSString(ibu).DrawString(new CGRect(lblIbuRect.GetMinX(), lblIbuRect.GetMinY() + (lblIbuRect.Height - lblIbuTextHeight) / 2.0f, lblIbuRect.Width, lblIbuTextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Right); context.RestoreState(); //// Label 6 Drawing CGRect label6Rect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.50435f + 0.5f), frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, NMath.Floor(frame.Width * 0.66667f + 0.5f) - NMath.Floor(frame.Width * 0.50435f + 0.5f), frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); { var textContent = "IBU"; textForeground.SetFill(); var label6Style = new NSMutableParagraphStyle(); label6Style.Alignment = UITextAlignment.Left; var label6FontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground, ParagraphStyle = label6Style }; var label6TextHeight = new NSString(textContent).GetBoundingRect(new CGSize(label6Rect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, label6FontAttributes, null).Height; context.SaveState(); context.ClipToRect(label6Rect); new NSString(textContent).DrawString(new CGRect(label6Rect.GetMinX(), label6Rect.GetMinY() + (label6Rect.Height - label6TextHeight) / 2.0f, label6Rect.Width, label6TextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Left); context.RestoreState(); } //// lblSrm Drawing CGRect lblSrmRect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.66957f + 0.5f), frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, NMath.Floor(frame.Width * 0.83478f + 0.5f) - NMath.Floor(frame.Width * 0.66957f + 0.5f), frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); textForeground2.SetFill(); var lblSrmStyle = new NSMutableParagraphStyle(); lblSrmStyle.Alignment = UITextAlignment.Right; var lblSrmFontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground2, ParagraphStyle = lblSrmStyle }; var lblSrmTextHeight = new NSString(srm).GetBoundingRect(new CGSize(lblSrmRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, lblSrmFontAttributes, null).Height; context.SaveState(); context.ClipToRect(lblSrmRect); new NSString(srm).DrawString(new CGRect(lblSrmRect.GetMinX(), lblSrmRect.GetMinY() + (lblSrmRect.Height - lblSrmTextHeight) / 2.0f, lblSrmRect.Width, lblSrmTextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Right); context.RestoreState(); //// Label 8 Drawing CGRect label8Rect = new CGRect(frame.GetMinX() + NMath.Floor(frame.Width * 0.83460f - 0.44f) + 0.94f, frame.GetMinY() + NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f) + 0.81f, NMath.Floor(frame.Width * 1.00000f - 0.5f) - NMath.Floor(frame.Width * 0.83460f - 0.44f) + 0.06f, frame.Height - 12.63f - NMath.Floor((frame.Height - 11.81f) * 0.78989f - 0.31f)); { var textContent = "SRM"; textForeground.SetFill(); var label8Style = new NSMutableParagraphStyle(); label8Style.Alignment = UITextAlignment.Left; var label8FontAttributes = new UIStringAttributes() { Font = UIFont.FromName("Avenir-Heavy", 12.0f), ForegroundColor = textForeground, ParagraphStyle = label8Style }; var label8TextHeight = new NSString(textContent).GetBoundingRect(new CGSize(label8Rect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, label8FontAttributes, null).Height; context.SaveState(); context.ClipToRect(label8Rect); new NSString(textContent).DrawString(new CGRect(label8Rect.GetMinX(), label8Rect.GetMinY() + (label8Rect.Height - label8TextHeight) / 2.0f, label8Rect.Width, label8TextHeight), UIFont.FromName("Avenir-Heavy", 12.0f), UILineBreakMode.WordWrap, UITextAlignment.Left); context.RestoreState(); } }
public void DisplayPixelBuffer (CVPixelBuffer pixelBuffer) { DrawTextInCorner (pixelBuffer); CVReturn error; if (pixelBuffer != null) { int frameWidth = (int)pixelBuffer.Width; int frameHeight = (int)pixelBuffer.Height; if (videoTextureCache == null) { Console.WriteLine ("No video texture cache"); return; } CleanUpTextures (); CVAttachmentMode attachmentMode; var colorAttachments = pixelBuffer.GetAttachment <NSString> (CVImageBuffer.YCbCrMatrixKey, out attachmentMode); if (colorAttachments == CVImageBuffer.YCbCrMatrix_ITU_R_601_4) preferredConversion = colorConversion601; else preferredConversion = colorConversion709; GL.ActiveTexture (TextureUnit.Texture0); lumaTexture = videoTextureCache.TextureFromImage (pixelBuffer, true, All.RedExt, frameWidth, frameHeight, All.RedExt, DataType.UnsignedByte, 0, out error); if (lumaTexture == null) Console.WriteLine ("Error at CVOpenGLESTextureCach.TextureFromImage"); GL.BindTexture (lumaTexture.Target, lumaTexture.Name); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge); GL.ActiveTexture (TextureUnit.Texture1); chromaTexture = videoTextureCache.TextureFromImage (pixelBuffer, true, All.RgExt, frameWidth / 2, frameHeight / 2, All.RgExt, DataType.UnsignedByte, 1, out error); if (chromaTexture == null) Console.WriteLine ("Error at CVOpenGLESTextureCach.TextureFromImage"); GL.BindTexture (chromaTexture.Target, chromaTexture.Name); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge); GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge); GL.BindFramebuffer (FramebufferTarget.Framebuffer, frameBufferHandle); GL.Viewport (0, 0, backingWidth, backingHeight); } GL.ClearColor (0f, 0f, 0f, 1f); GL.Clear (ClearBufferMask.ColorBufferBit); GL.UseProgram (Program); GL.Uniform1 (uniforms [(int)UniformIndex.RotationAngle], 0f); GL.UniformMatrix3 (uniforms [(int)UniformIndex.ColorConversionMatrix], 1, false, preferredConversion); CGRect vertexSamplingRect = AVUtilities.WithAspectRatio (Bounds, PresentationRect); var normalizedSamplingSize = new CGSize (0f, 0f); var cropScaleAmount = new CGSize (vertexSamplingRect.Width / Bounds.Width, vertexSamplingRect.Height / Bounds.Height); if (cropScaleAmount.Width > cropScaleAmount.Height) { normalizedSamplingSize.Width = 1f; normalizedSamplingSize.Height = cropScaleAmount.Height / cropScaleAmount.Width; } else { normalizedSamplingSize.Width = 1f; normalizedSamplingSize.Height = cropScaleAmount.Width / cropScaleAmount.Height; } float[] quadVertexData = { -1f * (float)normalizedSamplingSize.Width, -1f * (float)normalizedSamplingSize.Height, (float)normalizedSamplingSize.Width, -1f * (float)normalizedSamplingSize.Height, -1f * (float)normalizedSamplingSize.Width, (float)normalizedSamplingSize.Height, (float)normalizedSamplingSize.Width, (float)normalizedSamplingSize.Height, }; GL.VertexAttribPointer ((int)AttributeIndex.Vertex, 2, VertexAttribPointerType.Float, false, 0, quadVertexData); GL.EnableVertexAttribArray ((int)AttributeIndex.Vertex); var textureSamplingRect = new CGRect (0, 0, 1, 1); float[] quadTextureData = { (float)textureSamplingRect.GetMinX (), (float)textureSamplingRect.GetMaxY (), (float)textureSamplingRect.GetMaxX (), (float)textureSamplingRect.GetMaxY (), (float)textureSamplingRect.GetMinX (), (float)textureSamplingRect.GetMinY (), (float)textureSamplingRect.GetMaxX (), (float)textureSamplingRect.GetMinY () }; GL.VertexAttribPointer ((int)AttributeIndex.TextureCoordinates, 2, VertexAttribPointerType.Float, false, 0, quadTextureData); GL.EnableVertexAttribArray ((int)AttributeIndex.TextureCoordinates); GL.DrawArrays (BeginMode.TriangleStrip, 0, 4); GL.BindRenderbuffer (RenderbufferTarget.Renderbuffer, colorBufferHandle); context.PresentRenderBuffer ((int)RenderbufferTarget.Renderbuffer); }
void DrawCanvas(CGRect frame2) { //// General Declarations var context = UIGraphics.GetCurrentContext(); //// Color Declarations var fillColor = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f); var strokeColor = UIColor.FromRGBA(0.807f, 0.807f, 0.807f, 1.000f); var strokeColor2 = UIColor.FromRGBA(0.851f, 0.851f, 0.851f, 1.000f); //// Frames CGRect frame = new CGRect(1.0f, 0.0f, 771.0f, 356.0f); //// Subframes CGRect group3 = new CGRect(frame.GetMinX(), frame.GetMinY(), frame.Width, frame.Height); CGRect group5 = new CGRect(frame.GetMinX() + 3.0f, frame.GetMinY() + 3.0f, frame.Width - 7.0f, frame.Height - 7.0f); //// Group 2 { //// Group 3 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 2 UIBezierPath clip2Path = new UIBezierPath(); clip2Path.MoveTo(new CGPoint(group3.GetMinX() + 0.00130f * group3.Width, group3.GetMinY() + 0.00000f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 1.00130f * group3.Width, group3.GetMinY() + 0.00000f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 1.00130f * group3.Width, group3.GetMinY() + 1.00000f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.00130f * group3.Width, group3.GetMinY() + 1.00000f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.00130f * group3.Width, group3.GetMinY() + 0.00000f * group3.Height)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(group3.GetMinX() + 0.02853f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.03307f * group3.Width, group3.GetMinY() + 0.05915f * group3.Height), new CGPoint(group3.GetMinX() + 0.02853f * group3.Width, group3.GetMinY() + 0.06356f * group3.Height), new CGPoint(group3.GetMinX() + 0.03056f * group3.Width, group3.GetMinY() + 0.05915f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.96953f * group3.Width, group3.GetMinY() + 0.05915f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.97406f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height), new CGPoint(group3.GetMinX() + 0.97203f * group3.Width, group3.GetMinY() + 0.05915f * group3.Height), new CGPoint(group3.GetMinX() + 0.97406f * group3.Width, group3.GetMinY() + 0.06356f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.97406f * group3.Width, group3.GetMinY() + 0.93099f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.96953f * group3.Width, group3.GetMinY() + 0.94085f * group3.Height), new CGPoint(group3.GetMinX() + 0.97406f * group3.Width, group3.GetMinY() + 0.93644f * group3.Height), new CGPoint(group3.GetMinX() + 0.97204f * group3.Width, group3.GetMinY() + 0.94085f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.03307f * group3.Width, group3.GetMinY() + 0.94085f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.02853f * group3.Width, group3.GetMinY() + 0.93099f * group3.Height), new CGPoint(group3.GetMinX() + 0.03056f * group3.Width, group3.GetMinY() + 0.94085f * group3.Height), new CGPoint(group3.GetMinX() + 0.02853f * group3.Width, group3.GetMinY() + 0.93644f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.02853f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height)); clip2Path.ClosePath(); clip2Path.MoveTo(new CGPoint(group3.GetMinX() + 0.02724f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.02724f * group3.Width, group3.GetMinY() + 0.93099f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.03307f * group3.Width, group3.GetMinY() + 0.94366f * group3.Height), new CGPoint(group3.GetMinX() + 0.02724f * group3.Width, group3.GetMinY() + 0.93800f * group3.Height), new CGPoint(group3.GetMinX() + 0.02984f * group3.Width, group3.GetMinY() + 0.94366f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.96953f * group3.Width, group3.GetMinY() + 0.94366f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.97536f * group3.Width, group3.GetMinY() + 0.93099f * group3.Height), new CGPoint(group3.GetMinX() + 0.97275f * group3.Width, group3.GetMinY() + 0.94366f * group3.Height), new CGPoint(group3.GetMinX() + 0.97536f * group3.Width, group3.GetMinY() + 0.93799f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.97536f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.96953f * group3.Width, group3.GetMinY() + 0.05634f * group3.Height), new CGPoint(group3.GetMinX() + 0.97536f * group3.Width, group3.GetMinY() + 0.06200f * group3.Height), new CGPoint(group3.GetMinX() + 0.97275f * group3.Width, group3.GetMinY() + 0.05634f * group3.Height)); clip2Path.AddLineTo(new CGPoint(group3.GetMinX() + 0.03307f * group3.Width, group3.GetMinY() + 0.05634f * group3.Height)); clip2Path.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.02724f * group3.Width, group3.GetMinY() + 0.06901f * group3.Height), new CGPoint(group3.GetMinX() + 0.02984f * group3.Width, group3.GetMinY() + 0.05634f * group3.Height), new CGPoint(group3.GetMinX() + 0.02724f * group3.Width, group3.GetMinY() + 0.06201f * group3.Height)); clip2Path.ClosePath(); clip2Path.UsesEvenOddFillRule = true; clip2Path.AddClip(); //// Group 4 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip UIBezierPath clipPath = new UIBezierPath(); clipPath.MoveTo(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height)); clipPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.00583f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height), new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + -0.00198f * group3.Height), new CGPoint(group3.GetMinX() + 0.00296f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height)); clipPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.94229f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height)); clipPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height), new CGPoint(group3.GetMinX() + 0.94515f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height), new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + -0.00199f * group3.Height)); clipPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.86654f * group3.Height)); clipPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.94229f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height), new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.87276f * group3.Height), new CGPoint(group3.GetMinX() + 0.94516f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height)); clipPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.00583f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height)); clipPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.86654f * group3.Height), new CGPoint(group3.GetMinX() + 0.00297f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height), new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.87278f * group3.Height)); clipPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height)); clipPath.ClosePath(); clipPath.UsesEvenOddFillRule = true; clipPath.AddClip(); //// Bezier Drawing UIBezierPath bezierPath = new UIBezierPath(); bezierPath.MoveTo(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height)); bezierPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.00583f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height), new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + -0.00198f * group3.Height), new CGPoint(group3.GetMinX() + 0.00296f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height)); bezierPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.94229f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height)); bezierPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height), new CGPoint(group3.GetMinX() + 0.94515f * group3.Width, group3.GetMinY() + -0.00702f * group3.Height), new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + -0.00199f * group3.Height)); bezierPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.86654f * group3.Height)); bezierPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.94229f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height), new CGPoint(group3.GetMinX() + 0.94747f * group3.Width, group3.GetMinY() + 0.87276f * group3.Height), new CGPoint(group3.GetMinX() + 0.94516f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height)); bezierPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.00583f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height)); bezierPath.AddCurveToPoint(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.86654f * group3.Height), new CGPoint(group3.GetMinX() + 0.00297f * group3.Width, group3.GetMinY() + 0.87781f * group3.Height), new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.87278f * group3.Height)); bezierPath.AddLineTo(new CGPoint(group3.GetMinX() + 0.00065f * group3.Width, group3.GetMinY() + 0.00425f * group3.Height)); bezierPath.ClosePath(); fillColor.SetFill(); bezierPath.Fill(); context.EndTransparencyLayer(); context.RestoreState(); } context.EndTransparencyLayer(); context.RestoreState(); } //// Group 5 { context.SaveState(); context.BeginTransparencyLayer(); //// Clip Clip 3 UIBezierPath clip3Path = new UIBezierPath(); clip3Path.MoveTo(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height)); clip3Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.00678f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height), new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.00570f * group5.Height), new CGPoint(group5.GetMinX() + 0.00375f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height)); clip3Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.99584f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height)); clip3Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height), new CGPoint(group5.GetMinX() + 0.99886f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height), new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.00569f * group5.Height)); clip3Path.AddLineTo(new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.98727f * group5.Height)); clip3Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.99584f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height), new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.99430f * group5.Height), new CGPoint(group5.GetMinX() + 0.99887f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height)); clip3Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.00678f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height)); clip3Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.98727f * group5.Height), new CGPoint(group5.GetMinX() + 0.00376f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height), new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.99431f * group5.Height)); clip3Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height)); clip3Path.ClosePath(); clip3Path.UsesEvenOddFillRule = true; clip3Path.AddClip(); //// Bezier 4 Drawing UIBezierPath bezier4Path = new UIBezierPath(); bezier4Path.MoveTo(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height)); bezier4Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.00678f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height), new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.00570f * group5.Height), new CGPoint(group5.GetMinX() + 0.00375f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height)); bezier4Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.99584f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height)); bezier4Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height), new CGPoint(group5.GetMinX() + 0.99886f * group5.Width, group5.GetMinY() + 0.00000f * group5.Height), new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.00569f * group5.Height)); bezier4Path.AddLineTo(new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.98727f * group5.Height)); bezier4Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.99584f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height), new CGPoint(group5.GetMinX() + 1.00131f * group5.Width, group5.GetMinY() + 0.99430f * group5.Height), new CGPoint(group5.GetMinX() + 0.99887f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height)); bezier4Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.00678f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height)); bezier4Path.AddCurveToPoint(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.98727f * group5.Height), new CGPoint(group5.GetMinX() + 0.00376f * group5.Width, group5.GetMinY() + 1.00000f * group5.Height), new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.99431f * group5.Height)); bezier4Path.AddLineTo(new CGPoint(group5.GetMinX() + 0.00131f * group5.Width, group5.GetMinY() + 0.01273f * group5.Height)); bezier4Path.ClosePath(); strokeColor2.SetStroke(); bezier4Path.LineWidth = 2.0f; bezier4Path.Stroke(); context.EndTransparencyLayer(); context.RestoreState(); } //// Bezier 6 Drawing UIBezierPath bezier6Path = new UIBezierPath(); bezier6Path.MoveTo(new CGPoint(frame.GetMinX() + 0.04789f * frame.Width, frame.GetMinY() + 0.43141f * frame.Height)); bezier6Path.AddLineTo(new CGPoint(frame.GetMinX() + 0.90281f * frame.Width, frame.GetMinY() + 0.43141f * frame.Height)); bezier6Path.LineCapStyle = CGLineCap.Square; strokeColor.SetStroke(); bezier6Path.LineWidth = 1.0f; bezier6Path.Stroke(); } }
static Rects ComputeDifferenceBetweenRect (CGRect oldRect, CGRect newRect) { if (!oldRect.IntersectsWith (newRect)) { return new Rects { Added = new CGRect [] { newRect }, Removed = new CGRect [] { oldRect } }; } var oldMaxY = oldRect.GetMaxY (); var oldMinY = oldRect.GetMinY (); var newMaxY = newRect.GetMaxY (); var newMinY = newRect.GetMinY (); var added = new List<CGRect> (); var removed = new List<CGRect> (); if (newMaxY > oldMaxY) added.Add (new CGRect (newRect.X, oldMaxY, newRect.Width, newMaxY - oldMaxY)); if (oldMinY > newMinY) added.Add (new CGRect (newRect.X, newMinY, newRect.Width, oldMinY - newMinY)); if (newMaxY < oldMaxY) removed.Add (new CGRect (newRect.X, newMaxY, newRect.Width, oldMaxY - newMaxY)); if (oldMinY < newMinY) removed.Add (new CGRect (newRect.X, oldMinY, newRect.Width, newMinY - oldMinY)); return new Rects { Added = added, Removed = removed }; }