protected virtual void OnClipperPaint(object sender, SKPaintSurfaceEventArgs e)
        {
            var canvas = e.Surface.Canvas;

            canvas.Clear();

            ClippingGeometry = Element.Clip;
            if (ClippingGeometry == null)
            {
                return;
            }

            using (var paint = new SKPaint
            {
                IsAntialias = true,
                Style = SKPaintStyle.Fill,
                Color = SKColors.White
            })
            {
                canvas.DrawPath(ClippingGeometry.ToSKPath(), paint);
                RealControl?.SetClipperCanvas(ClipperCanvas);

                if (_backgroundCanvas.IsValueCreated)
                {
                    BackgroundCanvas.SetClipperCanvas(ClipperCanvas);
                }
            }
        }
示例#2
0
        async void UpdateSource(bool initialize)
        {
            if (initialize && Element.Source == default(ImageSource))
            {
                return;
            }

            ImageSource source = Element.Source;

            ((IImageController)Element).SetIsLoading(true);

            if (RealControl != null)
            {
                bool success = await RealControl.LoadFromImageSourceAsync(source);

                if (!IsDisposed && success)
                {
                    ((IVisualElementController)Element).PlatformSizeChanged();
                    UpdateAfterLoading(initialize);
                }
            }

            if (!IsDisposed)
            {
                ((IImageController)Element).SetIsLoading(false);
            }
        }
示例#3
0
        void UpdateAspect(bool initialize)
        {
            if (initialize && Element.Aspect == Aspect.AspectFit)
            {
                return;
            }

            RealControl.ApplyAspect(Element.Aspect);
        }
示例#4
0
        void UpdateRadius(bool init)
        {
            CornerRadius = Element.CornerRadius;
            int topLeft     = Forms.ConvertToScaledPixel(Element.CornerRadius.TopLeft);
            int topRight    = Forms.ConvertToScaledPixel(Element.CornerRadius.TopRight);
            int bottomLeft  = Forms.ConvertToScaledPixel(Element.CornerRadius.BottomLeft);
            int bottomRight = Forms.ConvertToScaledPixel(Element.CornerRadius.BottomRight);

            if (!init)
            {
                RealControl.Draw();
            }
        }
示例#5
0
        void UpdateFile(bool initialize)
        {
            if (initialize && Specific.GetFile(Element) == default || Element.Source != default(ImageSource))
            {
                return;
            }

            if (RealControl != null)
            {
                bool success = RealControl.LoadFromFile(Specific.GetFile(Element));
                if (!IsDisposed && success)
                {
                    ((IVisualElementController)Element).PlatformSizeChanged();
                    UpdateAfterLoading(initialize);
                }
            }
        }
示例#6
0
 protected override void UpdateLayout()
 {
     base.UpdateLayout();
     RealControl.Draw(Control.Geometry);
 }
示例#7
0
 protected override ESize Measure(int availableWidth, int availableHeight)
 {
     return(RealControl != null?RealControl.Measure(availableWidth, availableHeight) : base.Measure(availableHeight, availableHeight));
 }