public SKBitmap (SKImageInfo info, SKColorTable ctable) : this () { if (!SkiaApi.sk_bitmap_try_alloc_pixels_with_color_table (Handle, ref info, IntPtr.Zero, ctable != null ? ctable.Handle : IntPtr.Zero)) { throw new Exception (UnableToAllocatePixelsMessage); } }
public static SKImage FromPixels (SKImageInfo info, IntPtr pixels, int rowBytes) { if (pixels == IntPtr.Zero) throw new ArgumentNullException (nameof (pixels)); var handle = SkiaApi.sk_image_new_raster_copy (ref info, pixels, (IntPtr) rowBytes); return GetObject<SKImage> (handle); }
public SKBitmap (SKImageInfo info, int rowBytes) : this () { if (!SkiaApi.sk_bitmap_try_alloc_pixels (Handle, ref info, (IntPtr)rowBytes)) { throw new Exception (UnableToAllocatePixelsMessage); } }
public SKCodecResult GetPixels (SKImageInfo info, byte[] pixels) { if (pixels == null) throw new ArgumentNullException (nameof (pixels)); GCHandle handle = default (GCHandle); try { handle = GCHandle.Alloc (pixels, GCHandleType.Pinned); return GetPixels (info, handle.AddrOfPinnedObject ()); } finally { if (handle.IsAllocated) { handle.Free (); } } }
public extern static void sk_bitmap_get_info(sk_bitmap_t b, out SKImageInfo info);
public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(StartScanlineDecode(info, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors(), ref colorTableCount)); }
public extern static SKCodecResult sk_codec_start_incremental_decode(sk_codec_t codec, ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes, ref SKCodecOptionsInternal options, IntPtr ctable, ref int ctableCount);
public bool InstallPixels (SKImageInfo info, IntPtr pixels) { return InstallPixels (info, pixels, info.RowBytes); }
public SKBitmap (SKImageInfo info) : this (info, info.RowBytes) { }
public extern static sk_surface_t sk_surface_new_raster(ref SKImageInfo info, IntPtr propsZero);
public static SKBitmap Decode (SKCodec codec, SKImageInfo bitmapInfo) { if (codec == null) { throw new ArgumentNullException (nameof (codec)); } // construct a color table for the decode if necessary SKColorTable colorTable = null; int colorCount = 0; if (bitmapInfo.ColorType == SKColorType.Index8) { colorTable = new SKColorTable (); } // read the pixels and color table var bitmap = new SKBitmap (bitmapInfo, colorTable); IntPtr length; var result = codec.GetPixels (bitmapInfo, bitmap.GetPixels (out length), colorTable, ref colorCount); if (result != SKCodecResult.Success && result != SKCodecResult.IncompleteInput) { bitmap.Dispose (); bitmap = null; } return bitmap; }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKColorTable colorTable, ref int colorTableCount) => GetPixels(info, pixels, info.RowBytes, SKCodecOptions.Default);
public SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes) { var cinfo = SKImageInfoNative.FromManaged(ref info); return(SkiaApi.sk_codec_start_incremental_decode(Handle, &cinfo, (void *)pixels, (IntPtr)rowBytes, null)); }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKCodecOptions options) => GetPixels(info, pixels, info.RowBytes, options);
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) => GetPixels(info, pixels, rowBytes, options);
public SKCodecResult GetPixels(SKImageInfo info, out byte[] pixels) { pixels = new byte[info.BytesSize]; return(GetPixels(info, pixels)); }
public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels) => FromPixelCopy(info, pixels, info.RowBytes);
public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes) => ReadPixels(dstInfo, dstPixels, dstRowBytes, 0, 0, SKImageCachingHint.Allow);
public extern static bool sk_bitmap_try_alloc_pixels(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, IntPtr rowBytes);
public SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) => StartIncrementalDecode(info, pixels, rowBytes, options);
public extern static sk_image_t sk_image_new_raster_copy(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
public SKCodecResult StartScanlineDecode(SKImageInfo info) { var cinfo = SKImageInfoNative.FromManaged(ref info); return(SkiaApi.sk_codec_start_scanline_decode(Handle, &cinfo, null)); }
public static SKImage FromPixelCopy(SKImageInfo info, ReadOnlySpan <byte> pixels) => FromPixelCopy(info, pixels, info.RowBytes);
public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) => StartScanlineDecode(info, options);
public static SKBitmap Decode (string filename, SKImageInfo bitmapInfo) { if (filename == null) { throw new ArgumentNullException (nameof (filename)); } return Decode (new SKFileStream (filename), bitmapInfo); }
public bool TryAllocPixels(SKImageInfo info) { return(TryAllocPixels(info, info.RowBytes)); }
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { return InstallPixels (info, pixels, rowBytes, ctable, null, null); }
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)); }
// create a new image from a copy of pixel data public static SKImage FromPixelCopy(SKImageInfo info, SKStream pixels) => FromPixelCopy(info, pixels, info.RowBytes);
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)); }
public extern static SKCodecResult sk_codec_get_pixels_using_defaults(sk_codec_t codec, ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
public bool InstallPixels(SKImageInfo info, IntPtr pixels) { return(InstallPixels(info, pixels, info.RowBytes, null, null)); }
public extern static SKCodecResult sk_codec_start_incremental_decode(sk_codec_t codec, ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes, IntPtr optionsZero, IntPtr ctableZero, IntPtr ctableCountZero);
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { return(InstallPixels(info, pixels, rowBytes, null, null)); }
public extern static bool sk_bitmap_install_pixels(sk_bitmap_t cbitmap, ref SKImageInfo cinfo, IntPtr pixels, IntPtr rowBytes, sk_colortable_t ctable, IntPtr releaseProc, IntPtr context);
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context) { return(InstallPixels(info, pixels, rowBytes, releaseProc, context)); }
public extern static bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, sk_pixelref_factory_t factory, sk_colortable_t ctable);
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc) { return(InstallPixels(info, pixels, rowBytes, releaseProc, null)); }
public extern static sk_surface_t sk_surface_new_raster(ref SKImageInfo info, ref SKSurfaceProps pros);
public SKBitmap(SKImageInfo info) : this(info, info.RowBytes) { }
public extern static sk_surface_t sk_surface_new_raster_direct(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes, IntPtr propsZero);
public SKBitmap Resize(SKImageInfo info, SKBitmapResizeMethod method) => Resize(info, method.ToFilterQuality());
public static SKImage FromPixels(SKImageInfo info, IntPtr pixels, int rowBytes) { var handle = SkiaApi.sk_image_new_raster_copy (ref info, pixels, (IntPtr) rowBytes); return GetObject<SKImage> (handle); }
public SKBitmap(SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags) : this(info, SKBitmapAllocFlags.None) { }
public static SKBitmap Decode (SKData data, SKImageInfo bitmapInfo) { if (data == null) { throw new ArgumentNullException (nameof (data)); } using (var codec = SKCodec.Create (data)) { return Decode (codec, bitmapInfo); } }
public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { return(FromPixelCopy(info, pixels, rowBytes)); }
public static SKBitmap Decode (byte[] buffer, SKImageInfo bitmapInfo) { if (buffer == null) { throw new ArgumentNullException (nameof (buffer)); } return Decode (new SKMemoryStream (buffer), bitmapInfo); }
public static SKImage FromPixels(SKImageInfo info, SKData data) => FromPixels(info, data, info.RowBytes);
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes) { return InstallPixels (info, pixels, rowBytes, null); }
public static SKSurface Create (SKImageInfo info, SKSurfaceProps props) { return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, ref props)); }
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context) { IntPtr ct = ctable == null ? IntPtr.Zero : ctable.Handle; if (releaseProc == null) { return SkiaApi.sk_bitmap_install_pixels (Handle, ref info, pixels, (IntPtr)rowBytes, ct, IntPtr.Zero, IntPtr.Zero); } else { var del = Marshal.GetFunctionPointerForDelegate (releaseDelegate); var ctx = new SKBitmapReleaseDelegateContext (releaseProc, context); var ctxPtr = ctx.Wrap (); return SkiaApi.sk_bitmap_install_pixels (Handle, ref info, pixels, (IntPtr)rowBytes, ct, del, ctxPtr); } }
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProps props) { return GetObject<SKSurface> (SkiaApi.sk_surface_new_render_target (context.Handle, budgeted, ref info, sampleCount, ref props)); }
public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY) { return(ReadPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, SKImageCachingHint.Allow)); }
public static SKImage FromPixels(SKImageInfo info, IntPtr pixels, int rowBytes) { using (var pixmap = new SKPixmap(info, pixels, rowBytes)) { return(FromPixels(pixmap, null, null)); } }
public static SKSurface Create (SKImageInfo info) { return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, IntPtr.Zero)); }
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, ref cinfo, dstPixels, (IntPtr)dstRowBytes, srcX, srcY, cachingHint)); }
public static SKSurface Create (SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceProps props) { return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster_direct (ref info, pixels, (IntPtr)rowBytes, ref props)); }
public static SKImage FromPixelCopy(SKImageInfo info, Stream pixels) { return(FromPixelCopy(info, pixels, info.RowBytes)); }
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info) { return GetObject<SKSurface> (SkiaApi.sk_surface_new_render_target (context.Handle, budgeted, ref info, 0, IntPtr.Zero)); }
public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options) { int colorTableCount = 0; return(StartScanlineDecode(info, options, IntPtr.Zero, ref colorTableCount)); }