@@ -28,7 +28,7 @@ object around the draw calls (see :func:`pygame.Surface.lock` and
28
28
See the :mod:`pygame.gfxdraw` module for alternative draw methods.
29
29
"""
30
30
31
- from typing import overload
31
+ from typing import Union , overload
32
32
33
33
from pygame .rect import Rect
34
34
from pygame .surface import Surface
@@ -568,3 +568,28 @@ def aalines(
568
568
.. versionchanged:: 2.5.0 ``blend`` argument re-added for backcompat, but will
569
569
always raise a deprecation exception when used
570
570
"""
571
+
572
+ def flood_fill (
573
+ surface : Surface , color : Union [ColorLike , Surface ], start_pos : Point
574
+ ) -> Rect :
575
+ """Fill an enclosed, same color area, on a surface.
576
+
577
+ Replace the color of a cluster of connected same-color pixels, beginning
578
+ from the starting position, with a repeating pattern or solid single color.
579
+
580
+ :param Surface surface: surface to draw on
581
+ :param color: color, or surface pattern, to draw with. The alpha value is optional if using a
582
+ tuple ``(RGB[A])``
583
+ :type color: :data:`pygame.typing.ColorLike` or a pattern to fill with, as a Surface
584
+ :param start_pos: starting position as a sequence of 2 ints/floats,
585
+ e.g. ``(x, y)``
586
+ :type start_pos: tuple(int or float, int or float) or
587
+ list(int or float, int or float) or Vector2(int or float, int or float)
588
+
589
+ :returns: a rect bounding the changed pixels, if nothing is drawn the
590
+ bounding rect's position will be the position of the starting point
591
+ and its width and height will be 0
592
+ :rtype: Rect
593
+
594
+ .. versionadded:: 2.5.6
595
+ """
0 commit comments