public Path CreateBorderedPath(int width, int height)
        {
            if (_disposed || Path.Handle == IntPtr.Zero)
            {
                return(null);
            }

            /* If the path provider, does not support border, use the default */
            if (!IsBorderSupported)
            {
                return(CreatePath(width, height));
            }

            /* If the path is not dirty return it */
            if (!IsBorderPathDirty || !(_shape is TShape tShape))
            {
                return(BorderPath);
            }

            /* If there is no need to create border, return the normal path */
            if (!tShape.NeedsBorderInset)
            {
                return(CreatePath(width, height));
            }

            var strokeWidth = (int)(tShape.BorderWidth * BackgroundKit.Density);

            BorderPath.Reset();

            CreateBorderedPath(BorderPath, tShape, width, height, strokeWidth);

            IsBorderPathDirty = false;

            return(BorderPath);
        }
예제 #2
0
        internal BorderPath ComputeGraphicsPath(Sector sector, PathUtil.PathType type)
        {
            lock (this)
            {
                if (borderPathsCache[(int)type] == null)
                {
                    borderPathsCache[(int)type] = new BorderPath(this, sector, type);
                }
            }

            return(borderPathsCache[(int)type]);
        }
        public virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            _shape = null;

            if (Path != null)
            {
                Path.Dispose();
                Path = null;
            }

            if (BorderPath != null)
            {
                BorderPath.Dispose();
                BorderPath = null;
            }
        }