public static SKData Create(IntPtr address, int length, SKDataReleaseDelegate releaseProc, object context) { if (releaseProc == null) { return(GetObject <SKData> (SkiaApi.sk_data_new_with_proc(address, (IntPtr)length, IntPtr.Zero, IntPtr.Zero))); } else { var ctx = new NativeDelegateContext(context, releaseProc); return(GetObject <SKData> (SkiaApi.sk_data_new_with_proc(address, (IntPtr)length, releaseDelegate, ctx.NativeContext))); } }
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context) { IntPtr ct = ctable == null ? IntPtr.Zero : ctable.Handle; if (releaseProc == null) { return(SkiaApi.sk_bitmap_install_pixels(Handle, ref info, pixels, (IntPtr)rowBytes, ct, IntPtr.Zero, IntPtr.Zero)); } else { var ctx = new NativeDelegateContext(context, releaseProc); return(SkiaApi.sk_bitmap_install_pixels(Handle, ref info, pixels, (IntPtr)rowBytes, ct, releaseDelegate, ctx.NativeContext)); } }
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc, object context) { var cinfo = SKImageInfoNative.FromManaged(ref info); if (releaseProc == null) { return(SkiaApi.sk_bitmap_install_pixels(Handle, ref cinfo, pixels, (IntPtr)rowBytes, IntPtr.Zero, IntPtr.Zero)); } else { var ctx = new NativeDelegateContext(context, releaseProc); return(SkiaApi.sk_bitmap_install_pixels(Handle, ref cinfo, pixels, (IntPtr)rowBytes, releaseDelegate, ctx.NativeContext)); } }
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))); } }
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 using (var ctx = new NativeDelegateContext(context, get)) { return(GetObject <GRGlInterface> (SkiaApi.gr_glinterface_assemble_interface(ctx.NativeContext, getProcDelegate))); } }
public static SKImage FromTexture(GRContext context, GRBackendTextureDesc desc, SKAlphaType alpha, SKImageTextureReleaseDelegate releaseProc, object releaseContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (releaseProc == null) { return(GetObject <SKImage> (SkiaApi.sk_image_new_from_texture(context.Handle, ref desc, alpha, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero))); } else { var ctx = new NativeDelegateContext(releaseContext, releaseProc); return(GetObject <SKImage> (SkiaApi.sk_image_new_from_texture(context.Handle, ref desc, alpha, IntPtr.Zero, textureReleaseDelegate, ctx.NativeContext))); } }
public static SKImage FromPixels(SKPixmap pixmap, SKImageRasterReleaseDelegate releaseProc, object releaseContext) { if (pixmap == null) { throw new ArgumentNullException(nameof(pixmap)); } if (releaseProc == null) { return(GetObject <SKImage> (SkiaApi.sk_image_new_raster(pixmap.Handle, IntPtr.Zero, IntPtr.Zero))); } else { var ctx = new NativeDelegateContext(releaseContext, releaseProc); return(GetObject <SKImage> (SkiaApi.sk_image_new_raster(pixmap.Handle, rasterReleaseDelegate, ctx.NativeContext))); } }
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; if (releaseProc == null) { return(GetObject <SKImage> (SkiaApi.sk_image_new_from_texture(context.Handle, texture.Handle, origin, colorType, alpha, cs, IntPtr.Zero, IntPtr.Zero))); } else { var ctx = new NativeDelegateContext(releaseContext, releaseProc); return(GetObject <SKImage> (SkiaApi.sk_image_new_from_texture(context.Handle, texture.Handle, origin, colorType, alpha, cs, textureReleaseDelegate, ctx.NativeContext))); } }
private static void SKBitmapReleaseInternal(IntPtr address, IntPtr context) { using (var ctx = NativeDelegateContext.Unwrap(context)) { ctx.GetDelegate <SKBitmapReleaseDelegate> () (address, ctx.ManagedContext); } }
private static IntPtr GrGLGetProcInternal(IntPtr context, string name) { var ctx = NativeDelegateContext.Unwrap(context); return(ctx.GetDelegate <GRGlGetProcDelegate> () (ctx.ManagedContext, name)); }
public static GRGlInterface AssembleGlesInterface(object context, GRGlGetProcDelegate get) { using (var ctx = new NativeDelegateContext(context, get)) { return(GetObject <GRGlInterface> (SkiaApi.gr_glinterface_assemble_gles_interface(ctx.NativeContext, getProcDelegate))); } }
private static void TextureReleaseInternal(IntPtr context) { using (var ctx = NativeDelegateContext.Unwrap(context)) { ctx.GetDelegate <SKImageTextureReleaseDelegate> () (ctx.ManagedContext); } }
private static void RasterReleaseInternal(IntPtr pixels, IntPtr context) { using (var ctx = NativeDelegateContext.Unwrap(context)) { ctx.GetDelegate <SKImageRasterReleaseDelegate> () (pixels, ctx.ManagedContext); } }