Beispiel #1
0
 public static void ColorBitmapRegion(Bitmap bitmap, FloodFilledRegion region)
 {
     foreach (Coordinate coordinate in region.Flooded)
     {
         bitmap.SetPixel(coordinate.X, coordinate.Y, Color.White);
     }
 }
Beispiel #2
0
        private void mainCanvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Coordinate clickedCoordinate = new Coordinate((int)e.GetPosition(mainCanvas).X, (int)e.GetPosition(mainCanvas).Y, _bitmap);
            InputBox   inputbox          = new InputBox(_fontSize);

            if ((clickedCoordinate.FloodFillStatus == Enumerations.FloodFillStatus.Suitable) && (inputbox.ShowDialog().Value))
            {
                FloodFilledRegion region = new FloodFilledRegion(clickedCoordinate, _allCoordinates);
                UtilDraw.ColorBitmapRegion(_bitmap, region);
                Util.ResetFloodedCoords(_allCoordinates, _bitmap);
                _fontSize = inputbox.TextSize;
                UtilDraw.WriteText(_bitmap, region.Average, inputbox.Text, _fontSize);
                //   UtilDraw.DrawCircle(_bitmap, region.Average);
                SetCanvas(_bitmap);
            }
        }