예제 #1
0
        /// <summary>
        /// Combines the region with a given path, specifying the operation used to combine.
        /// </summary>
        /// <param name="region">The region to perform the operation on.</param>
        /// <param name="path">The path to perform the operation with.</param>
        /// <param name="operation">The type of operation to perform.</param>
        /// <returns></returns>
        internal static bool CombineWithPath(this SKRegion region, SKPath path, SKRegionOperation operation)
        {
            using SKRegion pathRegion = new SKRegion();

            pathRegion.SetPath(path, usePathBounds: true);
            return(region.Op(pathRegion, operation));
        }
예제 #2
0
 internal static bool Op(this SKRegion region, SKPath path, SKRegionOperation operation)
 {
     using (SKRegion pathRegion = new SKRegion())
     {
         pathRegion.SetPath(path, true);
         return(region.Op(pathRegion, operation));
     }
 }
예제 #3
0
 public void ClipRegion(SKRegion region, SKPath path,
                        SKRegionOperation regionOperation = SKRegionOperation.Intersect)
 {
     using (SKRegion region1 = new SKRegion())
     {
         region1.SetPath(path);
         region.Op(region1, regionOperation);
     }
 }
예제 #4
0
        public void ClipPath(SKPath path, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            SkiaApi.sk_canvas_clip_path_with_operation(Handle, path.Handle, operation, antialias);
        }
예제 #5
0
        void DisplayClipOp(SKCanvas canvas, SKRect rect, SKRegionOperation regionOp)
        {
            float textSize = textPaint.TextSize;

            canvas.DrawText(regionOp.ToString(), rect.MidX, rect.Top + textSize, textPaint);
            rect.Top += textSize;

            float radius  = 0.9f * Math.Min(rect.Width / 3, rect.Height / 2);
            float xCenter = rect.MidX;
            float yCenter = rect.MidY;

            SKRectI recti = new SKRectI((int)rect.Left, (int)rect.Top,
                                        (int)rect.Right, (int)rect.Bottom);

            using (SKRegion wholeRectRegion = new SKRegion())
            {
                wholeRectRegion.SetRect(recti);

                using (SKRegion region1 = new SKRegion(wholeRectRegion))
                    using (SKRegion region2 = new SKRegion(wholeRectRegion))
                    {
                        using (SKPath path1 = new SKPath())
                        {
                            path1.AddCircle(xCenter - radius / 2, yCenter, radius);
                            region1.SetPath(path1);
                        }

                        using (SKPath path2 = new SKPath())
                        {
                            path2.AddCircle(xCenter + radius / 2, yCenter, radius);
                            region2.SetPath(path2);
                        }

                        region1.Op(region2, regionOp);

                        canvas.Save();
                        canvas.ClipRegion(region1);
                        canvas.DrawPaint(fillPaint);
                        canvas.Restore();
                    }
            }
        }
예제 #6
0
 public void ClipRect(SKRect rect, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false)
 {
     SkiaApi.sk_canvas_clip_rect_with_operation (Handle, ref rect, operation, antialias);
 }
예제 #7
0
        public void ClipPath(SKPath path, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false)
        {
            if (path == null)
                throw new ArgumentNullException (nameof (path));

            SkiaApi.sk_canvas_clip_path_with_operation (Handle, path.Handle, operation, antialias);
        }
예제 #8
0
 public bool Op(SKRegion region, SKRegionOperation op)
 {
     return(SkiaApi.sk_region_op2(Handle, region.Handle, op));
 }
예제 #9
0
		public extern static bool sk_region_op2(sk_region_t r, sk_region_t src, SKRegionOperation op);
예제 #10
0
 public bool Op(SKRegion region, SKRegionOperation op) =>
 SkiaApi.sk_region_op2(Handle, region.Handle, op);
예제 #11
0
 public bool Op(SKRectI rect, SKRegionOperation op) =>
 SkiaApi.sk_region_op(Handle, rect.Left, rect.Top, rect.Right, rect.Bottom, op);
예제 #12
0
		public void ClipPath (SKPath path, SKRegionOperation operation, bool antialias = false)
		{
			ClipPath (path, (SKClipOperation)(int)operation, antialias);
		}
예제 #13
0
		public void ClipRect (SKRect rect, SKRegionOperation operation, bool antialias = false)
		{
			ClipRect (rect, (SKClipOperation)(int)operation, antialias);
		}
예제 #14
0
 public void ClipRect(SKRect rect, SKRegionOperation operation = SKRegionOperation.Intersect, bool antialias = false)
 {
     SkiaApi.sk_canvas_clip_rect_with_operation(Handle, ref rect, operation, antialias);
 }
예제 #15
0
 public void ClipRect(SKRect rect, SKRegionOperation operation, bool antialias = false)
 {
     ClipRect(rect, (SKClipOperation)(int)operation, antialias);
 }
예제 #16
0
		public bool Op(SKRegion region, SKRegionOperation op)
		{
			return SkiaApi.sk_region_op2(Handle, region.Handle, op);
		}
예제 #17
0
 public void ClipPath(SKPath path, SKRegionOperation operation, bool antialias = false)
 {
     ClipPath(path, (SKClipOperation)(int)operation, antialias);
 }
예제 #18
0
		public bool Op(SKRectI rect, SKRegionOperation op)
		{
			return SkiaApi.sk_region_op(Handle, rect.Left, rect.Top, rect.Right, rect.Bottom, op);
		}
예제 #19
0
 public bool Op(int left, int top, int right, int bottom, SKRegionOperation op) =>
 SkiaApi.sk_region_op(Handle, left, top, right, bottom, op);
예제 #20
0
		public bool Op(int left, int top, int right, int bottom, SKRegionOperation op)
		{
			return SkiaApi.sk_region_op(Handle, left, top, right, bottom, op);
		}
예제 #21
0
 public bool Op(SKPath path, SKRegionOperation op)
 {
     using (var pathRegion = new SKRegion(path)) {
         return(Op(pathRegion, op));
     }
 }
예제 #22
0
		public extern static bool sk_region_op(sk_region_t r, int left, int top, int right, int bottom, SKRegionOperation op);