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

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

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

            if (_HighlightLayer != null)
            {
                _HighlightLayer.RemoveFromSuperLayer();
                _HighlightLayer.Dispose();
            }

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

            base.Dispose(disposing);
        }
コード例 #2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && !_disposed)
     {
         _disposed = true;
         _oldSublayer?.Dispose();
     }
     base.Dispose(disposing);
 }
コード例 #3
0
        protected override void OnDetached()
        {
            if (_visualElement != null)
            {
                _visualElement.SizeChanged -= OnSizeChanged;
            }

            if (_view != null)
            {
                _view.ClipsToBounds = _clipsToBounds;
            }

            _layer?.RemoveFromSuperLayer();
            _layer?.Dispose();
            _layer = null;

            _view          = null;
            _visualElement = null;

            System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}");
        }
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    GradientLayer?.Dispose();
                    GradientLayer = null;

                    ReleaseDesignerOutlets();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error while disposing TabBarController {ex}");
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
コード例 #5
0
        private static UIImage GenerateReflection(RectangleF canvasFrame, UIImage canvas, float reflectionY)
        {
            var reflectionHeight = Util.IsPad() ? 85 : 60;

            reflectionHeight = Util.IsPortrait() ? reflectionHeight : reflectionHeight - 20;

            // Build reflection and crop the upper image
            var reflection0         = BuildCoverFlow(canvas, 1.0f);
            var areaWithoutOriginal = new RectangleF(0, canvasFrame.Height, canvasFrame.Width, canvasFrame.Height);
            var reflection1         = ImageHelper.Crop(reflection0, areaWithoutOriginal);
            var reflection2         = ImageHelper.Crop(reflection1, new RectangleF(0, 0, canvasFrame.Width, reflectionHeight));

            reflection0.Dispose();
            reflection1.Dispose();

            var reflectionFrame = new RectangleF(canvasFrame.X, reflectionY, reflection2.Size.Width, reflection2.Size.Height);

            // Create the gradient used for the opacity mask (mask image must have no alpha channel, black is opaque, white is transparent)
            var             black    = UIColor.Black.CGColor;
            var             white    = UIColor.White.CGColor;
            CAGradientLayer gradient = new CAGradientLayer();

            gradient.Frame  = reflectionFrame;
            gradient.Colors = new CGColor[] { black, white, white };

            // Mask the reflection image
            var maskImage = ImageHelper.ImageFromLayer(gradient);

            gradient.Dispose();

            var reflection3 = ImageHelper.MaskImage(reflection2, maskImage);

            reflection2.Dispose();
            maskImage.Dispose();

            return(reflection3);
        }
コード例 #6
0
ファイル: ImageFactory.cs プロジェクト: modulexcite/artapp
		private static UIImage GenerateReflection(RectangleF canvasFrame, UIImage canvas, float reflectionY)
		{
			var reflectionHeight = Util.IsPad() ? 85 : 60;
			reflectionHeight = Util.IsPortrait() ? reflectionHeight : reflectionHeight - 20;
			
			// Build reflection and crop the upper image
			var reflection0 = BuildCoverFlow(canvas, 1.0f);
			var areaWithoutOriginal = new RectangleF(0, canvasFrame.Height, canvasFrame.Width, canvasFrame.Height);
			var reflection1 = ImageHelper.Crop(reflection0, areaWithoutOriginal);
			var reflection2 = ImageHelper.Crop(reflection1, new RectangleF(0, 0, canvasFrame.Width, reflectionHeight));	
			reflection0.Dispose();
			reflection1.Dispose();			
			
			var reflectionFrame = new RectangleF(canvasFrame.X, reflectionY, reflection2.Size.Width, reflection2.Size.Height);
			
			// Create the gradient used for the opacity mask (mask image must have no alpha channel, black is opaque, white is transparent)
			var black = UIColor.Black.CGColor;
			var white = UIColor.White.CGColor;
			CAGradientLayer gradient = new CAGradientLayer();
			gradient.Frame = reflectionFrame;
			gradient.Colors = new CGColor[] { black, white, white };
			
			// Mask the reflection image
			var maskImage = ImageHelper.ImageFromLayer(gradient);
			gradient.Dispose();
			
			var reflection3 = ImageHelper.MaskImage(reflection2, maskImage);
			reflection2.Dispose();
			maskImage.Dispose();

			return reflection3;
		}