Ejemplo n.º 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);
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
            }
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 8
0
 public static SKImage FromAdoptedTexture(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType) =>
 FromAdoptedTexture(context, texture, GRSurfaceOrigin.BottomLeft, colorType, SKAlphaType.Premul, null);
Ejemplo n.º 9
0
 public static SKImage FromTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 FromTexture(context, texture, origin, colorType, SKAlphaType.Premul, null, null, null);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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));
Ejemplo n.º 13
0
 public bool IsValid(GRRecordingContext context) =>
 SkiaApi.sk_image_is_valid(Handle, context?.Handle ?? IntPtr.Zero);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 16
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, renderTarget, origin, colorType, colorspace, null);
Ejemplo n.º 17
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info, int sampleCount, GRSurfaceOrigin origin) =>
 Create(context, budgeted, info, sampleCount, origin, null, false);
Ejemplo n.º 18
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info) =>
 Create(context, budgeted, info, 0, GRSurfaceOrigin.BottomLeft, null, false);
Ejemplo n.º 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);
Ejemplo n.º 20
0
 public static SKImage FromAdoptedTexture(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha) =>
 FromAdoptedTexture(context, texture, origin, colorType, alpha, null);
Ejemplo n.º 21
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 Create(context, texture, origin, 0, colorType, null, null);
Ejemplo n.º 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);
Ejemplo n.º 23
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
Ejemplo n.º 24
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, SKColorType colorType) =>
 Create(context, renderTarget, GRSurfaceOrigin.BottomLeft, colorType, null, null);
Ejemplo n.º 25
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, origin, colorType, null, props);