Beispiel #1
0
        public static MauiAppBuilder UseSkiaSharp(this MauiAppBuilder builder, bool registerRenderers, bool replaceHandlers = false) =>
        builder
        .UseSkiaSharp()
        .ConfigureMauiHandlers(handlers =>
        {
#if !NETSTANDARD
            if (replaceHandlers)
            {
                handlers.AddCompatibilityRenderer(typeof(SKCanvasView), typeof(SKCanvasViewRenderer));
            }
            else
            {
                handlers.TryAddCompatibilityRenderer(typeof(SKCanvasView), typeof(SKCanvasViewRenderer));
            }

#if !WINDOWS
            handlers.AddCompatibilityRenderer(typeof(SKGLView), typeof(SKGLViewRenderer));
#endif

            CompatRegistrar.Registered.Register(typeof(SKImageImageSource), typeof(SKImageSourceHandler));
            CompatRegistrar.Registered.Register(typeof(SKBitmapImageSource), typeof(SKImageSourceHandler));
            CompatRegistrar.Registered.Register(typeof(SKPixmapImageSource), typeof(SKImageSourceHandler));
            CompatRegistrar.Registered.Register(typeof(SKPictureImageSource), typeof(SKImageSourceHandler));
#endif
        });
Beispiel #2
0
 public static MauiAppBuilder UseSkiaSharpHandlers(this MauiAppBuilder builder) => builder.UseSkiaSharp();
Beispiel #3
0
 public static MauiAppBuilder UseSkiaSharpCompatibilityRenderers(this MauiAppBuilder builder) => builder.UseSkiaSharp(true);