Exemplo n.º 1
0
        //// 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();
        }
Exemplo n.º 2
0
        void HideMenuLayerAnimation(NSString timingFunctionName = null)
        {
            CGRect f               = _shadowLayer.Frame;
            var    group           = new CAAnimationGroup();
            var    animationOffset = new CABasicAnimation();

            animationOffset.KeyPath = new NSString("position");
            animationOffset.From    = NSValue.FromCGPoint(new CGPoint(f.GetMidX(), f.GetMidY()));
            animationOffset.To      = NSValue.FromCGPoint(new CGPoint(f.GetMidX() - UIScreen.MainScreen.Bounds.Width * _targetViewControllerOffset, f.GetMidY()));

            var animationScaleX = new CABasicAnimation();

            animationScaleX.KeyPath = new NSString("transform.scale.x");
            animationScaleX.From    = NSValue.FromObject(0.8f);
            animationScaleX.To      = NSValue.FromObject(1.0f);

            var animationScaleY = new CABasicAnimation();

            animationScaleY.KeyPath = new NSString("transform.scale.y");
            animationScaleY.From    = NSValue.FromObject(0.8f);
            animationScaleY.To      = NSValue.FromObject(1.0f);

            //during pan gesture animation curve should be linear
            //In other cases EaseInOut
            group.TimingFunction = CAMediaTimingFunction.FromName(timingFunctionName ?? CAMediaTimingFunction.EaseInEaseOut);
            group.Duration       = TransitionDurationTime;
            group.Animations     = new[] { animationOffset, animationScaleX, animationScaleY };

            _shadowLayer.AddAnimation(group, "HideShadowLayerAnimation");
        }
        //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();
        }
Exemplo n.º 4
0
        //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();
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
            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);
            }
        private static CGPath GetRoundedPath(CornerRadius cornerRadius, CGRect area, CGPath path = null)
        {
            path ??= new CGPath();
            // How AddArcToPoint works:
            // http://www.twistedape.me.uk/blog/2013/09/23/what-arctopointdoes/
            path.MoveToPoint(area.GetMidX(), area.Y);
            path.AddArcToPoint(area.Right, area.Top, area.Right, area.GetMidY(), (float)cornerRadius.TopRight);
            path.AddArcToPoint(area.Right, area.Bottom, area.GetMidX(), area.Bottom, (float)cornerRadius.BottomRight);
            path.AddArcToPoint(area.Left, area.Bottom, area.Left, area.GetMidY(), (float)cornerRadius.BottomLeft);
            path.AddArcToPoint(area.Left, area.Top, area.GetMidX(), area.Top, (float)cornerRadius.TopLeft);
            path.AddLineToPoint(area.GetMidX(), area.Y);

            return(path);
        }
        private UIBezierPath PathForRect(CGRect rect, nfloat arrowOffset)
        {
            if (rect == CGRect.Empty)
            {
                return(null);
            }
            rect = new CGRect(CGPoint.Empty, rect.Size);              // ensure origin is CGPointZero

            // Create rounded rect
            CGRect roundedRect = rect;
            var    size        = roundedRect.Size;

            size.Height     -= ArrowLength;
            roundedRect.Size = size;
            var popUpPath = UIBezierPath.FromRoundedRect(roundedRect, cornerRadius);

            // Create arrow path
            nfloat  maxX      = roundedRect.GetMaxX();        // prevent arrow from extending beyond this point
            nfloat  arrowTipX = rect.GetMidX() + arrowOffset;
            CGPoint tip       = new CGPoint(arrowTipX, rect.GetMaxY());

            nfloat arrowLength = roundedRect.Height / 2.0f;
            nfloat x           = arrowLength * NMath.Tan(45.0f * NMath.PI / 180);    // x = half the length of the base of the arrow

            var arrowPath = new UIBezierPath();

            arrowPath.MoveTo(tip);
            arrowPath.AddLineTo(new CGPoint(NMath.Max(arrowTipX - x, 0), roundedRect.GetMaxY() - arrowLength));
            arrowPath.AddLineTo(new CGPoint(NMath.Min(arrowTipX + x, maxX), roundedRect.GetMaxY() - arrowLength));
            arrowPath.ClosePath();

            popUpPath.AppendPath(arrowPath);

            return(popUpPath);
        }
Exemplo n.º 9
0
        public override void DrawInContext(CGContext ctx)
        {
            UIGraphics.PushContext(ctx);
            CGRect         bounds = this.Bounds;
            TKFill         fill   = this.LabelStyle.Fill;
            TKStroke       stroke = new TKStroke(UIColor.Black);
            TKBalloonShape shape  = new TKBalloonShape(TKBalloonShapeArrowPosition.Bottom, new CGSize(bounds.Size.Width - stroke.Width, bounds.Size.Height - stroke.Width));
            CGRect         textRect;

            if (this.IsOutsideBounds == true)
            {
                shape.ArrowPosition = TKBalloonShapeArrowPosition.Top;
                textRect            = new CGRect(bounds.Left, bounds.Top - this.LabelStyle.Insets.Top + shape.ArrowSize.Height, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
            }
            else
            {
                textRect = new CGRect(bounds.Left, bounds.Top - this.LabelStyle.Insets.Top, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
            }

            shape.DrawInContext(ctx, new CGPoint(bounds.GetMidX(), bounds.GetMidY()), new TKDrawing[] { fill, stroke });
            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.Alignment = this.LabelStyle.TextAlignment;
            NSDictionary attributes = new NSDictionary(UIStringAttributeKey.Font, UIFont.SystemFontOfSize(18),
                                                       UIStringAttributeKey.ForegroundColor, this.LabelStyle.TextColor,
                                                       UIStringAttributeKey.ParagraphStyle, paragraphStyle);

            NSString text = new NSString(this.Text);

            text.WeakDrawString(textRect, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, null);
            UIGraphics.PopContext();
        }
        public override UICollectionViewLayoutAttributes[] LayoutAttributesForElementsInRect(CGRect rect)
        {
            var array = base.LayoutAttributesForElementsInRect(rect);

            if (array != null && CollectionView != null)
            {
                var visibleRect    = new CGRect(CollectionView.ContentOffset, CollectionView.Bounds.Size);
                var attributesCopy = new List <UICollectionViewLayoutAttributes>();

                foreach (var itemAttributes in array)
                {
                    var itemAttributesCopy = itemAttributes.Copy() as UICollectionViewLayoutAttributes;
                    var distance           = visibleRect.GetMidX() - itemAttributesCopy.Center.X;
                    var normalizeDistance  = distance <= ActiveDistance / 2 ? distance / ActiveDistance : 0.5f;

                    if (Math.Abs(distance) < ActiveDistance / 2)
                    {
                        itemAttributesCopy.Alpha     = 1.0f - (nfloat)Math.Abs(normalizeDistance);
                        itemAttributesCopy.Transform = CGAffineTransform.MakeScale(1.5f - (nfloat)Math.Abs(normalizeDistance),
                                                                                   1.5f - (nfloat)Math.Abs(normalizeDistance));
                    }
                    else
                    {
                        itemAttributesCopy.Alpha     = 0.5f;
                        itemAttributesCopy.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f);
                    }
                    attributesCopy.Add(itemAttributesCopy);
                }

                return(attributesCopy.ToArray());
            }

            return(null);
        }
        private CGRect CreateRect(CGRect origin, CGSize size)
        {
            var center = new CGPoint(origin.GetMidX(), origin.GetMidY());
            var rect   = new CGRect(center.X - size.Width / 2, center.Y - size.Height / 2, size.Width, size.Height);

            return(rect);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        public override UICollectionViewLayoutAttributes[] LayoutAttributesForElementsInRect(CGRect rect)
        {
            var array       = base.LayoutAttributesForElementsInRect(rect);
            var visibleRect = new CGRect(CollectionView.ContentOffset, CollectionView.Bounds.Size);

            int collectionViewCount = (int)this.CollectionView.NumberOfItemsInSection(0);

            foreach (var attributes in array)
            {
                if (collectionViewCount == 1)
                {
                    float zoom = 1 + ZOOM_FACTOR;
                    attributes.Transform3D = CATransform3D.MakeScale(zoom, zoom, 1.0f);
                    attributes.ZIndex      = 1;
                }
                if (attributes.Frame.IntersectsWith(rect) && (collectionViewCount != 2 && collectionViewCount != 3))
                {
                    float distance           = (float)(visibleRect.GetMidX() - attributes.Center.X);
                    float normalizedDistance = distance / ACTIVE_DISTANCE;
                    if (Math.Abs(distance) < ACTIVE_DISTANCE)
                    {
                        float zoom = 1 + ZOOM_FACTOR * (1 - Math.Abs(normalizedDistance));
                        attributes.Transform3D = CATransform3D.MakeScale(zoom, zoom, 1.0f);
                        attributes.ZIndex      = 1;
                    }
                }
            }
            return(array);
        }
Exemplo n.º 14
0
        public override void PlatformArrange(Rect rect)
        {
            base.PlatformArrange(rect);

            // Ensure that the content container for the ScrollView gets arranged, and is large enough
            // to contain the ScrollView's content

            var contentView = GetContentView(PlatformView);

            if (contentView == null)
            {
                return;
            }

            var desiredSize        = VirtualView.PresentedContent?.DesiredSize ?? Size.Zero;
            var scrollViewPadding  = VirtualView.Padding;
            var platformViewBounds = PlatformView.Bounds;

            var contentBounds = new CGRect(0, 0,
                                           Math.Max(desiredSize.Width + scrollViewPadding.HorizontalThickness, platformViewBounds.Width),
                                           Math.Max(desiredSize.Height + scrollViewPadding.VerticalThickness, platformViewBounds.Height));

            contentView.Bounds = contentBounds;
            contentView.Center = new CGPoint(contentBounds.GetMidX(), contentBounds.GetMidY());
        }
Exemplo n.º 15
0
        public CalloutAnnotation(int count, CGRect rect, nfloat lineWidth, UIColor color)
        {
            Path = UIBezierPath.FromOval(rect);
            Path.LineWidth = lineWidth;

            var center = new CGPoint (rect.GetMidX(), rect.GetMidY());

            Center = center;

            nfloat startAngle = (nfloat)(Math.PI * 0.75);
            nfloat endAngle = (nfloat)(Math.PI * 0.60);

            Clip = UIBezierPath.FromArc(center, center.X + lineWidth, startAngle, endAngle, true);
            Clip.AddLineTo(center);
            Clip.ClosePath();
            Clip.LineWidth = lineWidth;

            Tail = new UIBezierPath ();
            Tail.MoveTo(new CGPoint (center.X - 11, center.Y + 9));
            Tail.AddLineTo(new CGPoint (center.X - 11, center.Y + 18));
            Tail.AddLineTo(new CGPoint (center.X - 3, center.Y + 13));
            Tail.LineWidth = lineWidth;

            Rect = rect;
            Color = color;
            Count = count;
        }
        private void CreateLines(CGRect lineFrame, CGPoint imgCenterPoint)
        {
            var path = new CGPath();

            path.MoveToPoint(new CGPoint(lineFrame.GetMidX(), lineFrame.GetMidY()));
            path.AddLineToPoint(new CGPoint(lineFrame.X + lineFrame.Width / 2, lineFrame.Y));

            _lines = new CAShapeLayer[5];

            for (int i = 0; i < 5; i++)
            {
                var line = new CAShapeLayer()
                {
                    Bounds        = lineFrame,
                    Position      = imgCenterPoint,
                    MasksToBounds = true,
                    Actions       = new NSDictionary("strokeStart", new NSNull(), "strokeEnd", new NSNull()),
                    StrokeColor   = _lineColor.CGColor,
                    LineWidth     = 1.25F,
                    MiterLimit    = 1.25F,
                    Path          = path,
                    LineCap       = CAShapeLayer.CapRound,
                    LineJoin      = CAShapeLayer.JoinRound,
                    StrokeStart   = 0.0F,
                    StrokeEnd     = 0.0F,
                    Opacity       = 0.0F,
                    Transform     = CATransform3D.MakeRotation((nfloat)Math.PI / 5F * (nfloat)(i * 2F + 1), 0.0F, 0.0F, 1.0F)
                };

                this.Layer.AddSublayer(line);
                _lines[i] = line;
            }
        }
Exemplo n.º 17
0
        public override void Draw(CGRect rect)
        {
            // This will always end up 40x40 with the original x,y
            var fabRect = new CGRect(rect.Location, new CGSize(40, 40));

            fabRect = rect;

            base.Draw(fabRect);

            circleLayer = new CAShapeLayer();
            var bp = UIBezierPath.FromOval(fabRect);

            circleLayer.Path      = bp.CGPath;
            circleLayer.FillColor = UIColor.FromRGB(230, 248, 37).CGColor;
            Layer.AddSublayer(circleLayer);

            tintLayer           = new CAShapeLayer();
            tintLayer.Path      = bp.CGPath;
            tintLayer.FillColor = UIColor.FromRGB(168, 181, 27).CGColor;

            // Calculate the X and Y for the cross rectangles
            var xMidPointLow  = fabRect.GetMidX() - 2;
            var xMidPointHigh = fabRect.GetMidX() + 2;
            var xPointLow     = fabRect.GetMinX() + 8;
            var xPointHigh    = fabRect.GetMaxX() - 8;

            var yMidPointLow  = fabRect.GetMidY() - 2;
            var yMidPointHigh = fabRect.GetMidY() + 2;
            var yPointLow     = fabRect.GetMinY() + 8;
            var yPointHigh    = fabRect.GetMaxY() - 8;

            downLayer = new CAShapeLayer();
            var downRect = new CGRect(xMidPointLow, yPointLow, xMidPointHigh - xMidPointLow, yPointHigh - yPointLow);
            var downBp   = UIBezierPath.FromRoundedRect(downRect, 2);

            downLayer.Path      = downBp.CGPath;
            downLayer.FillColor = UIColor.FromRGB(232, 80, 80).CGColor;
            Layer.AddSublayer(downLayer);

            crossLayer = new CAShapeLayer();
            var crossRect = new CGRect(xPointLow, yMidPointLow, xPointHigh - xPointLow, yMidPointHigh - yMidPointLow);
            var crossBp   = UIBezierPath.FromRoundedRect(crossRect, 2);

            crossLayer.Path      = crossBp.CGPath;
            crossLayer.FillColor = UIColor.FromRGB(232, 80, 80).CGColor;
            Layer.AddSublayer(crossLayer);
        }
        /// <summary>
        /// Initializes a new instance of this <c>CircularSubtractionPath</c> class.
        /// </summary>
        /// <param name="frame">Frame.</param>
        /// <param name="radius">Radius.</param>
        public CircularSubtractionPath(CGRect frame, float radius = 0)
        {
            Frame = frame;

            var rect = new CGRect(Frame.GetMidX() - radius, Frame.GetMidY() - radius, 2 * radius, 2 * radius);

            BezierPath = UIBezierPath.FromOval(rect);
        }
Exemplo n.º 19
0
        public override void Scrolled(UIScrollView scrollView)
        {
            var collectionView = scrollView as InfiniteScrollView <T>;

            if (collectionView == null)
            {
                return;
            }

            var contentOffset = scrollView.ContentOffset;

            var visibleRect = new CGRect(collectionView.ContentOffset, collectionView.Bounds.Size);

            var visiblePoint     = new CGPoint(visibleRect.GetMidX(), visibleRect.GetMidY());
            var visibleIndexPath = collectionView.IndexPathForItemAtPoint(visiblePoint);

            if (visibleIndexPath == null)
            {
                return;
            }

            var shouldRefreshVisibleCells = false;

            if (_currentOffset.X < contentOffset.X)
            {
                // right

                if (visibleIndexPath.Row == 2)
                {
                    this.CurrentIndex        += 1;
                    scrollView.ContentOffset  = new CGPoint(scrollView.ContentOffset.X - (collectionView.Bounds.Width), 0);
                    shouldRefreshVisibleCells = true;
                    _del.OnCurrentIndexChanged(collectionView, this.CurrentIndex);
                }
            }
            else if (_currentOffset.X > contentOffset.X)
            {
                // left

                if (visibleIndexPath.Row == 0)
                {
                    this.CurrentIndex        -= 1;
                    scrollView.ContentOffset  = new CGPoint(scrollView.ContentOffset.X + (collectionView.Bounds.Width), 0);
                    shouldRefreshVisibleCells = true;
                    _del.OnCurrentIndexChanged(collectionView, this.CurrentIndex);
                }
            }

            if (collectionView.VisibleCells.Length > 1)
            {
                shouldRefreshVisibleCells = true;
            }

            if (shouldRefreshVisibleCells)
            {
                RefreshVisibleCells(collectionView as InfiniteScrollView <T>);
            }
        }
Exemplo n.º 20
0
        public static CGPoint DrawCircleText(CGRect Bounds, CGSize size)
        {
            var x = Bounds.GetMidX() - size.Width / 2;
            var y = Bounds.GetMidY() - size.Height / 2;

            var textPoint = new CGPoint(x, y);

            return(textPoint);
        }
Exemplo n.º 21
0
		public override void Draw (CGRect rect)
		{
			base.Draw (rect);

			// Get current graphics context.
			using (CGContext g = UIGraphics.GetCurrentContext ()) {

				// Overall transforms to shift (0, 0) to center and scale.
				g.TranslateCTM (rect.GetMidX (), rect.GetMidY ());
				nfloat scale = (nfloat)Math.Min(rect.Width, rect.Height) / 2 / 100;
				g.ScaleCTM (scale, scale);

				// Attributes for tick marks
				g.SetStrokeColor (new CGColor (0, 0, 0));
				g.SetLineCap (CGLineCap.Round);

				// Set line dash to draw tick marks for every minute.
				g.SetLineWidth (3);
				g.SetLineDash (0, new nfloat[] { 0, 3 * (nfloat)Math.PI });
				g.AddPath (tickMarks);
				g.DrawPath (CGPathDrawingMode.Stroke);

				// Set line dash to draw tick marks for every hour.
				g.SetLineWidth (6);
				g.SetLineDash(0, new nfloat[] { 0, 15 * (nfloat)Math.PI });
				g.AddPath (tickMarks);
				g.DrawPath (CGPathDrawingMode.Stroke);

				// Set common attributes for clock hands.
				g.SetStrokeColor (new CGColor (0, 0, 0));
				g.SetFillColor(new CGColor(0, 0, 1));
				g.SetLineWidth (2);
				g.SetLineDash (0, null);
				g.SetLineJoin (CGLineJoin.Round);

				// Draw hour hand.
				g.SaveState ();
				g.RotateCTM (hourAngle); // 2 * (float)Math.PI * (dt.Hour + dt.Minute / 60.0f) / 12);
				g.AddPath (hourHand);
				g.DrawPath (CGPathDrawingMode.FillStroke);
				g.RestoreState ();

				// Draw minute hand.
				g.SaveState ();
				g.RotateCTM (minuteAngle); // 2 * (float)Math.PI * (dt.Minute + dt.Second / 60.0f) / 60);
				g.AddPath (minuteHand);
				g.DrawPath (CGPathDrawingMode.FillStroke);
				g.RestoreState ();

				// Draw second hand.
				g.SaveState ();
				g.RotateCTM (secondAngle); // 2 * (float)Math.PI * dt.Second / 60);
				g.AddPath (secondHand);
				g.DrawPath (CGPathDrawingMode.Stroke);
				g.RestoreState ();
			}
		}
Exemplo n.º 22
0
        public Foundation.NSIndexPath TryGetVisibleIndexPath()
        {
            var visibleRect = new CGRect(this.ContentOffset, this.Bounds.Size);

            var visiblePoint     = new CGPoint(visibleRect.GetMidX(), visibleRect.GetMidY());
            var visibleIndexPath = this.IndexPathForItemAtPoint(visiblePoint);

            return(visibleIndexPath);
        }
Exemplo n.º 23
0
        public static CGPoint RectCircle(CGRect Bounds)
        {
            var x = Bounds.GetMidX();
            var y = Bounds.GetMidY();

            var rect = new CGPoint(x, y);

            return(rect);
        }
Exemplo n.º 24
0
        public static CGPoint DrawBarText(CGRect Bounds, CGSize size, nfloat stepInBar)
        {
            var x = Bounds.GetMidX() - size.Width / 2;
            var y = Bounds.GetMaxY() - Bounds.GetMaxY() / 4 - stepInBar - Bounds.GetMaxY() / 30 - size.Height / 2;

            var rect = new CGPoint(x, y);

            return(rect);
        }
Exemplo n.º 25
0
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            // Get current graphics context.
            using (CGContext g = UIGraphics.GetCurrentContext()) {
                // Overall transforms to shift (0, 0) to center and scale.
                g.TranslateCTM(rect.GetMidX(), rect.GetMidY());
                nfloat scale = (nfloat)Math.Min(rect.Width, rect.Height) / 2 / 100;
                g.ScaleCTM(scale, scale);

                // Attributes for tick marks
                g.SetStrokeColor(new CGColor(0, 0, 0));
                g.SetLineCap(CGLineCap.Round);

                // Set line dash to draw tick marks for every minute.
                g.SetLineWidth(3);
                g.SetLineDash(0, new nfloat[] { 0, 3 * (nfloat)Math.PI });
                g.AddPath(tickMarks);
                g.DrawPath(CGPathDrawingMode.Stroke);

                // Set line dash to draw tick marks for every hour.
                g.SetLineWidth(6);
                g.SetLineDash(0, new nfloat[] { 0, 15 * (nfloat)Math.PI });
                g.AddPath(tickMarks);
                g.DrawPath(CGPathDrawingMode.Stroke);

                // Set common attributes for clock hands.
                g.SetStrokeColor(new CGColor(0, 0, 0));
                g.SetFillColor(new CGColor(0, 0, 1));
                g.SetLineWidth(2);
                g.SetLineDash(0, null);
                g.SetLineJoin(CGLineJoin.Round);

                // Draw hour hand.
                g.SaveState();
                g.RotateCTM(hourAngle);                  // 2 * (float)Math.PI * (dt.Hour + dt.Minute / 60.0f) / 12);
                g.AddPath(hourHand);
                g.DrawPath(CGPathDrawingMode.FillStroke);
                g.RestoreState();

                // Draw minute hand.
                g.SaveState();
                g.RotateCTM(minuteAngle);                  // 2 * (float)Math.PI * (dt.Minute + dt.Second / 60.0f) / 60);
                g.AddPath(minuteHand);
                g.DrawPath(CGPathDrawingMode.FillStroke);
                g.RestoreState();

                // Draw second hand.
                g.SaveState();
                g.RotateCTM(secondAngle);                  // 2 * (float)Math.PI * dt.Second / 60);
                g.AddPath(secondHand);
                g.DrawPath(CGPathDrawingMode.Stroke);
                g.RestoreState();
            }
        }
Exemplo n.º 26
0
        public override void Draw(CGRect rect)
        {
            var colorSpace = CGColorSpace.CreateDeviceRGB();
            var context    = UIGraphics.GetCurrentContext();

            context.SaveState();

            var startColor = UIColor.FromRGBA(79f / 255f, 30f / 255f, 122f / 255f, 1f);
            var endColor   = UIColor.FromRGBA(46f / 255f, 12f / 255f, 80f / 255f, 1f);
            var colors     = new[] { startColor.CGColor, endColor.CGColor };
            var locations  = new nfloat[] { 0, 1 };
            var gradient   = new CGGradient(colorSpace, colors, locations);

            var startPoint = new CGPoint(rect.GetMidX(), rect.GetMinY());
            var endPoint   = new CGPoint(rect.GetMidX(), rect.GetMaxY());

            context.DrawLinearGradient(gradient, startPoint, endPoint, CGGradientDrawingOptions.None);
            context.RestoreState();
        }
Exemplo n.º 27
0
		public override void Draw (CGRect rect)
		{
			rect = rect.Inset (4, 4);
			UIBezierPath path = UIBezierPath.FromArc (new CGPoint (rect.GetMidX (), rect.GetMidY ()), rect.Size.Width / 2, 0, 180, true);
			path.LineWidth = 8;

			UIColor.White.SetFill ();
			path.Fill ();

			UIColor.Black.SetStroke ();
			path.Stroke ();
		}
Exemplo n.º 28
0
        public static CGRect RectSimple(CGRect Bounds, nfloat endPoint)
        {
            var x = Bounds.GetMidX() - Bounds.GetMaxX() / 4;
            var y = endPoint;

            var width  = Bounds.GetMaxX() / 2;
            var height = Bounds.GetMaxY() - Bounds.GetMaxY() / 4 - endPoint;

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

            return(rect);
        }
Exemplo n.º 29
0
        public static CGRect RectBar(CGRect Bounds, nfloat stepInBar)
        {
            var x = Bounds.GetMidX() - Bounds.GetMaxX() / 4;
            var y = Bounds.GetMaxY() - Bounds.GetMaxY() / 4 - Bounds.GetMaxY() / 25 - stepInBar;

            var width  = Bounds.GetMaxX() / 2;
            var height = Bounds.GetMaxY() / 20;

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

            return(rect);
        }
Exemplo n.º 30
0
        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();
        }
Exemplo n.º 31
0
            public override void Draw(CGRect rect)
            {
                UIView       head = ((WalkingDead)Superview).head;
                UIBezierPath path = new UIBezierPath();

                path.LineCapStyle = CGLineCap.Round;
                CGRect headFrame = head.Frame;

                if (!MovingRight)
                {
                    rect.X -= 20;
                    path.MoveTo(new CGPoint(rect.GetMidX() + 20, headFrame.GetMaxY() + 10));
                    path.AddLineTo(new CGPoint(rect.GetMidX() + 20 + rect.Size.Width / 6, headFrame.GetMaxY() + 10));
                    path.AddLineTo(new CGPoint(rect.GetMidX() + 20 + rect.Size.Width / 6 + 10, headFrame.GetMaxY() + 10 + 20));
                }
                else
                {
                    path.MoveTo(new CGPoint(rect.GetMidX() - 20, headFrame.GetMaxY() + 10));
                    path.AddLineTo(new CGPoint(rect.GetMidX() - 20 - rect.Size.Width / 6, headFrame.GetMaxY() + 10));
                    path.AddLineTo(new CGPoint(rect.GetMidX() - 20 - rect.Size.Width / 6 - 10, headFrame.GetMaxY() + 10 + 20));
                }
                UIColor.Black.SetStroke();
                path.LineWidth = 12;
                path.Stroke();

                UIColor.White.SetStroke();
                path.LineWidth = 8;
                path.Stroke();
            }
Exemplo n.º 32
0
        public override void Draw(CGRect rect)
        {
            rect = rect.Inset(4, 4);
            UIBezierPath path = UIBezierPath.FromArc(new CGPoint(rect.GetMidX(), rect.GetMidY()), rect.Size.Width / 2, 0, 180, true);

            path.LineWidth = 8;

            UIColor.White.SetFill();
            path.Fill();

            UIColor.Black.SetStroke();
            path.Stroke();
        }
Exemplo n.º 33
0
 public override void Draw(CGRect rect)
 {
     base.Draw(rect);
     using (var gctx = UIGraphics.GetCurrentContext())
     {
         var pathStatus = new CGPath ();
         pathStatus.AddArc(rect.GetMidX(), rect.GetMidY(), (rect.Width>rect.Height?rect.Height/2:rect.Width/2)/2,
             1.5f* (float)Math.PI, this.angle * (float)Math.PI+1.5f* (float)Math.PI, false);
         gctx.SetLineWidth (rect.Width>rect.Height?rect.Height/2:rect.Width/2);
         gctx.SetStrokeColor (color);
         gctx.AddPath (pathStatus);
         gctx.DrawPath (CGPathDrawingMode.Stroke);
     }
 }
Exemplo n.º 34
0
        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 CreateLayers()
        {
            this.Layer.Sublayers = null;

            var imageFrame     = new CGRect(Frame.Size.Width / 2 - Frame.Size.Width / 4, Frame.Size.Height / 2 - Frame.Size.Height / 4, Frame.Size.Width / 2, Frame.Size.Height / 2);
            var imgCenterPoint = new CGPoint(imageFrame.GetMidX(), y: imageFrame.GetMidY());
            var lineFrame      = new CGRect(imageFrame.X - imageFrame.Width / 4, imageFrame.Y - imageFrame.Height / 4, imageFrame.Width * 1.5, imageFrame.Height * 1.5);

            CreateCircleShape(imageFrame, imgCenterPoint);
            CreateLines(lineFrame, imgCenterPoint);
            CreateImage(imageFrame, imgCenterPoint);
            CreateCircleTransformAnimation(imageFrame);
            CreateLineStrokeAnimation();
            CreateImageTransformAnimation();
        }
Exemplo n.º 36
0
        public static float GetOuterCircleRadius(this MaterialShowcase _materialShowcase, CGPoint _center, CGRect _textBounds, CGRect _targetBounds)
        {
            var targetCenterX = _targetBounds.GetMidX();
            var targetCenterY = _targetBounds.GetMidY();

            var expandedRadius = new nfloat(1.1 * MaterialShowcase.TargetHolderRadius);
            var expandedBounds = new CGRect(targetCenterX, targetCenterY, 0, 0);

            expandedBounds.Inset(-expandedRadius, -expandedRadius);

            var textRadius   = _materialShowcase.MaxDistance(_center, _textBounds);
            var targetRadius = _materialShowcase.MaxDistance(_center, expandedBounds);

            return(Math.Max(textRadius, targetRadius) + 40);
        }
Exemplo n.º 37
0
		public override UICollectionViewLayoutAttributes[] LayoutAttributesForElementsInRect (CGRect rect)
		{
			var array = base.LayoutAttributesForElementsInRect (rect);
			var visibleRect = new CGRect (CollectionView.ContentOffset, CollectionView.Bounds.Size);

			foreach (var attributes in array) {
				if (attributes.Frame.IntersectsWith (rect)) {
					float distance = (float)visibleRect.GetMidX () - (float)attributes.Center.X;
					float normalizedDistance = distance / ACTIVE_DISTANCE;
					if (Math.Abs (distance) < ACTIVE_DISTANCE) {
						float zoom = 1 + ZOOM_FACTOR * (1 - Math.Abs (normalizedDistance));
						attributes.Transform3D = CATransform3D.MakeScale (zoom, zoom, 1.0f);
						attributes.ZIndex = 1;
					}
				}
			}
			return array;
		}
Exemplo n.º 38
0
        public override void DrawInContext(CGContext context, CGRect bounds, TKChartVisualPoint visualPoint)
        {
            UIGraphics.PushContext (context);
            TKFill fill = this.Style.Fill;
            TKStroke stroke = new TKStroke (UIColor.Black);
            TKBalloonShape shape = new TKBalloonShape (TKBalloonShapeArrowPosition.Bottom, bounds.Size);
            shape.DrawInContext (context, new CGPoint (bounds.GetMidX (), bounds.GetMidY ()), new TKDrawing[]{ fill, stroke });
            CGRect textRect = new CGRect (bounds.Left, bounds.Top - this.Style.Insets.Top, bounds.Size.Width, bounds.Size.Height + this.Style.Insets.Bottom);

            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle ();
            paragraphStyle.Alignment = this.Style.TextAlignment;
            NSDictionary attributes = new NSDictionary (UIStringAttributeKey.Font, UIFont.SystemFontOfSize (18),
                                          UIStringAttributeKey.ForegroundColor, this.Style.TextColor,
                                          UIStringAttributeKey.ParagraphStyle, paragraphStyle);

            NSString text = new NSString (this.Text);
            text.WeakDrawString (textRect, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, null);
            UIGraphics.PopContext ();
        }
Exemplo n.º 39
0
		// Draws a dashed circle in the center of the `rect` with a radius 1/4th of the `rect`'s smallest side.
		public override void Draw (CGRect rect)
		{
			base.Draw (rect);

			var context = UIGraphics.GetCurrentContext ();

			var strokeColor = UIColor.Blue;

			nfloat circleDiameter = NMath.Min (rect.Width, rect.Height) / 2;
			var circleRadius = circleDiameter / 2;
			var cirlceRect = new CGRect (rect.GetMidX () - circleRadius, rect.GetMidY () - circleRadius, circleDiameter, circleDiameter);
			var circlePath = UIBezierPath.FromOval (cirlceRect);

			strokeColor.SetStroke ();
			circlePath.LineWidth = 3;
			context.SaveState ();
			context.SetLineDash (0, new nfloat[] { 6, 6 }, 2);
			circlePath.Stroke ();
			context.RestoreState ();
		}
Exemplo n.º 40
0
			public override void Draw (CGRect rect)
			{
				rect = rect.Inset (4, 4);

				rect = new CGRect ((rect.Size.Width - rect.Size.Height) / 2 + 4, 8, rect.Size.Height, rect.Size.Height);
				UIBezierPath path = UIBezierPath.FromOval (rect);
				UIColor.Black.SetStroke ();
				UIColor.White.SetFill ();
				path.LineWidth = 2;
				path.Fill ();
				path.Stroke ();

				UIBezierPath rightEye, leftEye, mouth = new UIBezierPath ();
				if (MovingRight) {
					rightEye = UIBezierPath.FromArc (new CGPoint (rect.GetMidX () - 5, rect.Y + 15), 4, 0, 180, true);
					leftEye = UIBezierPath.FromArc (new CGPoint (rect.GetMidX () + 10, rect.Y + 15), 4, 0, 180, true);

					mouth.MoveTo (new CGPoint (rect.GetMidX (), rect.Y + 30));
					mouth.AddLineTo (new CGPoint (rect.GetMidX () + 13, rect.Y + 30));
				} else {
					rightEye = UIBezierPath.FromArc (new CGPoint (rect.GetMidX () - 10, rect.Y + 15), 4, 0, 180, true);
					leftEye = UIBezierPath.FromArc (new CGPoint (rect.GetMidX () + 5, rect.Y + 15), 4, 0, 180, true);

					mouth.MoveTo (new CGPoint (rect.GetMidX (), rect.Y + 30));
					mouth.AddLineTo (new CGPoint (rect.GetMidX () - 13, rect.Y + 30));

				}
				rightEye.LineWidth = 2;
				rightEye.Stroke ();

				leftEye.LineWidth = 2;
				leftEye.Stroke ();

				mouth.LineWidth = 2;
				mouth.Stroke ();
			}
Exemplo n.º 41
0
        //// 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();
        }
Exemplo n.º 42
0
			public override void Draw (CGRect rect)
			{
				try {
					base.Draw (rect);

					var appdel = DocumentAppDelegate.Shared;
					var theme = appdel.Theme;

					var c = UIGraphics.GetCurrentContext ();
					
					var backColor = Praeclarum.Graphics.ColorEx.GetUIColor (appdel.App.GetThumbnailBackgroundColor (theme));
					backColor.SetFill ();
					c.FillRect (rect);

					var b = Bounds;
					
					c.SetLineWidth (2.0f);
					
					var color = Praeclarum.Graphics.ColorEx.GetUIColor (appdel.App.TintColor);
					
					color.SetStroke ();
					
					var size = (nfloat)(Math.Min (b.Width, b.Height) * 0.5);
					var f = new CGRect ((b.Width - size) / 2, (b.Height - size) / 2, size, size);
					f.X = (int)f.X;
					f.Y = (int)f.Y;
					
					c.MoveTo (f.Left, f.GetMidY ());
					c.AddLineToPoint (f.Right, f.GetMidY ());
					c.StrokePath ();
					
					c.MoveTo (f.GetMidX (), f.Top);
					c.AddLineToPoint (f.GetMidX (), f.Bottom);
					c.StrokePath ();
					
					if (Editing) {
						GetNotSelectableColor (theme).SetFill ();
						c.FillRect (b);
					}
				} catch (Exception ex) {
					Log.Error (ex);
				}
			}
Exemplo n.º 43
0
		public override void DrawRect (CGRect dirtyRect)
		{
			// Don't draw if we don't have a font or a title.
			if (Font == null || Title == string.Empty)
				return;

			// Initialize the text matrix to a known value
			CGContext context = NSGraphicsContext.CurrentContext.GraphicsPort;
			context.TextMatrix = CGAffineTransform.MakeIdentity ();

			// Draw a white background
			NSColor.White.Set ();
			context.FillRect (dirtyRect);
			CTLine line = new CTLine (AttributedString);

			int glyphCount = (int)line.GlyphCount;
			if (glyphCount == 0)
				return;

			GlyphArcInfo[] glyphArcInfo = new GlyphArcInfo[glyphCount];
			PrepareGlyphArcInfo (line, glyphCount, glyphArcInfo);

			// Move the origin from the lower left of the view nearer to its center.
			context.SaveState ();
			context.TranslateCTM (dirtyRect.GetMidX (), dirtyRect.GetMidY () - Radius / 2);

			// Stroke the arc in red for verification.
			context.BeginPath ();
			context.AddArc (0, 0, Radius, (float)Math.PI, 0, true);
			context.SetStrokeColor (1, 0, 0, 1);
			context.StrokePath ();

			// Rotate the context 90 degrees counterclockwise.
			context.RotateCTM ((float)PI_2);

			/*
			 	Now for the actual drawing. The angle offset for each glyph relative to the previous
				glyph has already been calculated; with that information in hand, draw those glyphs
			 	overstruck and centered over one another, making sure to rotate the context after each
			 	glyph so the glyphs are spread along a semicircular path.
			*/
			CGPoint textPosition = new CGPoint (0, Radius);
			context.TextPosition = textPosition;
			var runArray = line.GetGlyphRuns ();
			var runCount = runArray.Count ();

			var glyphOffset = 0;
			var runIndex = 0;

			for (; runIndex < runCount; runIndex++) {
				var run = runArray [runIndex];
				var runGlyphCount = run.GlyphCount;
				bool drawSubstitutedGlyphsManually = false;
				CTFont runFont = run.GetAttributes ().Font;
                                
				// Determine if we need to draw substituted glyphs manually. Do so if the runFont is not
				//      the same as the overall font.
				var description = NSFontDescriptor.FromNameSize (runFont.FamilyName, runFont.Size);
				NSFont rrunFont = NSFont.FromDescription (description, runFont.Size);
				// used for comparison
				if (DimsSubstitutedGlyphs && Font != rrunFont) {
					drawSubstitutedGlyphsManually = true;
				}
                                
				var runGlyphIndex = 0;
				for (; runGlyphIndex < runGlyphCount; runGlyphIndex++) {
					var glyphRange = new NSRange (runGlyphIndex, 1);
					context.RotateCTM (-(glyphArcInfo [runGlyphIndex + glyphOffset].angle));
                                        
					// Center this glyph by moving left by half its width.
					var glyphWidth = glyphArcInfo [runGlyphIndex + glyphOffset].width;
					var halfGlyphWidth = glyphWidth / 2.0;
					var positionForThisGlyph = new CGPoint (textPosition.X - (float)halfGlyphWidth, textPosition.Y);
                                        
					// Glyphs are positioned relative to the text position for the line, so offset text position leftwards by this glyph's
					//      width in preparation for the next glyph.
					textPosition.X -= glyphWidth;
                                        
					CGAffineTransform textMatrix = run.TextMatrix;
					textMatrix.x0 = positionForThisGlyph.X;
					textMatrix.y0 = positionForThisGlyph.Y;
					context.TextMatrix = textMatrix;
                                        
					if (!drawSubstitutedGlyphsManually) {
						run.Draw (context, glyphRange);
					} else {
						// We need to draw the glyphs manually in this case because we are effectively applying a graphics operation by
						//      setting the context fill color. Normally we would use kCTForegroundColorAttributeName, but this does not apply
						// as we don't know the ranges for the colors in advance, and we wanted demonstrate how to manually draw.
						var cgFont = runFont.ToCGFont ();
						var glyph = run.GetGlyphs (glyphRange);
						var position = run.GetPositions (glyphRange);
						context.SetFont (cgFont);
						context.SetFontSize (runFont.Size);
						context.SetFillColor (0.25f, 0.25f, 0.25f, 1);
						context.ShowGlyphsAtPositions (glyph, position, 1);
					}

					// Draw the glyph bounds
					if (ShowsGlyphBounds) {
						var glyphBounds = run.GetImageBounds (context, glyphRange);
						context.SetStrokeColor (0, 0, 1, 1);
						context.StrokeRect (glyphBounds);
					}

					// Draw the bounding boxes defined by the line metrics
					if (ShowsLineMetrics) {
						var lineMetrics = new CGRect ();
						nfloat ascent = 0;
						nfloat descent = 0;
						nfloat leading = 0;

						run.GetTypographicBounds (glyphRange, out ascent, out descent, out leading);

						// The glyph is centered around the y-axis
						lineMetrics.Location = new CGPoint (-(float)halfGlyphWidth, positionForThisGlyph.Y - descent);
						lineMetrics.Size = new CGSize (glyphWidth, ascent + descent);
						context.SetStrokeColor (0, 1, 0, 1);
						context.StrokeRect (lineMetrics);
					}
				}

				glyphOffset += (int)runGlyphCount;
			}

			context.RestoreState ();
		}
Exemplo n.º 44
0
        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();
            }
        }
Exemplo n.º 45
0
			public override void Draw (CGRect rect)
			{
				UIView head = ((WalkingDead)Superview).head;
				var path = new UIBezierPath {
					LineCapStyle = CGLineCap.Round
				};
				CGRect headFrame = head.Frame;

				if (!MovingRight) {
					rect.X -= 20;
					path.MoveTo (new CGPoint (rect.GetMidX () + 20, headFrame.GetMaxY () + 10));
					path.AddLineTo (new CGPoint (rect.GetMidX () + 20 + rect.Size.Width / 6, headFrame.GetMaxY () + 10));
					path.AddLineTo (new CGPoint (rect.GetMidX () + 20 + rect.Size.Width / 6 + 10, headFrame.GetMaxY () + 10 + 20));
				} else {
					path.MoveTo (new CGPoint (rect.GetMidX () - 20, headFrame.GetMaxY () + 10));
					path.AddLineTo (new CGPoint (rect.GetMidX () - 20 - rect.Size.Width / 6, headFrame.GetMaxY () + 10));
					path.AddLineTo (new CGPoint (rect.GetMidX () - 20 - rect.Size.Width / 6 - 10, headFrame.GetMaxY () + 10 + 20));

				}
				UIColor.Black.SetStroke ();
				path.LineWidth = 12;
				path.Stroke ();

				UIColor.White.SetStroke ();
				path.LineWidth = 8;
				path.Stroke ();
			}
Exemplo n.º 46
0
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            _bounds = new CGRect(rect.X + Padding, rect.Y + Padding, rect.Width - 2 * Padding, rect.Height - 2 * Padding);

            using (var ctx = UIGraphics.GetCurrentContext())
            {
                ctx.SaveState();

                UIColor.DarkGray.SetStroke();
                ctx.SetLineWidth(3);
                ctx.StrokeRect(_bounds);

                ctx.RestoreState();

                ctx.SaveState();

                UIColor.DarkGray.SetStroke();
                ctx.SetLineWidth(2);
                ctx.SetLineDash(0, new nfloat[] { 4, 4 });

                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.GetMidX(), _bounds.Top),
                        new CGPoint(_bounds.GetMidX(), _bounds.Bottom)
                    });
                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.Left, _bounds.GetMidY()),
                        new CGPoint(_bounds.Right, _bounds.GetMidY())
                    });

                ctx.RestoreState();

                ctx.SaveState();

                UIColor.DarkGray.SetStroke();
                ctx.SetLineWidth(2);
                ctx.SetLineDash(0, new nfloat[] { 2, 2 });

                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.Left + _bounds.Width / 4f, _bounds.Top),
                        new CGPoint(_bounds.Left + _bounds.Width / 4f, _bounds.Bottom)
                    });
                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.Left + 3f * _bounds.Width / 4f, _bounds.Top),
                        new CGPoint(_bounds.Left + 3f * _bounds.Width / 4f, _bounds.Bottom)
                    });
                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.Left, _bounds.Top + _bounds.Height / 4f),
                        new CGPoint(_bounds.Right, _bounds.Top + _bounds.Height / 4f)
                    });
                ctx.StrokeLineSegments(new []
                    {
                        new CGPoint(_bounds.Left, _bounds.Top + 3f * _bounds.Height / 4f),
                        new CGPoint(_bounds.Right, _bounds.Top + 3f * _bounds.Height / 4f)
                    });

                ctx.RestoreState();

                if (_isActive)
                {
                    ctx.SaveState();

                    UIColor.Blue.SetFill();
                    ctx.FillEllipseInRect(new CGRect(_joystickPositionRaw.X - 20, _joystickPositionRaw.Y - 20, 40, 40));

                    ctx.RestoreState();
                }
            }
        }