Exemplo n.º 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)));
            }
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 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));
        }
Exemplo n.º 10
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));
        }
Exemplo n.º 11
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)));
        }
Exemplo n.º 12
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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 19
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)));
        }
Exemplo n.º 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));
        }
Exemplo n.º 21
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));
        }