Inheritance: SKObject
コード例 #1
0
ファイル: SKImageRenderer.cs プロジェクト: user20112/SNPAPP
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     if (e.PropertyName == "SKImageSource")
     {
         SkiaSharp.SKImage Temp = (Element as ResumeApp.CustomElements.SKImage).SKImageSource;
         if (Temp != null)
         {
             if (counter++ == 10)
             {
                 Task.Run(() =>
                 {
                     GC.Collect();
                     counter = 0;
                 });
             }
             ThisImage = AndroidExtensions.ToBitmap(SKBitmap.FromImage(Temp));
             if (ThisImage != null)
             {
                 Xamarin.Essentials.MainThread.BeginInvokeOnMainThread(() =>
                 {
                     Control.SetImageBitmap(ThisImage);
                     Control.Invalidate();
                 });
             }
             else
             {
             }
         }
     }
 }
コード例 #2
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
        // Draw*NinePatch

        public void DrawBitmapNinePatch(SKBitmap bitmap, SKRectI center, SKRect dst, SKPaint paint = null)
        {
            using var image = SKImage.FromBitmap(bitmap);
            DrawImageNinePatch(image, center, dst, paint);
        }
コード例 #3
0
		// CreateImage

		public static SKImageFilter CreateImage(SKImage image)
		{
			if (image == null)
				throw new ArgumentNullException(nameof(image));
			return GetObject<SKImageFilter>(SkiaApi.sk_imagefilter_new_image_source_default(image.Handle));
		}
コード例 #4
0
        // DrawImage

        public void DrawImage(SKImage image, SKPoint p, SKPaint paint = null)
        {
            DrawImage(image, p.X, p.Y, paint);
        }
コード例 #5
0
ファイル: SKSurface.cs プロジェクト: tonymkenu/SkiaSharp
 public SKImage Snapshot() =>
 SKImage.GetObject(SkiaApi.sk_surface_new_image_snapshot(Handle));
コード例 #6
0
ファイル: SKSurface.cs プロジェクト: tonymkenu/SkiaSharp
 public SKImage Snapshot(SKRectI bounds) =>
 SKImage.GetObject(SkiaApi.sk_surface_new_image_snapshot_with_crop(Handle, &bounds));
コード例 #7
0
		public static SKImageFilter CreateImage(SKImage image, SKRect src, SKRect dst, SKFilterQuality filterQuality)
		{
			if (image == null)
				throw new ArgumentNullException(nameof(image));
			return GetObject<SKImageFilter>(SkiaApi.sk_imagefilter_new_image_source(image.Handle, &src, &dst, filterQuality));
		}
コード例 #8
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
        // Draw*Lattice

        public void DrawBitmapLattice(SKBitmap bitmap, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
        {
            using var image = SKImage.FromBitmap(bitmap);
            DrawImageLattice(image, xDivs, yDivs, dst, paint);
        }
コード例 #9
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
 public void DrawBitmap(SKBitmap bitmap, float x, float y, SKPaint paint = null)
 {
     using var image = SKImage.FromBitmap(bitmap);
     DrawImage(image, x, y, paint);
 }
コード例 #10
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
 public void DrawBitmap(SKBitmap bitmap, SKRect source, SKRect dest, SKPaint paint = null)
 {
     using var image = SKImage.FromBitmap(bitmap);
     DrawImage(image, source, dest, paint);
 }
コード例 #11
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
 public void DrawAtlas(SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKRect cullRect, SKPaint paint) =>
 DrawAtlas(atlas, sprites, transforms, colors, mode, &cullRect, paint);
コード例 #12
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
        // DrawAtlas

        public void DrawAtlas(SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKPaint paint) =>
        DrawAtlas(atlas, sprites, transforms, null, SKBlendMode.Dst, null, paint);
コード例 #13
0
ファイル: SKCanvas.cs プロジェクト: ricardoromaobr/SkiaSharp
 public void DrawBitmapLattice(SKBitmap bitmap, SKLattice lattice, SKRect dst, SKPaint paint = null)
 {
     using var image = SKImage.FromBitmap(bitmap);
     DrawImageLattice(image, lattice, dst, paint);
 }
コード例 #14
0
ファイル: SKCanvas.cs プロジェクト: Core2D/SkiaSharp
        public void DrawImageLattice(SKImage image, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
        {
            if (image == null)
                throw new ArgumentNullException (nameof (image));
            if (xDivs == null)
                throw new ArgumentNullException (nameof (xDivs));
            if (yDivs == null)
                throw new ArgumentNullException (nameof (yDivs));

            SkiaApi.sk_canvas_draw_image_lattice (Handle, image.Handle, xDivs, xDivs.Length, yDivs, yDivs.Length, ref dst, paint == null ? IntPtr.Zero : paint.Handle);
        }
コード例 #15
0
		// CreateImage

		public static SKShader CreateImage (SKImage src) =>
			CreateImage (src, SKShaderTileMode.Clamp, SKShaderTileMode.Clamp);
コード例 #16
-1
ファイル: SKCanvas.cs プロジェクト: Core2D/SkiaSharp
 public void DrawImage(SKImage image, SKRect source, SKRect dest, SKPaint paint = null)
 {
     if (image == null)
         throw new ArgumentNullException (nameof (image));
     SkiaApi.sk_canvas_draw_image_rect (Handle, image.Handle, ref source, ref dest, paint == null ? IntPtr.Zero : paint.Handle);
 }
コード例 #17
-1
ファイル: SKCanvas.cs プロジェクト: Core2D/SkiaSharp
 public void DrawImage(SKImage image, float x, float y, SKPaint paint = null)
 {
     if (image == null)
         throw new ArgumentNullException (nameof (image));
     SkiaApi.sk_canvas_draw_image (Handle, image.Handle, x, y, paint == null ? IntPtr.Zero : paint.Handle);
 }
コード例 #18
-1
ファイル: SKCanvas.cs プロジェクト: prepare/HTML-Renderer
		public void DrawImageLattice (SKImage image, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
		{
			var lattice = new SKLattice {
				Bounds = null,
				Flags = null,
				XDivs = xDivs,
				YDivs = yDivs
			};
			DrawImageLattice (image, lattice, dst, paint);
		}
コード例 #19
-1
ファイル: SKCanvas.cs プロジェクト: Core2D/SkiaSharp
        public void DrawImageNinePatch(SKImage image, SKRectI center, SKRect dst, SKPaint paint = null)
        {
            if (image == null)
                throw new ArgumentNullException (nameof (image));
            // the "center" rect must fit inside the image "rect"
            if (!SKRect.Create (image.Width, image.Height).Contains (center))
                throw new ArgumentOutOfRangeException (nameof (center));

            var xDivs = new [] { center.Left, center.Right };
            var yDivs = new [] { center.Top, center.Bottom };
            DrawImageLattice (image, xDivs, yDivs, dst, paint);
        }
コード例 #20
-1
ファイル: SKCanvas.cs プロジェクト: prepare/HTML-Renderer
		public unsafe void DrawImageLattice (SKImage image, SKLattice lattice, SKRect dst, SKPaint paint = null)
		{
			if (image == null)
				throw new ArgumentNullException (nameof (image));
			if (lattice.XDivs == null)
				throw new ArgumentNullException (nameof (lattice.XDivs));
			if (lattice.YDivs == null)
				throw new ArgumentNullException (nameof (lattice.YDivs));
			
			fixed (int* x = lattice.XDivs)
			fixed (int* y = lattice.YDivs)
			fixed (SKLatticeFlags* f = lattice.Flags) {
				var nativeLattice = new SKLatticeInternal {
					fBounds = null,
					fFlags = f,
					fXCount = lattice.XDivs.Length,
					fXDivs = x,
					fYCount = lattice.YDivs.Length,
					fYDivs = y,
				};
				if (lattice.Bounds != null) {
					var bounds = lattice.Bounds.Value;
					nativeLattice.fBounds = &bounds;
				}
				SkiaApi.sk_canvas_draw_image_lattice (Handle, image.Handle, ref nativeLattice, ref dst, paint == null ? IntPtr.Zero : paint.Handle);
			}
		}