示例#1
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 outputSize  = new Size(rect.Width, rect.Height);
                    var finalCanvas = _formsControl.RenderSvgToCanvas(outputSize, ScreenScale, CreatePlatformImageCanvas);
                    var image       = finalCanvas.GetImage();
                    var uiImage     = image.GetUIImage();
                    Control.Image = uiImage;
                }
            }
        }