Пример #1
1
		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);
			}
		}
Пример #2
0
		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);
		}
Пример #3
0
		public SKBitmap (SKImageInfo info, int rowBytes)
			: this ()
		{
			if (!SkiaApi.sk_bitmap_try_alloc_pixels (Handle, ref info, (IntPtr)rowBytes)) {
				throw new Exception (UnableToAllocatePixelsMessage);
			}
		}
Пример #4
0
		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 ();
				}
			}
		}
Пример #5
0
		public extern static void sk_bitmap_get_info(sk_bitmap_t b, out SKImageInfo info);
Пример #6
0
 public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount)
 {
     return(StartScanlineDecode(info, options, colorTable == null ? IntPtr.Zero : colorTable.ReadColors(), ref colorTableCount));
 }
Пример #7
0
		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);
Пример #8
0
		public bool InstallPixels (SKImageInfo info, IntPtr pixels)
		{
			return InstallPixels (info, pixels, info.RowBytes);
		}
Пример #9
0
		public SKBitmap (SKImageInfo info)
			: this (info, info.RowBytes)
		{
		}
Пример #10
0
		public extern static sk_surface_t sk_surface_new_raster(ref SKImageInfo info, IntPtr propsZero);
Пример #11
0
		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;
		}
Пример #12
0
 public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKColorTable colorTable, ref int colorTableCount) =>
 GetPixels(info, pixels, info.RowBytes, SKCodecOptions.Default);
Пример #13
0
        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));
        }
Пример #14
0
 public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, SKCodecOptions options) =>
 GetPixels(info, pixels, info.RowBytes, options);
Пример #15
0
 public SKCodecResult GetPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
 GetPixels(info, pixels, rowBytes, options);
Пример #16
0
 public SKCodecResult GetPixels(SKImageInfo info, out byte[] pixels)
 {
     pixels = new byte[info.BytesSize];
     return(GetPixels(info, pixels));
 }
Пример #17
0
 public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels) =>
 FromPixelCopy(info, pixels, info.RowBytes);
Пример #18
0
 public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes) =>
 ReadPixels(dstInfo, dstPixels, dstRowBytes, 0, 0, SKImageCachingHint.Allow);
Пример #19
0
		public extern static bool sk_bitmap_try_alloc_pixels(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, IntPtr rowBytes);
Пример #20
0
 public SKCodecResult StartIncrementalDecode(SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
 StartIncrementalDecode(info, pixels, rowBytes, options);
Пример #21
0
		public extern static sk_image_t sk_image_new_raster_copy(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
Пример #22
0
        public SKCodecResult StartScanlineDecode(SKImageInfo info)
        {
            var cinfo = SKImageInfoNative.FromManaged(ref info);

            return(SkiaApi.sk_codec_start_scanline_decode(Handle, &cinfo, null));
        }
Пример #23
0
 public static SKImage FromPixelCopy(SKImageInfo info, ReadOnlySpan <byte> pixels) =>
 FromPixelCopy(info, pixels, info.RowBytes);
Пример #24
0
 public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
 StartScanlineDecode(info, options);
Пример #25
0
		public static SKBitmap Decode (string filename, SKImageInfo bitmapInfo)
		{
			if (filename == null) {
				throw new ArgumentNullException (nameof (filename));
			}
			return Decode (new SKFileStream (filename), bitmapInfo);
		}
Пример #26
0
 public bool TryAllocPixels(SKImageInfo info)
 {
     return(TryAllocPixels(info, info.RowBytes));
 }
Пример #27
0
		public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable)
		{
			return InstallPixels (info, pixels, rowBytes, ctable, null, null);
		}
Пример #28
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));
        }
Пример #29
0
        // create a new image from a copy of pixel data

        public static SKImage FromPixelCopy(SKImageInfo info, SKStream pixels) =>
        FromPixelCopy(info, pixels, info.RowBytes);
Пример #30
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));
        }
Пример #31
0
		public extern static SKCodecResult sk_codec_get_pixels_using_defaults(sk_codec_t codec, ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
Пример #32
0
 public bool InstallPixels(SKImageInfo info, IntPtr pixels)
 {
     return(InstallPixels(info, pixels, info.RowBytes, null, null));
 }
Пример #33
0
		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);
Пример #34
0
 public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable)
 {
     return(InstallPixels(info, pixels, rowBytes, null, null));
 }
Пример #35
0
		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);
Пример #36
0
 public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context)
 {
     return(InstallPixels(info, pixels, rowBytes, releaseProc, context));
 }
Пример #37
0
		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);
Пример #38
0
 public bool InstallPixels(SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc)
 {
     return(InstallPixels(info, pixels, rowBytes, releaseProc, null));
 }
Пример #39
0
		public extern static sk_surface_t sk_surface_new_raster(ref SKImageInfo info, ref SKSurfaceProps pros);
Пример #40
0
 public SKBitmap(SKImageInfo info)
     : this(info, info.RowBytes)
 {
 }
Пример #41
0
		public extern static sk_surface_t sk_surface_new_raster_direct(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes, IntPtr propsZero);
Пример #42
0
 public SKBitmap Resize(SKImageInfo info, SKBitmapResizeMethod method) =>
 Resize(info, method.ToFilterQuality());
Пример #43
0
 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);
 }
Пример #44
0
 public SKBitmap(SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags)
     : this(info, SKBitmapAllocFlags.None)
 {
 }
Пример #45
0
		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);
			}
		}
Пример #46
0
 public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable)
 {
     return(FromPixelCopy(info, pixels, rowBytes));
 }
Пример #47
0
		public static SKBitmap Decode (byte[] buffer, SKImageInfo bitmapInfo)
		{
			if (buffer == null) {
				throw new ArgumentNullException (nameof (buffer));
			}
			return Decode (new SKMemoryStream (buffer), bitmapInfo);
		}
Пример #48
0
 public static SKImage FromPixels(SKImageInfo info, SKData data) =>
 FromPixels(info, data, info.RowBytes);
Пример #49
0
		public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes)
		{
			return InstallPixels (info, pixels, rowBytes, null);
		}
Пример #50
0
		public static SKSurface Create (SKImageInfo info, SKSurfaceProps props)
		{
			return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, ref props));
		}
Пример #51
0
		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);
			}
		}
Пример #52
0
		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));
		}
Пример #53
0
 public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY)
 {
     return(ReadPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, SKImageCachingHint.Allow));
 }
Пример #54
0
 public static SKImage FromPixels(SKImageInfo info, IntPtr pixels, int rowBytes)
 {
     using (var pixmap = new SKPixmap(info, pixels, rowBytes)) {
         return(FromPixels(pixmap, null, null));
     }
 }
Пример #55
0
		public static SKSurface Create (SKImageInfo info)
		{
			return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, IntPtr.Zero));
		}
Пример #56
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, ref cinfo, dstPixels, (IntPtr)dstRowBytes, srcX, srcY, cachingHint));
        }
Пример #57
0
		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));
		}
Пример #58
0
 public static SKImage FromPixelCopy(SKImageInfo info, Stream pixels)
 {
     return(FromPixelCopy(info, pixels, info.RowBytes));
 }
Пример #59
0
		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));
		}
Пример #60
0
        public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options)
        {
            int colorTableCount = 0;

            return(StartScanlineDecode(info, options, IntPtr.Zero, ref colorTableCount));
        }