SetRect() public method

public SetRect ( SKRectI rect ) : bool
rect SKRectI
return bool
Ejemplo n.º 1
0
        public bool SetPath(SKPath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            using (var clip = new SKRegion()) {
                var rect = SKRectI.Ceiling(path.Bounds);
                if (!rect.IsEmpty)
                {
                    clip.SetRect(rect);
                }

                return(SkiaApi.sk_region_set_path(Handle, path.Handle, clip.Handle));
            }
        }
Ejemplo n.º 2
0
        public bool SetPath(SKPath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            using (var clip = new SKRegion()) {
                SKRect rect;
                if (path.GetBounds(out rect))
                {
                    var recti = new SKRectI(
                        (int)rect.Left,
                        (int)rect.Top,
                        (int)Math.Ceiling(rect.Right),
                        (int)Math.Ceiling(rect.Bottom));
                    clip.SetRect(recti);
                }

                return(SkiaApi.sk_region_set_path(Handle, path.Handle, clip.Handle));
            }
        }