[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] thinking of changing gfxdraw module...



Hi,

On 31/05/11 07:42 AM, René Dudfield wrote:
Hi,

after writing some docs for the gfxdraw module, I'm thinking perhaps we could do some changes.

The major change would be to make all the functions draw multiple items. So instead of line() we have lines() etc.

This is nice because it can be way more efficient in python. Firstly, because there are less function calls, you can combine surface lock and unlock calls. Another reason is that you can combine GIL release unrelease calls - which can be sort of expensive. Finally it will let people pass in arrays of data which can be much more space efficient than lists of python objects.

I'm thinking of removing the single calls, and only having multiple ones available - to force people into using the more efficient methods.


Cons, it breaks the API. I could recreate the old functions with wrappers easily enough though. I'd mark them all obsolete and not document them though.

What do you think?
By passing in multiple items do you mean lines() would accept multiple line segment argument, or a sequence of line segments. Also, what format would an array of segments take? But yes, I agree that moving loops into C is more efficient, and makes for cleaner Python code.

Lenard Lindstrom