Beispiel #1
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)));
            }
        }
Beispiel #2
0
        public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc, object context)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            if (releaseProc == null)
            {
                return(SkiaApi.sk_bitmap_install_pixels(Handle, ref cinfo, pixels, (IntPtr)rowBytes, IntPtr.Zero, IntPtr.Zero));
            }
            else
            {
                var ctx = new NativeDelegateContext(context, releaseProc);
                return(SkiaApi.sk_bitmap_install_pixels(Handle, ref cinfo, pixels, (IntPtr)rowBytes, releaseDelegate, ctx.NativeContext));
            }
        }
Beispiel #3
0
        public unsafe SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount)
        {
            var nativeOptions = new SKCodecOptionsInternal {
                fZeroInitialized = options.ZeroInitialized,
                fSubset          = null,
                fFrameIndex      = (IntPtr)options.FrameIndex,
                fHasPriorFrame   = options.HasPriorFrame
            };

            if (options.HasSubset)
            {
                var subset = options.Subset.Value;
                nativeOptions.fSubset = &subset;
            }
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_codec_start_scanline_decode(Handle, ref cinfo, ref nativeOptions, colorTable, ref colorTableCount));
        }
Beispiel #4
0
        // scanline (start)

        public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options)
        {
            var nInfo    = SKImageInfoNative.FromManaged(ref info);
            var nOptions = new SKCodecOptionsInternal {
                fZeroInitialized = options.ZeroInitialized,
                fSubset          = null,
                fFrameIndex      = options.FrameIndex,
                fPriorFrame      = options.PriorFrame,
            };
            var subset = default(SKRectI);

            if (options.HasSubset)
            {
                subset           = options.Subset.Value;
                nOptions.fSubset = &subset;
            }

            return(SkiaApi.sk_codec_start_scanline_decode(Handle, &nInfo, &nOptions));
        }
Beispiel #5
0
        public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options)
        {
            if (pixels == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(pixels));
            }

            var nInfo    = SKImageInfoNative.FromManaged(ref info);
            var nOptions = new SKCodecOptionsInternal {
                fZeroInitialized = options.ZeroInitialized,
                fSubset          = null,
                fFrameIndex      = options.FrameIndex,
                fPriorFrame      = options.PriorFrame,
            };
            var subset = default(SKRectI);

            if (options.HasSubset)
            {
                subset           = options.Subset.Value;
                nOptions.fSubset = &subset;
            }
            return(SkiaApi.sk_codec_get_pixels(Handle, &nInfo, (void *)pixels, (IntPtr)rowBytes, &nOptions));
        }
Beispiel #6
0
        public unsafe SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount)
        {
            if (pixels == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(pixels));
            }

            var nativeOptions = new SKCodecOptionsInternal {
                fZeroInitialized = options.ZeroInitialized,
                fSubset          = null,
                fFrameIndex      = (IntPtr)options.FrameIndex,
                fHasPriorFrame   = options.HasPriorFrame
            };

            if (options.HasSubset)
            {
                var subset = options.Subset.Value;
                nativeOptions.fSubset = &subset;
            }
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_codec_start_incremental_decode(Handle, ref cinfo, pixels, (IntPtr)rowBytes, ref nativeOptions, colorTable, ref colorTableCount));
        }
Beispiel #7
0
        public static SKSurface Create(GRContext context, bool budgeted, SKImageInfo info)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_render_target(context.Handle, budgeted, ref cinfo, 0, IntPtr.Zero)));
        }
Beispiel #8
0
        public static SKSurface Create(GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProps props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_render_target(context.Handle, budgeted, ref cinfo, sampleCount, ref props)));
        }
Beispiel #9
0
        public bool TryAllocPixels(SKImageInfo info, SKBitmapAllocFlags flags)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_bitmap_try_alloc_pixels_with_flags(Handle, ref cinfo, flags));
        }
Beispiel #10
0
        public bool TryAllocPixels(SKImageInfo info, int rowBytes)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_bitmap_try_alloc_pixels(Handle, ref cinfo, (IntPtr)rowBytes));
        }
Beispiel #11
0
        public SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_codec_start_incremental_decode(Handle, ref cinfo, pixels, (IntPtr)rowBytes, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
        }
Beispiel #12
0
        public static SKSurface Create(SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceProps props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster_direct(ref cinfo, pixels, (IntPtr)rowBytes, ref props)));
        }
Beispiel #13
0
        public void Reset(SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable = null)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            SkiaApi.sk_pixmap_reset_with_params(Handle, ref cinfo, addr, (IntPtr)rowBytes, ctable == null ? IntPtr.Zero : ctable.Handle);
        }
Beispiel #14
0
        private bool TryAllocPixels(SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags = SKBitmapAllocFlags.None)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_bitmap_try_alloc_pixels_with_color_table(Handle, ref cinfo, ctable != null ? ctable.Handle : IntPtr.Zero, flags));
        }
Beispiel #15
0
        public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref dstInfo);

            return(SkiaApi.sk_surface_read_pixels(Handle, ref cinfo, dstPixels, (IntPtr)dstRowBytes, srcX, srcY));
        }
Beispiel #16
0
        public static SKSurface Create(SKImageInfo info, SKSurfaceProps props)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(GetObject <SKSurface> (SkiaApi.sk_surface_new_raster(ref cinfo, ref props)));
        }
Beispiel #17
0
        public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY, SKTransferFunctionBehavior behavior)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref dstInfo);

            return(SkiaApi.sk_pixmap_read_pixels(Handle, &cinfo, (void *)dstPixels, (IntPtr)dstRowBytes, srcX, srcY, behavior));
        }
Beispiel #18
0
        public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY, SKImageCachingHint cachingHint)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref dstInfo);

            return(SkiaApi.sk_image_read_pixels(Handle, &cinfo, (void *)dstPixels, (IntPtr)dstRowBytes, srcX, srcY, cachingHint));
        }
Beispiel #19
0
        public void Reset(SKImageInfo info, IntPtr addr, int rowBytes)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            SkiaApi.sk_pixmap_reset_with_params(Handle, &cinfo, (void *)addr, (IntPtr)rowBytes);
        }
Beispiel #20
0
        public SKCodecResult StartScanlineDecode(SKImageInfo info)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_codec_start_scanline_decode(Handle, ref cinfo, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
        }
        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)));
        }