Window = _mode((250, 250))īackground = pygame.Surface(window.get_size()) (shape_surf, color, )ĭef draw_rect_alpha(surface, color, rect): Target_rect = pygame.Rect(min_x, min_y, max_x - min_x, max_y - min_y) Min_x, min_y, max_x, max_y = min(lx), min(ly), max(lx), max(ly) (shape_surf, color, (radius, radius), radius)ĭef draw_polygon_alpha(surface, color, points): Shape_surf = pygame.Surface(target_rect.size, pygame.SRCALPHA) Target_rect = pygame.Rect(center, (0, 0)).inflate((radius * 2, radius * 2)) (shape_surf, color, shape_surf.get_rect())ĭef draw_circle_alpha(surface, color, center, radius): Shape_surf = pygame.Surface(pygame.Rect(rect).size, pygame.SRCALPHA) blit() by default blends 2 Surfacesįor example 3 functions, which can draw transparent rectangles, circles and polygons: def draw_rect_alpha(surface, color, rect):