Beispiel #1
0
        public PdnGraphicsPath CreatePath(bool applyInterimTransform)
        {
            lock (this.syncRoot)
            {
                PdnGraphicsPath returnPath;

                switch (this.data.continuationCombineMode)
                {
                case CombineMode.Complement:
                case CombineMode.Intersect:
                    throw new NotSupportedException("Complement and Intersect are not supported");

                case CombineMode.Replace:
                    returnPath = this.data.continuation.Clone();
                    break;

                case CombineMode.Xor:
                    returnPath = this.data.basePath.Clone();
                    returnPath.CloseAllFigures();
                    returnPath.AddPath(this.data.continuation, false);
                    break;

                case CombineMode.Union:
                    if (this.data.basePath.IsEmpty)
                    {
                        goto case CombineMode.Replace;
                    }
                    else
                    {
                        using (PdnRegion baseRegion = new PdnRegion(this.data.basePath))
                        {
                            using (PdnRegion continuationRegion = new PdnRegion(this.data.continuation))
                            {
                                returnPath = PdnGraphicsPath.FromRegions(baseRegion, CombineMode.Union, continuationRegion);
                            }
                        }
                    }

                    break;

                case CombineMode.Exclude:
                    if (this.data.basePath.IsEmpty)
                    {
                        returnPath = new PdnGraphicsPath();
                    }
                    else
                    {
                        using (PdnRegion baseRegion = new PdnRegion(this.data.basePath))
                        {
                            using (PdnRegion continuationRegion = new PdnRegion(this.data.continuation))
                            {
                                returnPath = PdnGraphicsPath.FromRegions(baseRegion, CombineMode.Exclude, continuationRegion);
                            }
                        }
                    }

                    break;

                default:
                    throw new InvalidEnumArgumentException();
                }

                if (applyInterimTransform)
                {
                    returnPath.Transform(this.data.interimTransform);
                }

                return(returnPath);
            }
        }