Example #1
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            var ctx = NSGraphicsContext.CurrentContext.CGContext;

            // create the skia context
            SKImageInfo info;
            var         surface = drawable.CreateSurface(Bounds, Window.BackingScaleFactor, out info);

            // draw on the image using SKiaSharp
            DrawInSurface(surface, info);

            // draw the surface to the context
            drawable.DrawSurface(ctx, Bounds, info, surface);
        }
Example #2
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            var ctx = NSGraphicsContext.CurrentContext.CGContext;

            // create the skia context
            using (var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : Window.BackingScaleFactor, out var info))
            {
                // draw on the image using SKiaSharp
                OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
#pragma warning disable CS0618 // Type or member is obsolete
                DrawInSurface(surface, info);
#pragma warning restore CS0618 // Type or member is obsolete

                // draw the surface to the context
                drawable.DrawSurface(ctx, Bounds, info, surface);
            }
        }