Пример #1
0
 public static SKSurface Create(SKPixmap pixmap, SKSurfaceProperties props)
 {
     if (pixmap == null)
     {
         throw new ArgumentNullException(nameof(pixmap));
     }
     return(Create(pixmap.Info, pixmap.GetPixels(), pixmap.RowBytes, null, null, props));
 }
Пример #2
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, origin, 0, colorType, null, props);
Пример #3
0
        public static SKSurface Create(GRContext 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 <SKSurface> (SkiaApi.sk_surface_new_backend_render_target(context.Handle, renderTarget.Handle, origin, colorType, colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero)));
        }
Пример #4
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, GRSurfaceOrigin.BottomLeft, colorType, null, props);
Пример #5
0
 public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceProperties props) =>
 Create(info, pixels, rowBytes, null, null, props);
Пример #6
0
        public static SKSurface Create(SKImageInfo info, int rowBytes, SKSurfaceProperties props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster(ref cinfo, (IntPtr)rowBytes, props?.Handle ?? IntPtr.Zero)));
        }
Пример #7
0
        public static SKSurface Create(GRContext 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 <SKSurface> (SkiaApi.sk_surface_new_render_target(context.Handle, budgeted, ref cinfo, sampleCount, origin, props?.Handle ?? IntPtr.Zero, shouldCreateWithMips)));
        }
Пример #8
0
        public static SKSurface CreateAsRenderTarget(GRContext 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 <SKSurface> (SkiaApi.sk_surface_new_backend_texture_as_render_target(context.Handle, texture.Handle, origin, sampleCount, colorType, colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero)));
        }
Пример #9
0
 public static SKSurface Create(GRContext context, CoreAnimation.CAMetalLayer layer, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props, out CoreAnimation.ICAMetalDrawable drawable) =>
 Create((GRRecordingContext)context, layer, origin, sampleCount, colorType, colorspace, props, out drawable);
Пример #10
0
 public static SKSurface Create(GRRecordingContext context, bool budgeted, SKImageInfo info, SKSurfaceProperties props) =>
 Create(context, budgeted, info, 0, GRSurfaceOrigin.BottomLeft, props, false);
Пример #11
0
 public static SKSurface Create(GRContext context, bool budgeted, SKImageInfo info, int sampleCount, GRSurfaceOrigin origin, SKSurfaceProperties props, bool shouldCreateWithMips) =>
 Create((GRRecordingContext)context, budgeted, info, sampleCount, origin, props, false);
Пример #12
0
 public static SKSurface Create(GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, budgeted, info, sampleCount, props);
Пример #13
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
Пример #14
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, texture, origin, sampleCount, colorType, colorspace, props);
Пример #15
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, texture, colorType, props);
Пример #16
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 CreateAsRenderTarget(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
Пример #17
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKSurfaceProperties props) =>
 CreateAsRenderTarget(context, texture, origin, sampleCount, colorType, null, props);
Пример #18
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));
Пример #19
0
 public static SKSurface Create(GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProperties props) =>
 Create(context, budgeted, info, sampleCount, GRSurfaceOrigin.BottomLeft, props, false);
Пример #20
0
        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)));
            }
        }
Пример #21
0
 public static SKSurface Create(SKImageInfo info, SKSurfaceProperties props) =>
 Create(info, 0, props);
Пример #22
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, colorType, props);
Пример #23
0
        public static SKSurface Create(GRContext 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);
        }
Пример #24
0
 public static SKSurface Create(GRContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, origin, colorType, null, props);
Пример #25
0
        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)));
        }
Пример #26
0
 public static SKSurface Create(GRContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, renderTarget, origin, colorType, colorspace, props);