Description
Issue №2554 opened by fortwoone at 2021-04-09 19:15:34
So I noticed the pygame.surface.Surface object has a function blits to allow multiple blittings at once, and I thought we could do the same to the fill function, I have done a code stub for it even though I can't add it to PyGame because of the nature of the object type:
def fills(self:pygame.surface.Surface, color:Union[pygame.color.Color, Tuple], rects:Union[Tuple[pygame.rect.Rect], List[pygame.rect.Rect]]): for rect in rects: self.fill(color, rect)
This could be made in Python : I have no knowledge of C so can't translate the code, but I am sure that would be a nice addition, more interesting for direct surface editing to fill multiple forms
Comments
# # itzpr3d4t0r commented at 2022-07-22 11:06:24
I can take this one. Problem is a surface.fills() function can be either of:
- given a list of surfaces it fills them based on color and rect passed:
like you pass in a sequence of [ (surface, color, rect, blend), ...] - given a surface and a sequence of rects it fills the surface with 1 given color as argument and a single blend for each rect
- given a surface and a sequence of (rect, color, blend) fills the surface with the rect, color and blend for each rect
# # itzpr3d4t0r commented at 2022-07-22 11:11:19
You are suggesting number 2 but number 1 and 3 are also possible
# # itzpr3d4t0r commented at 2022-07-22 11:22:42
I'll go with number 3 as it gives you more freedom over how you fill the surfaces.