public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceReleaseDelegate releaseProc, object context) => Create(info, pixels, rowBytes, releaseProc, context, null);
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))); }
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))); } }