Esempio n. 1
0
 private void crop_Click(object sender, EventArgs e)
 {
     if (curr_source != main_source)
     {
         // check if first node in shortest path range of last node
         //if yes get it fast else try to get it by dikstra
         if (Helper.IN_Boundary(main_source, SB, ImageOperations.GetWidth(ImageMatrix)))
         {
             int          Segment_mouse = Helper.crosspond(main_source, SB, ImageOperations.GetWidth(ImageMatrix), ImageOperations.GetWidth(Square_segment));
             List <Point> segmentpath   = new List <Point>();
             segmentpath = ShortestPath_Operations.Backtracking(parent_list, Segment_mouse, ImageOperations.GetWidth(Square_segment));
             curr_path   = Helper.crosspond(segmentpath, SB).ToArray();
         }
         else
         {
             curr_path = ShortestPath_Operations.GenerateShortestPath(curr_source, main_source, ImageMatrix).ToArray();
         }
         Helper.AppendToList <Point>(Mainselction, curr_path);
         //flod fill and crop
         RGBPixel[,] selected_image = floodfill.fill(Mainselction, ImageMatrix);
         CropedImage CI = new CropedImage(selected_image);
         CI.Show();
         reset();
     }
 }
 private void crop_Click(object sender, EventArgs e)
 {
     if (curr_source != main_source)
     {
         // check if first node in shortest path range of last node
         //if yes get it fast else try to get it by dikstra
         if (Helper.IN_Boundary(main_source, SB, ImageOperations.GetWidth(ImageMatrix)))
         {
             int Segment_mouse = Helper.crosspond(main_source, SB, ImageOperations.GetWidth(ImageMatrix), ImageOperations.GetWidth(Square_segment));
             List<Point> segmentpath = new List<Point>();
             segmentpath = ShortestPath_Operations.Backtracking(parent_list, Segment_mouse, ImageOperations.GetWidth(Square_segment));
             curr_path = Helper.crosspond(segmentpath, SB).ToArray();
         }
         else
             curr_path = ShortestPath_Operations.GenerateShortestPath(curr_source, main_source, ImageMatrix).ToArray();
         Helper.AppendToList<Point>(Mainselction, curr_path);
         //flod fill and crop
         RGBPixel[,] selected_image = floodfill.fill(Mainselction, ImageMatrix);
         CropedImage CI = new CropedImage(selected_image);
         CI.Show();
         reset();
     }
 }