3.21: Anti-Aliasing
- Page ID
- 14429
Anti-aliasing is a graphics technique for making text and shapes look less blocky by adding a little bit of blur to their edges. It takes a little more computation time to draw with anti-aliasing, so although the graphics may look better, your program may run slower (but only just a little).
If you zoom in on an aliased line and an anti-aliased line, they look like this:
To make Pygame’s text use anti-aliasing, just pass True
for the second parameter of the render()
method. The pygame.draw.aaline()
and pygame.draw.aalines()
functions have the same parameters as pygame.draw.line()
and pygame.draw.lines()
, except they will draw anti-aliased (smooth) lines instead of aliased (blocky) lines.