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 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 static SKBitmap Decode(SKCodec codec) { var info = codec.Info; // construct a color table for the decode if necessary SKColorTable colorTable = null; int colorCount = 0; if (info.ColorType == SKColorType.Index8) { colorTable = new SKColorTable(); } // read the pixels and color table var bitmap = new SKBitmap(info, colorTable); IntPtr length; var result = codec.GetPixels(info, bitmap.GetPixels(out length), colorTable, ref colorCount); if (result != SKCodecResult.Success && result != SKCodecResult.IncompleteInput) { bitmap.Dispose(); bitmap = null; } return(bitmap); }
public SKPixmap(SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable = null) : this(SkiaApi.sk_pixmap_new_with_params(ref info, addr, (IntPtr)rowBytes, ctable == null ? IntPtr.Zero : ctable.Handle), true) { if (Handle == IntPtr.Zero) { throw new InvalidOperationException(UnableToCreateInstanceMessage); } }
public SKBitmap(SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags) : this() { if (!TryAllocPixels(info, ctable, flags)) { throw new Exception(UnableToAllocatePixelsMessage); } }
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 SKBitmap(SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags) : this() { var cinfo = SKImageInfoNative.FromManaged(ref info); if (!SkiaApi.sk_bitmap_try_alloc_pixels_with_color_table(Handle, ref cinfo, ctable != null ? ctable.Handle : IntPtr.Zero, flags)) { throw new Exception(UnableToAllocatePixelsMessage); } }
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 ctx = new NativeDelegateContext(context, releaseProc); return(SkiaApi.sk_bitmap_install_pixels(Handle, ref info, pixels, (IntPtr)rowBytes, ct, releaseDelegate, ctx.NativeContext)); } }
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 void SetColorTable(SKColorTable ct) { // no-op due to unsupperted action }
public SKBitmap(SKImageInfo info, SKColorTable ctable) : this(info, SKBitmapAllocFlags.None) { }
public void SetPixels(IntPtr pixels, SKColorTable ct) { SetPixels(pixels); }
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, SKColorTable colorTable, ref int colorTableCount) { return GetPixels (info, pixels, info.RowBytes, SKCodecOptions.Default, colorTable, ref colorTableCount); }
public void SetPixels(IntPtr pixels, SKColorTable ct) { SkiaApi.sk_bitmap_set_pixels (Handle, pixels, ct != null ? ct.Handle : IntPtr.Zero); }
public unsafe SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return StartIncrementalDecode (info, pixels, rowBytes, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors (), ref colorTableCount); }
public void SetPixels(IntPtr pixels, SKColorTable ct) { SkiaApi.sk_bitmap_set_pixels(Handle, pixels, ct != null ? ct.Handle : IntPtr.Zero); }
public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { if (pixels == IntPtr.Zero) { throw new ArgumentNullException(nameof(pixels)); } var ct = (ctable == null ? IntPtr.Zero : ctable.Handle); var cinfo = SKImageInfoNative.FromManaged(ref info); var handle = SkiaApi.sk_image_new_raster_copy_with_colortable(ref cinfo, pixels, (IntPtr)rowBytes, ct); return(GetObject <SKImage> (handle)); }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(GetPixels(info, pixels, rowBytes, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors(), ref colorTableCount)); }
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 SKPixmap(SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable) : this(info, addr, info.RowBytes) { }
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { return InstallPixels (info, pixels, rowBytes, ctable, null, null); }
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 void SetColorTable(SKColorTable ct) { SetPixels (GetPixels (), ct); }
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context) { return(InstallPixels(info, pixels, rowBytes, releaseProc, context)); }
public unsafe SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(StartIncrementalDecode(info, pixels, rowBytes, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors(), ref colorTableCount)); }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) => GetPixels(info, pixels, info.RowBytes, options);
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return GetPixels (info, pixels, rowBytes, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors (), ref colorTableCount); }
public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) => FromPixelCopy(info, pixels, rowBytes);
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)); }
public void SetColorTable(SKColorTable ct) { SetPixels(GetPixels(), ct); }
public void Reset(SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable = null) { SkiaApi.sk_pixmap_reset_with_params(Handle, ref info, addr, (IntPtr)rowBytes, ctable == null ? IntPtr.Zero : ctable.Handle); }
public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) { return(InstallPixels(info, pixels, rowBytes, ctable, null, null)); }
public void Reset(SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable) { Reset(info, addr, rowBytes); }
public SKBitmap(SKImageInfo info, SKColorTable ctable) : this(info, ctable, 0) { }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(GetPixels(info, pixels, rowBytes, options)); }
public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKColorTable colorTable, ref int colorTableCount) { return(GetPixels(info, pixels, info.RowBytes, SKCodecOptions.Default, colorTable, ref colorTableCount)); }
public SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(StartIncrementalDecode(info, pixels, rowBytes, options)); }
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 SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) { return(StartScanlineDecode(info, options)); }