Draws all geometry with smooth (anti-aliased) edges.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
x = 0 def setup(): global pg py5.full_screen(py5.P2D) pg = py5.create_graphics(py5.width, py5.height, py5.P2D) pg.smooth(4) def draw(): global x pg.begin_draw() pg.background(0) pg.ellipse(x, py5.height//2, py5.height/4, py5.height/4) pg.end_draw() py5.image(pg, 0, 0) 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.
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(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.
This method is the same as smooth() but linked to a
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