Пример #1
0
        internal BindableRect Clone()
        {
            BindableRect clone = new BindableRect();
              clone.TopLeft = TopLeft.Clone();
              clone.TopRight = TopRight.Clone();
              clone.BottomLeft = BottomLeft.Clone();
              clone.BottomRight = BottomRight.Clone();

              return clone;
        }
Пример #2
0
        public Capture(String folderPath, String filePath)
        {
            Folder = folderPath;
              FileName = System.IO.Path.GetFileName(filePath);
              var pieces = FileName.Split(new String[] { "-" }, StringSplitOptions.RemoveEmptyEntries);

              Ticks = long.Parse(pieces[0]);
              Device = (Device)Enum.Parse(typeof(Device), pieces[1]);
              Method = (Method)Enum.Parse(typeof(Method), pieces[2]);
              Size = (Size)Enum.Parse(typeof(Size), pieces[3]);

              TargetCenter = new BindablePoint(-10, -10);
              TargetRectangle = new BindableRect(-50, -50, 100, 100);

              CaptureCenter = new BindablePoint(0, 0);
              CaptureRectangle = new BindableRect(-60, -60, 120, 120);
        }
Пример #3
0
        private double AreaMiss(BindableRect rect1, BindableRect rect2)
        {
            System.Drawing.PointF[] vertices1 = new System.Drawing.PointF[] {
            rect1.BottomLeft.ToPointF(),
            rect1.TopLeft.ToPointF(),
            rect1.TopRight.ToPointF(),
            rect1.BottomRight.ToPointF()};
              var rectangle1 = new System.Drawing.Drawing2D.GraphicsPath();
              rectangle1.AddPolygon(vertices1);

              System.Drawing.PointF[] vertices2 = new System.Drawing.PointF[] {
            rect2.BottomLeft.ToPointF(),
            rect2.TopLeft.ToPointF(),
            rect2.TopRight.ToPointF(),
            rect2.BottomRight.ToPointF()};
              var rectangle2 = new System.Drawing.Drawing2D.GraphicsPath();
              rectangle2.AddPolygon(vertices2);

              var region = new System.Drawing.Region(rectangle1);
              region.Complement(rectangle2);

              var rects = region.GetRegionScans(new System.Drawing.Drawing2D.Matrix());
              float area = 0;
              foreach (var rc in rects)
            area += rc.Width * rc.Height;
              return area;
        }
Пример #4
0
        private double Area(BindableRect rect1)
        {
            System.Drawing.PointF[] vertices = new System.Drawing.PointF[] {
            rect1.BottomLeft.ToPointF(),
            rect1.TopLeft.ToPointF(),
            rect1.TopRight.ToPointF(),
            rect1.BottomRight.ToPointF()};

              var rectangle = new System.Drawing.Drawing2D.GraphicsPath();
              rectangle.AddPolygon(vertices);
              var region = new System.Drawing.Region(rectangle);

              var rects = region.GetRegionScans(new System.Drawing.Drawing2D.Matrix());
              float area = 0;
              foreach (var rc in rects)
            area += rc.Width * rc.Height;
              return area;
        }