Draws all geometry with smooth (anti-aliased) edges.


 1x = 0
 4def setup():
 5    global pg
 6    py5.full_screen(py5.P2D)
 7    pg = py5.create_graphics(py5.width, py5.height, py5.P2D)
 8    pg.smooth(4)
11def draw():
12    global x
13    pg.begin_draw()
14    pg.background(0)
15    pg.ellipse(x, py5.height//2, py5.height/4, py5.height/4)
16    pg.end_draw()
17    py5.image(pg, 0, 0)
18    x += 1


Draws all geometry with smooth (anti-aliased) edges. This behavior is the default, so smooth() only needs to be used when a program needs to set the smoothing in a different way. The level parameter increases the amount of smoothness. This is the level of over sampling applied to the graphics buffer.

With the P2D and P3D renderers, smooth(2) is the default, this is called “2x anti-aliasing.” The code smooth(4) is used for 4x anti-aliasing and smooth(8) is specified for “8x anti-aliasing.” The maximum anti-aliasing level is determined by the hardware of the machine that is running the software, so smooth(4) and smooth(8) will not work with every computer.

The default renderer uses smooth(3) by default. This is bicubic smoothing. The other option for the default renderer is smooth(2), which is bilinear smoothing.

The smooth() method can only be run once for a Py5Graphics object and it must be called right after the object is created with create_graphics() and before Py5Graphics.begin_draw().

This method is the same as smooth() but linked to a Py5Graphics object.

Underlying Processing method: PGraphics.smooth


smooth() -> None
smooth(quality: int, /) -> None


  • quality: int - either 2, 3, 4, or 8 depending on the renderer

Updated on March 22, 2022 21:53:01pm UTC