コード例 #1
0
        public override void DrawInContext(CoreGraphics.CGContext ctx)
        {
            base.DrawInContext(ctx);
            var rect = this.Frame;

            switch (Type)
            {
            case GradientType.Linear:
                linearGradient.Draw(ctx, rect);
                break;

            case GradientType.Radial:
                radialGradient.Draw(ctx, rect);
                break;

            case GradientType.Ellipse:
                ellipticalGradient.Draw(ctx, rect);
                break;

            case GradientType.Multi:
                multiGradient.Draw(ctx, rect);
                break;

            default:
                throw new NotImplementedException("The target gradient type is not supported: " + Type);
            }
        }
コード例 #2
0
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            using (CGContext ctx = UIGraphics.GetCurrentContext())
            {
                switch (Type)
                {
                case GradientType.Linear:
                    linearGradient.Draw(ctx, rect);
                    break;

                case GradientType.Radial:
                    radialGradient.Draw(ctx, rect);
                    break;

                case GradientType.Ellipse:
                    ellipticalGradient.Draw(ctx, rect);
                    break;

                case GradientType.Multi:
                    multiGradient.Draw(ctx, rect);
                    break;

                default:
                    throw new NotImplementedException("The target gradient type is not supported: " + Type);
                }
            }
        }