Ejemplo n.º 1
0
        public override void Draw(Canvas canvas)
        {
            base.Draw(canvas);

            if (FormsControl != null)
            {
                const double screenScale = 1.0; // Don't need to deal with screen scaling on Android.

                var finalCanvas = FormsControl.RenderSvgToCanvas(new Size(canvas.Width, canvas.Height), screenScale, CreatePlatformImageCanvas);
                var image       = (BitmapImage)finalCanvas.GetImage();

                Control.SetImageBitmap(image.Bitmap);
            }
        }
Ejemplo n.º 2
0
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            if (FormsControl != null)
            {
                using (CGContext context = UIGraphics.GetCurrentContext()) {
                    context.SetAllowsAntialiasing(true);
                    context.SetShouldAntialias(true);
                    context.SetShouldSmoothFonts(true);

                    var finalCanvas = FormsControl.RenderSvgToCanvas(new Size(rect.Width, rect.Height), UIScreen.MainScreen.Scale, CreatePlatformImageCanvas);
                    var image       = finalCanvas.GetImage();
                    var uiImage     = image.GetUIImage();
                    Control.Image = uiImage;
                }
            }
        }