コード例 #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_pathProvider != null)
                {
                    _pathProvider.Dispose();
                    _pathProvider = null;
                }

                _shadowLayer.RemoveFromSuperLayer();
                _shadowLayer.Dispose();
                _shadowLayer = null;

                if (_gradientProvider != null)
                {
                    _gradientProvider.Dispose();
                    _gradientProvider = null;
                }

                if (_strokeGradientProvider != null)
                {
                    _strokeGradientProvider.Dispose();
                    _strokeGradientProvider = null;
                }
            }

            base.Dispose(disposing);
        }
コード例 #2
0
        public static void SetMaterialElevation(this UIView view, double elevation)
        {
            var shadowLayer = view.FindLayerOfType <ShadowLayer>();

            if (shadowLayer == null)
            {
                shadowLayer = new ShadowLayer();

                view.Layer.InsertSublayer(shadowLayer, 0);
            }

            if (!ReferenceEquals(view.Layer, shadowLayer))
            {
                shadowLayer.Frame = view.Bounds;
            }

            shadowLayer.Elevation = (float)elevation;

            CALayer currentLayer = view.FindLayerOfType <CAGradientLayer>();

            if (currentLayer == null)
            {
                currentLayer = view.Layer;
                if (currentLayer == null)
                {
                    return;
                }
            }

            if (currentLayer.CornerRadius > 0)
            {
                shadowLayer.CornerRadius = currentLayer.CornerRadius;
            }
        }
コード例 #3
0
ファイル: ScLayer.cs プロジェクト: zanderzhg/Sc
        public void Refresh()
        {
            if (scMgr != null && suspendLayoutCount == 0)
            {
                ScMgr.Refresh(drawBox);
            }

            if (ShadowLayer != null)
            {
                ShadowLayer.Refresh();
            }
        }
コード例 #4
0
        private void Initialize()
        {
            _shadowLayer = new ShadowLayer();

            InsertSublayer(_shadowLayer, 0);

            /*
             * When creating custom layers, the contentsScale must
             * be set in order to draw smooth lines. Without this line,
             * context clipping is blurry and not smooth at all!
             */
            ContentsScale = UIScreen.MainScreen.Scale;
        }
コード例 #5
0
 private void AssociatedObject_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (!IsEnabled)
     {
         return;
     }
     if (!AssociatedObject.IsVisible)
     {
         ShadowLayer.Hide();
     }
     else
     {
         SetZOrder();
         ShadowLayer.Show();
     }
 }
コード例 #6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _shadowLayer.RemoveFromSuperLayer();
                _shadowLayer.Dispose();
                _shadowLayer = null;

                _colors         = null;
                _positions      = null;
                _colorPositions = null;

                _strokeColors         = null;
                _strokePositions      = null;
                _strokeColorPositions = null;
            }

            base.Dispose(disposing);
        }
コード例 #7
0
        private void Initialize()
        {
            _dirty        = true;
            _pathDirty    = true;
            _bounds       = new CGRect();
            _shadowLayer  = new ShadowLayer();
            _pathProvider = new RectPathProvider();

            _defaultShadowColor = _shadowLayer.ShadowColor;

            InsertSublayer(_shadowLayer, 0);

            /*
             * When creating custom layers, the contentsScale must
             * be set in order to draw smooth lines. Without this line,
             * context clipping is blurry and not smooth at all!
             */
            ContentsScale = UIScreen.MainScreen.Scale;
        }