[..]
fill_multi might look like this:
Surface.fill_multi(color, rects, special_flags=0)
Basically the same as the fill() except the first two arguments
accept
buffer objects that are arrays of colors and rects respectively. I
think it
would be best if color accepted both a single color value or an
array of
RGBA values. I think supporting only RGBA (as 4-byte words) is good
enough
and the alpha would just be ignored if the surface did not support
it.
Though this would preclude indexed color surfaces. I'm open to
opinion on
this.
If color is an array, it would need to be the same length as rects
to keep
things simple. Otherwise it would raise an exception (ValueError?).
blit_multi would be:
Surface.blit_multi(source, dests, area=None, special_flags=0)
source is a single surface, dests is an buffer array of x, y
coordinate
ints, or maybe a RectArray, see below. Area is a single rect, for
now, but I
could imagine supporting an array of rects for advanced use (sprite-
sheet,
etc).
Seems like we would want a RectArray object to allow creation and
some
manipulation and passing of rectangles en-masse from python, though
maybe
that's overkill for a first rev.
I'm going to check out 1.9 now and see how it looks. I remember
looking at
doing something similar in pygame from the lepton side and deciding
it was
not too practical from an outside library. But, given these apis it
would be
easy. I suspect the fill_multi() implementation will be more
complex, we'll
see.
-Casey
Sounds pretty good.
A common use case for blit_multi would be when you are blitting a
whole group of sprites to the screen. But you don't necessarily have
to complete each use case to start with... as long as the interface
raises exceptions when people try, and mention it in the docs.
One issue might be...
Surface.fill_multi(color, rects, special_flags=0)
With color it can be a single int, or (0,0,0) or (0,0,0,0). So I
think the sequences would have to be len(rects) == len(color)
Except if you have 3-4 colors + rects... ([1,2,3], [r1,r2,r3])
then the color argument has an ambiguity of either 3 colors, or 1
color.
So perhaps explicit length of arguments? Or a separate color and
colors argument?