The documentation says "For aapolygon, use aalines with the ‘closed’ parameter.", but pygame.draw.aalines doesn't let me specify the width (0 = filled), making it not fill the surface. This looks just terrible:
这些圆圈看起来好多了:
我怎样才能做到这一点?
我使用二次贝塞尔曲线生成表面,其坐标被附加到列表中。然后我像这样将其绘制到表面上(在上图中我做了两次,一次用于外圆,一次用于内圆):
pygame.draw.polygon(self.image,fclr,self.points)
以及绘图代码(shape.image与上面代码中的self.image是同一个表面):
screen.fill((0,0,0))
screen.blit(shape.image,(100,100))
pygame.display.flip()
martineau 的评论很重要:为了使用 pygame 绘制抗锯齿填充形状,请使用该模块gfxdraw
并绘制一个常规填充形状和一个抗锯齿轮廓。从http://www.pygame.org/docs/ref/gfxdraw.html:
“要绘制抗锯齿和填充形状,请首先使用该函数的 aa* 版本,然后使用填充版本。”
请注意,您需要导入gfxdraw
明确地,即from pygame import gfxdraw
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)