예제 #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));
 }
예제 #2
0
 public static SKImage FromAdoptedTexture(GRContext context, GRBackendTexture texture, SKColorType colorType)
 {
     return(FromAdoptedTexture(context, texture, GRSurfaceOrigin.BottomLeft, colorType, SKAlphaType.Premul, null));
 }
예제 #3
0
 public SKPixmap WithColorType(SKColorType newColorType)
 {
     return(new SKPixmap(Info.WithColorType(newColorType), GetPixels(), RowBytes));
 }
예제 #4
0
 public SKBitmap(int width, int height, SKColorType colorType, SKAlphaType alphaType)
     : this(new SKImageInfo(width, height, colorType, alphaType))
 {
 }
예제 #5
0
 public SKImageInfo(int width, int height)
 {
     this.width = width;
     this.height = height;
     this.colorType = PlatformColorType;
     this.alphaType = SKAlphaType.Premul;
 }
예제 #6
0
 public Bitmap(int width, int height, SKColorType colorType = (SKColorType.Bgra8888))
 {
     nativeSkBitmap = new SKBitmap(new SKImageInfo(width, height, colorType));
     nativeSkBitmap.Erase(SKColor.Empty);
 }
예제 #7
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
 Create(context, texture, origin, 0, colorType, null, null);
예제 #8
0
		public SKBitmap (int width, int height, SKColorType colorType, SKAlphaType alphaType)
			: this (new SKImageInfo (width, height, colorType, alphaType))
		{
		}
예제 #9
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType) =>
 Create((GRRecordingContext)context, texture, origin, sampleCount, colorType);
예제 #10
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create((GRRecordingContext)context, texture, origin, colorType, props);
예제 #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);
예제 #12
0
 public static SKSurface Create(GRContext context, GRBackendTexture texture, SKColorType colorType) =>
 Create((GRRecordingContext)context, texture, colorType);
예제 #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)));
        }
예제 #14
0
		public extern static bool sk_bitmap_can_copy_to(sk_bitmap_t cbitmap, SKColorType ct);
예제 #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);
예제 #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;
		}
예제 #17
0
 public static SKSurface Create(GRRecordingContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, GRSurfaceOrigin.BottomLeft, 0, colorType, null, props);
예제 #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);
예제 #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);
예제 #20
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, renderTarget, origin, colorType, null, props);
예제 #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;
 }
예제 #23
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType) =>
 Create(context, texture, origin, sampleCount, colorType);
예제 #24
0
 public bool CanCopyTo(SKColorType colorType)
 {
     return(SkiaApi.sk_bitmap_can_copy_to(Handle, colorType));
 }
예제 #25
0
 public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
 Create(context, texture, colorType, props);
예제 #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));
 }
예제 #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);
예제 #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)));
        }
예제 #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);
예제 #30
0
		public extern static bool sk_bitmap_copy(sk_bitmap_t cbitmap, sk_bitmap_t dst, SKColorType ct);
예제 #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);
        }
예제 #32
0
		public bool CanCopyTo (SKColorType colorType)
		{
			return SkiaApi.sk_bitmap_can_copy_to (Handle, colorType);
		}
예제 #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);
예제 #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);
		}
예제 #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));
예제 #36
0
		public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, SKSurfaceProps props) => Create (new SKImageInfo (width, height, colorType, alphaType), props);
예제 #37
0
 public static SKSurface Create(int width, int height, SKColorType colorType, SKAlphaType alphaType) => Create(new SKImageInfo(width, height, colorType, alphaType));
예제 #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;
            }
        }
예제 #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);
 }
예제 #40
0
 public SKImageInfo(int width, int height, SKColorType colorType, SKAlphaType alphaType)
 {
     this.width = width;
     this.height = height;
     this.colorType = colorType;
     this.alphaType = alphaType;
 }
예제 #41
0
 public static SKSurface Create(GRRecordingContext context, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, SKColorSpace colorspace) =>
 Create(context, renderTarget, origin, colorType, colorspace, null);