예제 #1
0
 public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceReleaseDelegate releaseProc, object context) =>
 Create(info, pixels, rowBytes, releaseProc, context, null);
예제 #2
0
        public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceReleaseDelegate releaseProc, object context, SKSurfaceProperties props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);
            var del   = releaseProc != null && context != null
                                ? new SKSurfaceReleaseDelegate((addr, _) => releaseProc(addr, context))
                                : releaseProc;
            var proxy = DelegateProxies.Create(del, DelegateProxies.SKSurfaceReleaseDelegateProxy, out _, out var ctx);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster_direct(ref cinfo, pixels, (IntPtr)rowBytes, proxy, ctx, props?.Handle ?? IntPtr.Zero)));
        }
예제 #3
0
        public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceReleaseDelegate releaseProc, object context, SKSurfaceProperties props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            if (releaseProc == null)
            {
                return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster_direct(ref cinfo, pixels, (IntPtr)rowBytes, IntPtr.Zero, IntPtr.Zero, props?.Handle ?? IntPtr.Zero)));
            }
            else
            {
                var ctx = new NativeDelegateContext(context, releaseProc);
                return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster_direct(ref cinfo, pixels, (IntPtr)rowBytes, releaseDelegate, ctx.NativeContext, props?.Handle ?? IntPtr.Zero)));
            }
        }