當前位置: 首頁>>代碼示例>>C#>>正文


C# PdnRegion.Exclude方法代碼示例

本文整理匯總了C#中PaintDotNet.PdnRegion.Exclude方法的典型用法代碼示例。如果您正苦於以下問題:C# PdnRegion.Exclude方法的具體用法?C# PdnRegion.Exclude怎麽用?C# PdnRegion.Exclude使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PaintDotNet.PdnRegion的用法示例。


在下文中一共展示了PdnRegion.Exclude方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawGradient


//.........這裏部分代碼省略.........

                                // TODO: proper alpha blending!
                                gradientSurface[x, y] = ColorBgra.FromBgra((byte)bd, (byte)gd, (byte)rd, 255);
                            }
                        }

                        g.DrawImage(ra.Bitmap, gradientRect, ra.Bounds, GraphicsUnit.Pixel);
                    }
                    else if (Orientation == Orientation.Vertical)
                    {
                        // TODO
                    }
                    else
                    {
                        throw new InvalidEnumArgumentException();
                    }
                }

                gradientSurface.Dispose();
            }
            else
            {
                using (LinearGradientBrush lgb = new LinearGradientBrush(this.ClientRectangle,
                           maxColor, minColor, gradientAngle, false))
                {
                    g.FillRectangle(lgb, gradientRect);
                }
            }

            // fill background
            using (PdnRegion nonGradientRegion = new PdnRegion())
            {
                nonGradientRegion.MakeInfinite();
                nonGradientRegion.Exclude(gradientRect);

                using (SolidBrush sb = new SolidBrush(this.BackColor))
                {
                    g.FillRegion(sb, nonGradientRegion.GetRegionReadOnly());
                }
            }

            // draw value triangles
            for (int i = 0; i < this.vals.Length; i++)
            {
                int pos = ValueToPosition(vals[i]);
                Brush brush;
                Pen pen;

                if (i == highlight) 
                {
                    brush = Brushes.Blue;
                    pen = (Pen)Pens.White.Clone();
                } 
                else 
                {
                    brush = Brushes.Black;
                    pen = (Pen)Pens.Gray.Clone();
                }

                g.SmoothingMode = SmoothingMode.AntiAlias;

                Point a1;
                Point b1;
                Point c1;

                Point a2;
開發者ID:metadeta96,項目名稱:openpdn,代碼行數:67,代碼來源:ColorGradientControl.cs

示例2: Main


//.........這裏部分代碼省略.........
                        layer.Visible = true;
                        layer.Opacity = 170;
                        ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.OverlayBlendOp());
                    }
                    else
                    {
                        layer.Visible = false;
                    }
                }));
#endif

#if TRANSFORM
            // Transform benchmarks
            Matrix m = new Matrix();
            m.Reset();

            MaskedSurface msSimple = new MaskedSurface(surface, new PdnRegion(surface.Bounds)); // simple masked surface

            PdnRegion complexRegion = new PdnRegion(surface.Bounds);

            // cut 4 holes in region 1 to form a complex clipping surface
            for (int x = -1; x < 3; ++x)
            {
                for (int y = -1; y < 3; ++y)
                {
                    int left = (1 + (x * 3)) * (surface.Width / 6);
                    int top = (1 + (x * 3)) * (surface.Height / 6);
                    int right = (2 + (x * 3)) * (surface.Width / 6);
                    int bottom = (2 + (x * 3)) * (surface.Height / 6);

                    Rectangle rect = Rectangle.FromLTRB(left, top, right, bottom);
                    PdnGraphicsPath path = new PdnGraphicsPath();
                    path.AddEllipse(rect);
                    complexRegion.Exclude(path);
                }
            }

            MaskedSurface msComplex = new MaskedSurface(surface, complexRegion);

            benchmarks.Add(new TransformBenchmark("Transform simple surface, no transform, nearest neighbor resampling (" + TransformBenchmark.Iterations + "x)",
                surface,
                msSimple,
                m,
                false));

            benchmarks.Add(new TransformBenchmark("Transform complex surface, no transform, nearest neighbor resampling (" + TransformBenchmark.Iterations + "x)",
                surface,
                msSimple,
                m,
                false));

            benchmarks.Add(new TransformBenchmark("Transform simple surface, no transform, bilinear resampling (" + TransformBenchmark.Iterations + "x)",
                surface,
                msSimple,
                m,
                true));

            benchmarks.Add(new TransformBenchmark("Transform complex surface, no transform, bilinear resampling (" + TransformBenchmark.Iterations + "x)",
                surface,
                msSimple,
                m,
                true));

            Matrix m2 = m.Clone();
            m2.RotateAt(45.0f, new PointF(surface.Width / 2, surface.Height / 2));
開發者ID:leejungho2,項目名稱:xynotecgui,代碼行數:66,代碼來源:Startup.cs

示例3: DrawShadow

        private void DrawShadow(Graphics g, Rectangle clipRect)
        {
            if (this.occludingControl != null)
            {
                // Draw the outline rectangle
                Rectangle outlineRect = new Rectangle(new Point(0, 0), this.occludingControl.Size);

                outlineRect = occludingControl.RectangleToScreen(outlineRect);
                outlineRect = RectangleToClient(outlineRect);
                outlineRect.X -= 1;
                outlineRect.Y -= 1;
                outlineRect.Width += 2;
                outlineRect.Height += 2;

                g.DrawLines(
                    Pens.Black,
                    new Point[]
                    {
                        new Point(outlineRect.Left, outlineRect.Top),
                        new Point(outlineRect.Right, outlineRect.Top),
                        new Point(outlineRect.Right, outlineRect.Bottom),
                        new Point(outlineRect.Left, outlineRect.Bottom),
                        new Point(outlineRect.Left, outlineRect.Top)
                    }); 
                
                using (PdnRegion backRegion = new PdnRegion(clipRect))
                {
                    Rectangle occludingRect = new Rectangle(0, 0, this.occludingControl.Width, this.occludingControl.Height);
                    occludingRect = this.occludingControl.RectangleToScreen(occludingRect);
                    occludingRect = RectangleToClient(occludingRect);
                    backRegion.Exclude(occludingRect);
                    backRegion.Exclude(outlineRect);

                    using (Brush backBrush = new SolidBrush(this.BackColor))
                    {
                        g.FillRegion(backBrush, backRegion.GetRegionReadOnly());
                    }
                }
                
                Rectangle edgeRect = new Rectangle(0, 0, this.roundedEdgeUL.Width, this.roundedEdgeUR.Height);

                Rectangle ulEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Top - 3, this.roundedEdgeUL.Width, this.roundedEdgeUL.Height);
                Rectangle urEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Top - 3, this.roundedEdgeUR.Width, this.roundedEdgeUR.Height);
                Rectangle llEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Bottom - 3, this.roundedEdgeLL.Width, this.roundedEdgeLL.Height);
                Rectangle lrEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Bottom - 3, this.roundedEdgeLR.Width, this.roundedEdgeLR.Height);

                g.DrawImage(this.roundedEdgeUL, ulEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeUR, urEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeLL, llEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeLR, lrEdgeRect, edgeRect, GraphicsUnit.Pixel);

                Color c1 = Color.FromArgb(95, Color.Black);
                Color c2 = Color.FromArgb(47, Color.Black);
                Color c3 = Color.FromArgb(15, Color.Black);

                Pen p1 = new Pen(c1);
                Pen p2 = new Pen(c2);
                Pen p3 = new Pen(c3);

                // Draw top soft edge
                g.DrawLine(p1, ulEdgeRect.Right, outlineRect.Top - 1, urEdgeRect.Left - 1, outlineRect.Top - 1);
                g.DrawLine(p2, ulEdgeRect.Right, outlineRect.Top - 2, urEdgeRect.Left - 1, outlineRect.Top - 2);
                g.DrawLine(p3, ulEdgeRect.Right, outlineRect.Top - 3, urEdgeRect.Left - 1, outlineRect.Top - 3);

                // Draw bottom soft edge
                g.DrawLine(p1, llEdgeRect.Right, outlineRect.Bottom + 0, lrEdgeRect.Left - 1, outlineRect.Bottom + 0);
                g.DrawLine(p2, llEdgeRect.Right, outlineRect.Bottom + 1, lrEdgeRect.Left - 1, outlineRect.Bottom + 1);
                g.DrawLine(p3, llEdgeRect.Right, outlineRect.Bottom + 2, lrEdgeRect.Left - 1, outlineRect.Bottom + 2);

                // Draw left soft edge
                g.DrawLine(p1, outlineRect.Left - 1, ulEdgeRect.Bottom, outlineRect.Left - 1, llEdgeRect.Top - 1);
                g.DrawLine(p2, outlineRect.Left - 2, ulEdgeRect.Bottom, outlineRect.Left - 2, llEdgeRect.Top - 1);
                g.DrawLine(p3, outlineRect.Left - 3, ulEdgeRect.Bottom, outlineRect.Left - 3, llEdgeRect.Top - 1);

                // Draw right soft edge
                g.DrawLine(p1, outlineRect.Right + 0, urEdgeRect.Bottom, outlineRect.Right + 0, lrEdgeRect.Top - 1);
                g.DrawLine(p2, outlineRect.Right + 1, urEdgeRect.Bottom, outlineRect.Right + 1, lrEdgeRect.Top - 1);
                g.DrawLine(p3, outlineRect.Right + 2, urEdgeRect.Bottom, outlineRect.Right + 2, lrEdgeRect.Top - 1);

                p1.Dispose();
                p1 = null;

                p2.Dispose();
                p2 = null;

                p3.Dispose();
                p3 = null;
            }

            if (this.betaTagString != null)
            {
                Color betaTagColor = Color.FromArgb(this.betaTagOpacity, SystemColors.WindowText);
                Brush betaTagBrush = new SolidBrush(betaTagColor);
                StringFormat sf = (StringFormat)StringFormat.GenericTypographic.Clone();

                sf.Alignment = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Near;

                g.DrawString(
                    this.betaTagString,
//.........這裏部分代碼省略.........
開發者ID:metadeta96,項目名稱:openpdn,代碼行數:101,代碼來源:ControlShadow.cs


注:本文中的PaintDotNet.PdnRegion.Exclude方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。