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

Add line thickness in gfxdraw

Open mzivic7 opened this issue 2 years ago • 5 comments
trafficstars

Description

Add line thickness value in gfxdraw.aacircle and other gfxdraw shapes, just like in pygame.draw.

For now i am using this code for aacircle:

def draw_circle(surface, color, pos, radius, thickness):
	if thickness != 1:
		for num in range(1, thickness):
			gfxdraw.aacircle(surface, int(pos[0]), int(pos[1]), int(radius)+num, color) 

But it is not perfect: there can be seen background pixels between two lines, because gfxdraw accepts only int.

Tasks for closing

  • [x] implement pygame.draw.aacircle
  • [ ] deprecate pygame.gfxdraw.aacircle

mzivic7 avatar Sep 21 '23 23:09 mzivic7

Please correct me if I'm wrong, but I think we have stopped supporting gfxdraw. Please confirm: @Starbuck5 @ankith26

I recommend using pygame.draw.circle() instead.

https://pyga.me/docs/ref/draw.html#pygame.draw.circle

andrewhong04 avatar Sep 30 '23 23:09 andrewhong04

The thing is we don't actively maintain gfxdraw, but because many people use it and it has some stuff that pygame.draw doesn't, gfxdraw isn't being removed anytime soon. The long term plan is to add all of gfxdraws features to draw and then we could deprecate/remove gfxdraw

ankith26 avatar Oct 01 '23 10:10 ankith26

@ankith26 Would adding a thickness parameter to aacircle and change its implementation to use pygame.draw instead be a good solution for this? Perhaps adding a deprecation message would also be a good idea.

igordsm avatar Oct 01 '23 23:10 igordsm

Me personally, I don't want to be adding more changes to gfxdraw for above reasons. However I do agree that we should be adding deprecation warnings in gfxdraw, once we agree on a roadmap for it

ankith26 avatar Oct 02 '23 10:10 ankith26

I'm adding some tasks to the original message to close this issue when complete

oddbookworm avatar Apr 14 '24 02:04 oddbookworm