Example #1
0
 public static Matrix ToXwt(this System.Drawing.Drawing2D.Matrix matrice)
 {
     return(new Matrix(
                matrice.Elements[0],
                matrice.Elements[1],
                matrice.Elements[2],
                matrice.Elements[3],
                matrice.Elements[4],
                matrice.Elements[5]));
 }
Example #2
0
        public void OnPaintTest2(IRenderEventArgs e)
        {
            Graphics g = ((GdiSurface)e.Surface).Graphics;

            SD.Drawing2D.Matrix save = g.Transform;
            g.Transform = Camera.Matrix.ToGdi();

            Rectangle smaller = new Rectangle(start, new Size(50, 20));
            Rectangle bigger  = new Rectangle(start, new Size(55, 25));
            Rectangle rect3   = new Rectangle(start, new Size(10, 10));

            g.DrawRectangle(rectPen, smaller);
            g.DrawRectangle(rectPen, bigger);

            smaller.Inflate(-5, -5);
            bigger.Inflate(5, 5);

            //region.MakeEmpty ();
            region.MakeEmpty();

            invPath.Reset();
            invPath.FillMode = FillMode.Alternate;

            smaller.Intersect(bigger);
            //region.Intersect (smaller);

            //invPath.StartFigure ();
            invPath.AddRectangle(bigger);
            //invPath.CloseFigure();
            //invPath.StartFigure();
            invPath.AddRectangle(smaller);
            //invPath.CloseFigure();

            // this is to simulage g.Clip, as it has the bounds-rectangle:
            region.Union(invPath.GetBounds());
            region.Intersect(invPath);

            Region saveRegion = g.Clip;

            g.Clip = region;
            g.DrawPath(pathPen, invPath);
            //g.FillPath (regionBrush, invPath);
            g.FillRegion(regionBrush, g.Clip);
            if (!region.IsVisible(rect3))
            {
                int x = 1;
            }
            //g.FillRegion (clipregionBrush, g.Clip);
            g.Transform = save;
            g.Clip      = saveRegion;
        }
Example #3
0
        public override void OnPaint(IRenderEventArgs e)
        {
            Graphics g = ((GdiSurface)e.Surface).Graphics;

            SD.Drawing2D.Matrix save = g.Transform;
            g.Transform = Camera.Matrix.ToGdi();

            Rectangle smaller = new Rectangle(start, new Size(50, 20));
            Rectangle bigger  = new Rectangle(start, new Size(55, 25));

            g.DrawRectangle(rectPen, smaller);
            g.DrawRectangle(rectPen, bigger);

            smaller.Inflate(-5, -5);
            bigger.Inflate(5, 5);
            Rectangle[] pathRects =
            {
                Rectangle.FromLTRB(bigger.Left,   bigger.Top,     bigger.Right, smaller.Top),
                Rectangle.FromLTRB(bigger.Left,   smaller.Bottom, bigger.Right, bigger.Bottom),
                Rectangle.FromLTRB(bigger.Left,   smaller.Top,    smaller.Left, smaller.Bottom),
                Rectangle.FromLTRB(smaller.Right, smaller.Top,    bigger.Right, smaller.Bottom)
            };

            Region clipRegion = new Region();

            clipRegion.MakeInfinite();
            clipRegion.Intersect(
                Rectangle.FromLTRB(bigger.Left, bigger.Top, bigger.Right, smaller.Top));
            clipRegion.Union(
                Rectangle.FromLTRB(bigger.Left, smaller.Bottom, bigger.Right, bigger.Bottom));
            clipRegion.Union(
                Rectangle.FromLTRB(bigger.Left, smaller.Top, smaller.Left, smaller.Bottom));
            clipRegion.Union(
                Rectangle.FromLTRB(smaller.Right, smaller.Top, bigger.Right, smaller.Bottom));


            bool       isVisible = false;
            RectangleF testRect  = Rectangle.Inflate(smaller, -1, -1);

            isVisible = clipRegion.IsVisible(testRect);
            if (isVisible)
            {
                clipRegion.MakeInfinite();
            }
            invPath.Reset();
            invPath.FillMode = FillMode.Alternate;
            invPath.AddRectangles(pathRects);
            g.DrawPath(pathPen, invPath);
            g.FillPath(regionBrush, invPath);
        }
Example #4
0
        public override void OnPaint(IRenderEventArgs e)
        {
            var hull =
                //CommandsHull;
                //hull = ClipHull(e);
                GetHull(this.Data, Camera.Matrix, 5);

            Graphics g = ((GdiSurface)e.Surface).Graphics;

            System.Drawing.Drawing2D.Matrix save = g.Transform;
            g.Transform = new System.Drawing.Drawing2D.Matrix();

            if (oldHull != null && oldHull.Length > 2)
            {
                invPath.Reset();
                invPath.FillMode = FillMode.Alternate;

                invPath.AddPolygon(oldHull);
                g.DrawPath(backGroundPen, invPath);
                //g.FillPath (regionBrush, invPath);

                oldHull = null;
            }

            if (hull != null && hull.Length > 2)
            {
                invPath.Reset();
                invPath.FillMode = FillMode.Alternate;

                invPath.AddPolygon(hull);
                g.DrawPath(pathPen, invPath);
                //g.FillPath (regionBrush, invPath);

                g.Transform = save;
                oldHull     = hull;
            }
            g.Transform = save;
        }