Example #1
0
        public static SKSurface Create(GRRecordingContext context, CoreAnimation.CAMetalLayer layer, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props, out CoreAnimation.ICAMetalDrawable drawable)
        {
            void *drawablePtr;
            var   surface = GetObject(SkiaApi.sk_surface_new_metal_layer(context.Handle, (void *)layer.Handle, origin, sampleCount, colorType.ToNative(), colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero, &drawablePtr));

            drawable = ObjCRuntime.Runtime.GetINativeObject <CoreAnimation.ICAMetalDrawable> ((IntPtr)drawablePtr, true);
            return(surface);
        }
Example #2
0
        public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info, int sampleCount, GRSurfaceOrigin origin, SKSurfaceProperties props, bool shouldCreateWithMips)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject(SkiaApi.sk_surface_new_render_target(context.Handle, budgeted, &cinfo, sampleCount, origin, props?.Handle ?? IntPtr.Zero, shouldCreateWithMips)));
        }
Example #3
0
        public SKImage ApplyImageFilter(GRRecordingContext context, SKImageFilter filter, SKRectI subset, SKRectI clipBounds, out SKRectI outSubset, out SKPointI outOffset)
        {
            if (filter == null)
                throw new ArgumentNullException(nameof(filter));

            fixed(SKRectI *os = &outSubset)
            fixed(SKPointI * oo = &outOffset)
            {
                return(GetObject(SkiaApi.sk_image_make_with_filter(Handle, context?.Handle ?? IntPtr.Zero, filter.Handle, &subset, &clipBounds, os, oo)));
            }
        }
Example #4
0
        public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (texture == null)
            {
                throw new ArgumentNullException(nameof(texture));
            }

            return(GetObject(SkiaApi.sk_surface_new_backend_texture(context.Handle, texture.Handle, origin, sampleCount, colorType.ToNative(), colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero)));
        }
Example #5
0
        public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (renderTarget == null)
            {
                throw new ArgumentNullException(nameof(renderTarget));
            }

            return(GetObject(SkiaApi.sk_surface_new_backend_render_target(context.Handle, renderTarget.Handle, origin, colorType.ToNative(), colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero)));
        }
Example #6
0
        public static SKImage FromAdoptedTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha, SKColorSpace colorspace)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (texture == null)
            {
                throw new ArgumentNullException(nameof(texture));
            }

            var cs = colorspace == null ? IntPtr.Zero : colorspace.Handle;

            return(GetObject(SkiaApi.sk_image_new_from_adopted_texture(context.Handle, texture.Handle, origin, colorType.ToNative(), alpha, cs)));
        }
Example #7
0
        public static SKImage FromTexture(GRRecordingContext 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(SkiaApi.sk_image_new_from_texture(context.Handle, texture.Handle, origin, colorType.ToNative(), alpha, cs, proxy, (void *)ctx)));
        }
Example #8
0
 public static SKImage FromAdoptedTexture(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType) =>
 FromAdoptedTexture(context, texture, GRSurfaceOrigin.BottomLeft, colorType, SKAlphaType.Premul, null);
Example #9
0
 public static SKImage FromTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 FromTexture(context, texture, origin, colorType, SKAlphaType.Premul, null, null, null);
Example #10
0
 public static SKImage FromTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha, SKColorSpace colorspace, SKImageTextureReleaseDelegate releaseProc) =>
 FromTexture(context, texture, origin, colorType, alpha, colorspace, releaseProc, null);
Example #11
0
 public static SKSurface Create(GRRecordingContext context, MetalKit.MTKView view, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, view, origin, sampleCount, colorType, colorspace, null);
Example #12
0
 public static SKSurface Create(GRRecordingContext context, MetalKit.MTKView view, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props) =>
 GetObject(SkiaApi.sk_surface_new_metal_view(context.Handle, (void *)view.Handle, origin, sampleCount, colorType.ToNative(), colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero));
Example #13
0
 public bool IsValid(GRRecordingContext context) =>
 SkiaApi.sk_image_is_valid(Handle, context?.Handle ?? IntPtr.Zero);
Example #14
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, origin, sampleCount, colorType, null, props);
Example #15
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProperties props) =>
 Create(context, budgeted, info, sampleCount, GRSurfaceOrigin.BottomLeft, props, false);
Example #16
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, renderTarget, origin, colorType, colorspace, null);
Example #17
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info, int sampleCount, GRSurfaceOrigin origin) =>
 Create(context, budgeted, info, sampleCount, origin, null, false);
Example #18
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info) =>
 Create(context, budgeted, info, 0, GRSurfaceOrigin.BottomLeft, null, false);
Example #19
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, texture, origin, sampleCount, colorType, colorspace, null);
Example #20
0
 public static SKImage FromAdoptedTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha) =>
 FromAdoptedTexture(context, texture, origin, colorType, alpha, null);
Example #21
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 Create(context, texture, origin, 0, colorType, null, null);
Example #22
0
 public static SKSurface Create(GRRecordingContext context, CoreAnimation.CAMetalLayer layer, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, out CoreAnimation.ICAMetalDrawable drawable) =>
 Create(context, layer, origin, sampleCount, colorType, colorspace, null, out drawable);
Example #23
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
Example #24
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, SKColorType colorType) =>
 Create(context, renderTarget, GRSurfaceOrigin.BottomLeft, colorType, null, null);
Example #25
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, origin, colorType, null, props);