コード例 #1
0
ファイル: TapEffect.cs プロジェクト: wys0120/Xamarin.DuGuLib
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing && this.Layer != null)
     {
         this.Layer.Dispose();
         this.Layer = null;
     }
 }
コード例 #2
0
ファイル: TapEffect.cs プロジェクト: yz1311/XFControls
            public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt)
            {
                base.TouchesBegan(touches, evt);

                if (this.Layer == null)
                {
                    this.Layer       = new RadialGradientLayer();
                    this.Layer.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height);
                    this.View.Layer.AddSublayer(this.Layer);
                }

                var t     = (UITouch)touches.AnyObject;
                var point = t.LocationInView(this.View);

                this.Layer.Center = point;

                this.SetAni(0, 50);
            }
コード例 #3
0
        internal override CALayer GetLayer(CGSize size)
        {
            var center  = Center;
            var radiusX = RadiusX;
            var radiusY = RadiusY;

            var radius = (nfloat)(radiusX + radiusY) / 2.0f;

            var transform = RelativeTransform;

            var isRelative = MappingMode == BrushMappingMode.RelativeToBoundingBox;

            var colors    = GradientStops.SelectToArray(gs => (CGColor)gs.Color);
            var locations = GradientStops.SelectToArray(gs => new nfloat(gs.Offset));

            var layer = new RadialGradientLayer(colors, locations, center, radius, isRelative);

            layer.SetNeedsDisplay();
            return(layer);
        }