public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc, object context) { var cinfo = SKImageInfoNative.FromManaged (ref info); var del = releaseProc != null && context != null ? new SKBitmapReleaseDelegate ((addr, _) => releaseProc (addr, context)) : releaseProc; var proxy = DelegateProxies.Create (del, DelegateProxies.SKBitmapReleaseDelegateProxy, out _, out var ctx); return SkiaApi.sk_bitmap_install_pixels (Handle, &cinfo, (void*)pixels, (IntPtr)rowBytes, proxy, (void*)ctx); }
public static SKData Create(IntPtr address, int length, SKDataReleaseDelegate releaseProc, object context) { var del = releaseProc != null && context != null ? new SKDataReleaseDelegate((addr, _) => releaseProc(addr, context)) : releaseProc; var proxy = DelegateProxies.Create(del, DelegateProxies.SKDataReleaseDelegateProxy, out _, out var ctx); return(GetObject(SkiaApi.sk_data_new_with_proc((void *)address, (IntPtr)length, proxy, (void *)ctx))); }
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 GRGlInterface CreateWebGl(GRGlGetProcedureAddressDelegate get) { var proxy = DelegateProxies.Create(get, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx); try { return(GetObject(SkiaApi.gr_glinterface_assemble_webgl_interface((void *)ctx, proxy))); } finally { gch.Free(); } }
public void Initialize(GRVkGetProcedureAddressDelegate getProc, IntPtr vkInstance, IntPtr vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions) { var proxy = DelegateProxies.Create(getProc, DelegateProxies.GRVkGetProcDelegateProxy, out var gch, out var ctx); try { var ie = instanceExtensions; var de = deviceExtensions; SkiaApi.gr_vk_extensions_init(Handle, proxy, (void *)ctx, vkInstance, vkPhysicalDevice, (uint)(ie?.Length ?? 0), ie, (uint)(de?.Length ?? 0), de); } finally { gch.Free(); } }
public static GRGlInterface AssembleGlInterface(object context, GRGlGetProcDelegate get) { var del = get != null && context != null ? new GRGlGetProcDelegate((_, name) => get(context, name)) : get; var proxy = DelegateProxies.Create(del, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx); try { return(GetObject <GRGlInterface> (SkiaApi.gr_glinterface_assemble_gl_interface(ctx, proxy))); } finally { gch.Free(); } }
public static SKImage FromPixels(SKPixmap pixmap, SKImageRasterReleaseDelegate releaseProc, object releaseContext) { if (pixmap == null) { throw new ArgumentNullException(nameof(pixmap)); } var del = releaseProc != null && releaseContext != null ? new SKImageRasterReleaseDelegate((addr, _) => releaseProc(addr, releaseContext)) : releaseProc; var proxy = DelegateProxies.Create(del, DelegateProxies.SKImageRasterReleaseDelegateProxy, out _, out var ctx); return(GetObject <SKImage> (SkiaApi.sk_image_new_raster(pixmap.Handle, proxy, (void *)ctx))); }
public static SKImage FromTexture(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha, SKColorSpace colorspace, SKImageTextureReleaseDelegate releaseProc, object releaseContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (texture == null) { throw new ArgumentNullException(nameof(texture)); } var cs = colorspace == null ? IntPtr.Zero : colorspace.Handle; var del = releaseProc != null && releaseContext != null ? new SKImageTextureReleaseDelegate((_) => releaseProc(releaseContext)) : releaseProc; var proxy = DelegateProxies.Create(del, DelegateProxies.SKImageTextureReleaseDelegateProxy, out _, out var ctx); return(GetObject <SKImage> (SkiaApi.sk_image_new_from_texture(context.Handle, texture.Handle, origin, colorType, alpha, cs, proxy, (void *)ctx))); }
public static GRGlInterface AssembleInterface(object context, GRGlGetProcDelegate get) { // if on Windows, try ANGLE if (PlatformConfiguration.IsWindows) { var angle = AssembleAngleInterface(context, get); if (angle != null) { return(angle); } } // try the native default var del = get != null && context != null ? new GRGlGetProcDelegate((_, name) => get(context, name)) : get; var proxy = DelegateProxies.Create(del, DelegateProxies.GRGlGetProcDelegateProxy, out var gch, out var ctx); try { return(GetObject <GRGlInterface> (SkiaApi.gr_glinterface_assemble_interface(ctx, proxy))); } finally { gch.Free(); } }