示例#1
0
        public unsafe void DrawBitmapLattice(SKBitmap bitmap, SKLattice lattice, SKRect dst, SKPaint paint = null)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException(nameof(bitmap));
            }
            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_bitmap_lattice(Handle, bitmap.Handle, ref nativeLattice, ref dst, paint == null ? IntPtr.Zero : paint.Handle);
                }
        }
示例#2
0
 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)); }
示例#3
0
        public void DrawImageLattice(SKImage image, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
        {
            var lattice = new SKLattice {
                XDivs = xDivs,
                YDivs = yDivs
            };

            DrawImageLattice(image, lattice, dst, paint);
        }
示例#4
0
        public void DrawBitmapLattice(SKBitmap bitmap, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
        {
            var lattice = new SKLattice {
                XDivs = xDivs,
                YDivs = yDivs
            };

            DrawBitmapLattice(bitmap, lattice, dst, paint);
        }
示例#5
0
        public 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));
            }

            unsafe
            {
                fixed(int *x = lattice.XDivs)
                fixed(int *y = lattice.YDivs)
                fixed(SKLatticeRectType * r = lattice.RectTypes)
                fixed(SKColor * c           = lattice.Colors)
                {
                    var nativeLattice = new SKLatticeInternal {
                        fBounds    = null,
                        fRectTypes = r,
                        fXCount    = lattice.XDivs.Length,
                        fXDivs     = x,
                        fYCount    = lattice.YDivs.Length,
                        fYDivs     = y,
                        fColors    = c,
                    };

                    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);
                }
            }
        }
示例#6
0
        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));
            }

            unsafe
            {
                fixed(int *x = &lattice.XDivs[0])
                fixed(int *y             = &lattice.YDivs[0])
                fixed(SKLatticeFlags * f = &lattice.Flags[0])
                {
                    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);
                }
            }
        }
示例#7
0
        public void DrawBitmapLattice(SKBitmap bitmap, SKLattice lattice, SKRect dst, SKPaint paint = null)
        {
            if (bitmap == null)
            {
                throw new ArgumentNullException(nameof(bitmap));
            }
            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(SKLatticeRectType * r = lattice.RectTypes)
                fixed(SKColor * c           = lattice.Colors)
                {
                    var nativeLattice = new SKLatticeInternal {
                        fBounds    = null,
                        fRectTypes = r,
                        fXCount    = lattice.XDivs.Length,
                        fXDivs     = x,
                        fYCount    = lattice.YDivs.Length,
                        fYDivs     = y,
                        fColors    = (uint *)c,
                    };

                    if (lattice.Bounds != null)
                    {
                        var bounds = lattice.Bounds.Value;
                        nativeLattice.fBounds = &bounds;
                    }
                    SkiaApi.sk_canvas_draw_bitmap_lattice(Handle, bitmap.Handle, &nativeLattice, &dst, paint == null ? IntPtr.Zero : paint.Handle);
                }
        }
示例#8
0
 public void DrawBitmapLattice(SKBitmap bitmap, SKLattice lattice, SKRect dst, SKPaint paint = null)
 {
     using var image = SKImage.FromBitmap(bitmap);
     DrawImageLattice(image, lattice, dst, paint);
 }
示例#9
0
		public void DrawBitmapLattice (SKBitmap bitmap, int[] xDivs, int[] yDivs, SKRect dst, SKPaint paint = null)
		{
			var lattice = new SKLattice {
				Bounds = null,
				Flags = null,
				XDivs = xDivs,
				YDivs = yDivs
			};
			DrawBitmapLattice (bitmap, lattice, dst, paint);
		}
示例#10
-1
		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);
			}
		}
示例#11
-1
		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);
		}