コード例 #1
1
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKCodec.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		public extern static void sk_bitmap_get_info(sk_bitmap_t b, out SKImageInfo info);
コード例 #6
0
ファイル: SKCodec.cs プロジェクト: mfalk118/SkiaSharp
 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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		public bool InstallPixels (SKImageInfo info, IntPtr pixels)
		{
			return InstallPixels (info, pixels, info.RowBytes);
		}
コード例 #9
0
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		public SKBitmap (SKImageInfo info)
			: this (info, info.RowBytes)
		{
		}
コード例 #10
0
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		public extern static sk_surface_t sk_surface_new_raster(ref SKImageInfo info, IntPtr propsZero);
コード例 #11
0
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
 public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels) =>
 FromPixelCopy(info, pixels, info.RowBytes);
コード例 #18
0
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
 public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes) =>
 ReadPixels(dstInfo, dstPixels, dstRowBytes, 0, 0, SKImageCachingHint.Allow);
コード例 #19
0
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
 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
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
        // 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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SkiaApi.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: Core2D/SkiaSharp
 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
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKImage.cs プロジェクト: superowner/SkiaSharp
 public static SKImage FromPixelCopy(SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable)
 {
     return(FromPixelCopy(info, pixels, rowBytes));
 }
コード例 #47
0
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		public static SKBitmap Decode (byte[] buffer, SKImageInfo bitmapInfo)
		{
			if (buffer == null) {
				throw new ArgumentNullException (nameof (buffer));
			}
			return Decode (new SKMemoryStream (buffer), bitmapInfo);
		}
コード例 #48
0
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
 public static SKImage FromPixels(SKImageInfo info, SKData data) =>
 FromPixels(info, data, info.RowBytes);
コード例 #49
0
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes)
		{
			return InstallPixels (info, pixels, rowBytes, null);
		}
コード例 #50
0
ファイル: SKSurface.cs プロジェクト: Core2D/SkiaSharp
		public static SKSurface Create (SKImageInfo info, SKSurfaceProps props)
		{
			return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, ref props));
		}
コード例 #51
0
ファイル: SKBitmap.cs プロジェクト: prepare/HTML-Renderer
		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
ファイル: SKSurface.cs プロジェクト: Core2D/SkiaSharp
		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
ファイル: SKImage.cs プロジェクト: superowner/SkiaSharp
 public bool ReadPixels(SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY)
 {
     return(ReadPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY, SKImageCachingHint.Allow));
 }
コード例 #54
0
ファイル: SKImage.cs プロジェクト: Cricle/SkiaSharp
 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
ファイル: SKSurface.cs プロジェクト: Core2D/SkiaSharp
		public static SKSurface Create (SKImageInfo info)
		{
			return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster (ref info, IntPtr.Zero));
		}
コード例 #56
0
ファイル: SKImage.cs プロジェクト: superowner/SkiaSharp
        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
ファイル: SKSurface.cs プロジェクト: Core2D/SkiaSharp
		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
ファイル: SKImage.cs プロジェクト: superowner/SkiaSharp
 public static SKImage FromPixelCopy(SKImageInfo info, Stream pixels)
 {
     return(FromPixelCopy(info, pixels, info.RowBytes));
 }
コード例 #59
0
ファイル: SKSurface.cs プロジェクト: Core2D/SkiaSharp
		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
ファイル: SKCodec.cs プロジェクト: mfalk118/SkiaSharp
        public SKCodecResult StartScanlineDecode(SKImageInfo info, SKCodecOptions options)
        {
            int colorTableCount = 0;

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