当前位置: 首页>>代码示例>>C#>>正文


C# PdnRegion.Dispose方法代码示例

本文整理汇总了C#中PaintDotNet.PdnRegion.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PdnRegion.Dispose方法的具体用法?C# PdnRegion.Dispose怎么用?C# PdnRegion.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaintDotNet.PdnRegion的用法示例。


在下文中一共展示了PdnRegion.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSelectionChanged

        private void OnSelectionChanged(object sender, EventArgs e)
        {
            this.render = true;
            PdnGraphicsPath path = this.selection.CreatePath(); //this.selection.GetPathReadOnly();

            if (this.selectedPath == null)
            {
                Invalidate();
            }
            else
            {
                this.selectedPath.Dispose(); //
                this.selectedPath = null;
            }

            bool fullInvalidate = false;
            this.selectedPath = path;

            // HACK: Sometimes the selection leaves behind artifacts. So do a full invalidate
            //       every 1 second.
            if (this.selectedPath.PointCount > 10 && (DateTime.Now - lastFullInvalidate > new TimeSpan(0, 0, 0, 1, 0)))
            {
                fullInvalidate = true;
            }

            // if we're moving to a simpler selection region ...
            if (this.selectedPath == null)// || this.selectedPath.PointCount == 0)
            {   
                // then invalidate everything
                fullInvalidate = true;
            }
            else
            {   
                // otherwise, be intelligent about it and only redraw the 'new' area
                PdnRegion xorMe = new PdnRegion(this.selectedPath);
                selectionRedrawInterior.Xor(xorMe);
                xorMe.Dispose();
            }

            float ratio = 1.0f / (float)OwnerList.ScaleFactor.Ratio;
            int ratioInt = (int)Math.Ceiling(ratio);

            if (this.Visible && (this.EnableSelectionOutline || this.EnableSelectionTinting))
            {
                using (PdnRegion simplified = Utility.SimplifyAndInflateRegion(selectionRedrawInterior, Utility.DefaultSimplificationFactor, 2 * ratioInt))
                {
                    Invalidate(simplified);
                }
            }

            if (fullInvalidate)
            {
                Rectangle rect = Rectangle.Inflate(Rectangle.Truncate(selectionRedrawOutline.GetBounds2()), 1, 1);
                Invalidate(rect);
                lastFullInvalidate = DateTime.Now;
            }
            

            this.selectionRedrawInterior.Dispose();
            this.selectionRedrawInterior = null;

            if (this.zoomInSelectedPath != null)
            {
                this.zoomInSelectedPath.Dispose();
                this.zoomInSelectedPath = null;
            }

            this.simplifiedRegionForTimer = null;

            // prepare for next call
            if (this.selectedPath != null && !this.selectedPath.IsEmpty)
            {
                this.selectionRedrawOutline = (PdnGraphicsPath)this.selectedPath.Clone();
                this.selectionRedrawInterior = new PdnRegion(this.selectedPath);
            }
            else
            {
                if (invertedTinting)
                {
                    this.selectionRedrawInterior = new PdnRegion(new Rectangle(0, 0, this.SourceSize.Width, this.SourceSize.Height));
                }
                else
                {
                    this.selectionRedrawInterior = new PdnRegion();
                    this.selectionRedrawInterior.MakeEmpty();
                }

                Invalidate();
                this.selectionRedrawOutline = new PdnGraphicsPath();
            }
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:91,代码来源:SelectionRenderer.cs


注:本文中的PaintDotNet.PdnRegion.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。