AA Draw

Antialiased graphics drawing for Pygame.

AA Draw vs pygame.draw antialiasing

What Is Antialiasing?

Antialiasing is smoothing the edges in graphical drawing. This is done by gradually mixing the drawing color with the background color, as shown in the image above.

Pygame’s drawing functions do not have antialiasing implemented, so the resulting shapes will look jagged and rough. AA Draw has antialiasing, so the shapes look smooth, as shown above.

AA Draw is designed to be as similar as possible to Pygame, so you can easily switch between using AA Draw and Pygame draw.

Installation

Python Package

All releases are published on PyPI. You can install AA Draw with Pip:

pip install aadraw

Requirements

You will need Python3 and Pygame, a graphics module. You can install pygame with pip install pygame

Using AA Draw

AA Draw is designed to be very similar to Pygame, so your code can be easily reused.

Below, you can find documentation for each draw function currently available.

aadraw.circle()

params

circle(surface, color, loc, radius, border)

param surface

The Pygame surface to draw on.

param color

RGB or RGBA color of the circle.

param loc

(x, y) location of the center.

param border

Border thickness in pixels. Extends inwards.

return

None

Draws an antialiased circle.

aadraw.rect()

params

rect(surface, color, dims, border, border_radius, border_top_left_radius, border_top_right_radius, border_bottom_left_radius, border_bottom_right_radius)

param surface

The Pygame surface to draw on.

param color

RGB or RGBA color of the circle.

param dims

(x, y, w, h) dimensions of the rectangle.

param border

Border thickness in pixels. Extends inwards.

param border_radius

Rounding radius for each corner.

param border_top_left_radius

Radius of corresponding corner.

param border_top_right_radius

Radius of corresponding corner.

param border_bottom_left_radius

Radius of corresponding corner.

param border_bottom_right_radius

Radius of corresponding corner.

Support

Please open an issue on GitHub for support. Keep in mind that everyone can see the issue you post.

You can also fork and make a pull request if you would like to contribute.