“You keep on learning and learning, and pretty soon you learn something no one has learned before” Richard P. Feynman
Related to set_clip()
Related Stack Overflow questions:
Related Stack Overflow questions:
how to make circular surface in PyGame

How do I focus light or how do I only draw certain circular parts of the window in pygame?

📁 Minimal example - Clip circular 2
repl.it/@Rabbid76/PyGame-ClipCircularRegion-2

How do I display a large black rectangle with a moveable transparent circle in pygame?

Can I use an image on a moving object within Pygame as opposed to to a color?

How do you clip a circle (or any non-Rect) from an image in pygame?
📁 Minimal example - Clip polygon
Related Stack Overflow questions:

📁 Minimal example - Clipping with masks
Convert a pygame.mask.Mask to a pygame.Surface with pygame.mask.Mask.to_surface. Use setsurface to specify the source image and the unsetcolor argument to specify the transparent background:
def clip_surface(surf, mask):
return mask.to_surface(setsurface = surf.convert_alpha(), unsetcolor = (0, 0, 0, 0))