pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Add bezier from ``gfxdraw`` module to ``draw`` module

Open bilhox opened this issue 1 year ago • 3 comments
trafficstars

Hello, as part of #3005 plan, this PR moves pygame.gfxdraw.bezier to pygame.draw.bezier.

bilhox avatar Jul 21 '24 10:07 bilhox

This note is outdated.

damusss avatar Jul 21 '24 13:07 damusss

I would like to know your opinion about the step argument before potentially merging it. I think personally the docs are not clear at all about step argument, and when I tested it with different values, I couldn't really figure out how it was used. Furthermore the code is not that great to read (I first look the variable names are not understandable), which is why I support the idea of a new implementation of Bézier curves so I can also document the terrible code.

bilhox avatar Sep 03 '24 22:09 bilhox

I would like to know your opinion about the step argument before potentially merging it. I think personally the docs are not clear at all about step argument, and when I tested it with different values, I couldn't really figure out how it was used. Furthermore the code is not that great to read (I first look the variable names are not understandable), which is why I support the idea of a new implementation of Bézier curves so I can also document the terrible code.

My main feeling is that we should try and get this merged so we can shim & steadily get rid of gfxdraw from docs and examples and the like.

However, if you think the step argument is the least reliable argument in a future implementation of bezier line drawing then what I would do is move it to the end of the function signature instead of before the color argument, and make sure it has a default value specified so it is optional. You could also make it a keyword argument only parameter too.

That way in the future it will be much easier to remove or alter the step argument while still allowing us to handle it as it is right now and make a convenient gfxdraw shim for it.

So, to be clear the function signature (in python) would be something like:

def bezier(Surface surface, Sequence[Point] points, ColorLike color, *,  int step=3)

MyreMylar avatar Oct 03 '24 18:10 MyreMylar