Exemplo n.º 1
0
 public static SKImage FromTexture(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha, SKColorSpace colorspace, SKImageTextureReleaseDelegate releaseProc)
 {
     return(FromTexture(context, texture, origin, colorType, alpha, colorspace, releaseProc, null));
 }
Exemplo n.º 2
0
 public static SKImage FromAdoptedTexture(GRContext context, GRBackendTexture texture, SKColorType colorType)
 {
     return(FromAdoptedTexture(context, texture, GRSurfaceOrigin.BottomLeft, colorType, SKAlphaType.Premul, null));
 }
Exemplo n.º 3
0
 public SKPixmap WithColorType(SKColorType newColorType)
 {
     return(new SKPixmap(Info.WithColorType(newColorType), GetPixels(), RowBytes));
 }
Exemplo n.º 4
0
 public SKBitmap(int width, int height, SKColorType colorType, SKAlphaType alphaType)
     : this(new SKImageInfo(width, height, colorType, alphaType))
 {
 }
Exemplo n.º 5
0
 public SKImageInfo(int width, int height)
 {
     this.width = width;
     this.height = height;
     this.colorType = PlatformColorType;
     this.alphaType = SKAlphaType.Premul;
 }
Exemplo n.º 6
0
 public Bitmap(int width, int height, SKColorType colorType = (SKColorType.Bgra8888))
 {
     nativeSkBitmap = new SKBitmap(new SKImageInfo(width, height, colorType));
     nativeSkBitmap.Erase(SKColor.Empty);
 }
Exemplo n.º 7
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 Create(context, texture, origin, 0, colorType, null, null);
Exemplo n.º 8
0
		public SKBitmap (int width, int height, SKColorType colorType, SKAlphaType alphaType)
			: this (new SKImageInfo (width, height, colorType, alphaType))
		{
		}
Exemplo n.º 9
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType) =>
 Create((GRRecordingContext)context, texture, origin, sampleCount, colorType);
Exemplo n.º 10
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, texture, origin, colorType, props);
Exemplo n.º 11
0
 public static SKSurface Create(int width, int height, SKColorType colorType, SKAlphaType alphaType, IntPtr pixels, int rowBytes, SKSurfaceProps props) => Create(new SKImageInfo(width, height, colorType, alphaType), pixels, rowBytes, props);
Exemplo n.º 12
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, SKColorType colorType) =>
 Create((GRRecordingContext)context, texture, colorType);
Exemplo n.º 13
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)));
        }
Exemplo n.º 14
0
		public extern static bool sk_bitmap_can_copy_to(sk_bitmap_t cbitmap, SKColorType ct);
Exemplo n.º 15
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);
Exemplo n.º 16
0
		public SKBitmap Copy (SKColorType colorType)
		{
			var destination = new SKBitmap ();
			if (!SkiaApi.sk_bitmap_copy (Handle, destination.Handle, colorType)) {
				destination.Dispose ();
				destination = null;
			}
			return destination;
		}
Exemplo n.º 17
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
Exemplo n.º 18
0
		public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, IntPtr pixels, int rowBytes, SKSurfaceProps props) => Create (new SKImageInfo (width, height, colorType, alphaType), pixels, rowBytes, props);
Exemplo n.º 19
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);
Exemplo n.º 20
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, origin, colorType, null, props);
Exemplo n.º 21
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)));
        }
 public SKPaintMetalSurfaceEventArgs(SKSurface surface, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType)
 {
     Surface             = surface;
     BackendRenderTarget = renderTarget;
     ColorType           = colorType;
     Origin = origin;
 }
Exemplo n.º 23
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType) =>
 Create(context, texture, origin, sampleCount, colorType);
Exemplo n.º 24
0
 public bool CanCopyTo(SKColorType colorType)
 {
     return(SkiaApi.sk_bitmap_can_copy_to(Handle, colorType));
 }
Exemplo n.º 25
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, colorType, props);
Exemplo n.º 26
0
 public static SKImage FromTexture(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKAlphaType alpha, SKColorSpace colorspace)
 {
     return(FromTexture(context, texture, origin, colorType, alpha, colorspace, null, null));
 }
Exemplo n.º 27
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props) =>
 Create(context, texture, origin, sampleCount, colorType, colorspace, props);
Exemplo n.º 28
0
        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(SkiaApi.sk_image_new_from_texture(context.Handle, texture.Handle, origin, colorType, alpha, cs, proxy, (void *)ctx)));
        }
Exemplo n.º 29
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);
Exemplo n.º 30
0
		public extern static bool sk_bitmap_copy(sk_bitmap_t cbitmap, sk_bitmap_t dst, SKColorType ct);
Exemplo n.º 31
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);
        }
Exemplo n.º 32
0
		public bool CanCopyTo (SKColorType colorType)
		{
			return SkiaApi.sk_bitmap_can_copy_to (Handle, colorType);
		}
Exemplo n.º 33
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);
Exemplo n.º 34
0
		public bool CopyTo (SKBitmap destination, SKColorType colorType)
		{
			if (destination == null) {
				throw new ArgumentNullException (nameof (destination));
			}
			return SkiaApi.sk_bitmap_copy (Handle, destination.Handle, colorType);
		}
Exemplo n.º 35
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));
Exemplo n.º 36
0
		public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, SKSurfaceProps props) => Create (new SKImageInfo (width, height, colorType, alphaType), props);
Exemplo n.º 37
0
 public static SKSurface Create(int width, int height, SKColorType colorType, SKAlphaType alphaType) => Create(new SKImageInfo(width, height, colorType, alphaType));
Exemplo n.º 38
0
        static SKImageInfo()
        {
#if WINDOWS_UWP
			var isUnix = false;
#else
            var isUnix = Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix;
#endif
            if (isUnix)
            {
                // Unix depends on the CPU endianess, but we use RGBA
                PlatformColorType = SKColorType.Rgba8888;
            }
            else
            {
                // Windows is always BGRA
                PlatformColorType = SKColorType.Bgra8888;
            }
        }
Exemplo n.º 39
0
 public Bitmap(int width, int height, int stride, SKColorType bgra8888 = (SKColorType.Bgra8888),
               IntPtr data = default(IntPtr))
 {
     nativeSkBitmap = new SKBitmap(new SKImageInfo(width, height, bgra8888));
     nativeSkBitmap.SetPixels(data);
 }
Exemplo n.º 40
0
 public SKImageInfo(int width, int height, SKColorType colorType, SKAlphaType alphaType)
 {
     this.width = width;
     this.height = height;
     this.colorType = colorType;
     this.alphaType = alphaType;
 }
Exemplo n.º 41
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, renderTarget, origin, colorType, colorspace, null);