pygame documentation | || Home || Help Contents || || pygame || cdrom || constants || cursor || display || draw || || event || font || image || joystick || key || mixer || || mixer_music || mouse || movie || sndarray || surfarray || time || || transform || || CD || Channel || Clock || Font || Joystick || Movie || || Overlay || Rect || Sound || Surface || || color || cursors || sprite ||

## pygame.draw

Contains routines to draw onto a surface.
Note that all drawing routines use direct pixel access, so the surfaces must be locked for use. The draw functions will temporarily lock the surface if needed, but if performing many drawing routines together, it would be best to surround the drawing code with a lock/unlock pair.

aaline | - draw a line on a surface
aalines | - draw multiple connected anti-aliased lines on a surface
arc | - draw an elliptic arc on a surface
circle | - draw a circle on a surface
ellipse | - draw an ellipse on a surface
line | - draw a line on a surface
lines | - draw multiple connected lines on a surface
polygon | - draws a polygon on a surface
rect | - draws a rectangle on a surface

aaline
`pygame.draw.aaline(Surface, color, startpos, endpos, blend=1) -> Rect`

Draws an anti-aliased line on a surface. This will respect the clipping rectangle. A bounding box of the effected area is returned returned as a rectangle. The if blend is true, the shades will be be blended with existing pixel shades instead of overwriting them. This function accepts floating point values for the end points.
The color argument must be a RGB sequence.
This function will temporarily lock the surface.

aalines
`pygame.draw.aalines(Surface, color, closed, point_array, blend=1) -> Rect`

Draws a sequence on a surface. You must pass at least two points in the sequence of points. The closed argument is a simple boolean and if true, a line will be draw between the first and last points. The boolean blend argument set to true will blend the shades with existing shades instead of overwriting them. This function accepts floating point values for the end points.
This will respect the clipping rectangle. A bounding box of the effected area is returned as a rectangle.
The color argument must be an RGB sequence.
This function will temporarily lock the surface.

arc
`pygame.draw.arc(Surface, color, Rect, angle_start, angle_stop, width=0) -> Rect`

Draws an elliptical arc on the Surface. The given rectangle is the area that the circle will fill. The two angle arguments are the initial and final angle (radians, with the zero on the right). The width argument is the thickness to draw the outer edge.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

circle
`pygame.draw.circle(Surface, color, pos, radius, width=0) -> Rect`

Draws a circular shape on the Surface. The given position is the center of the circle, and radius is the size. The width argument is the thickness to draw the outer edge. If width is zero then the circle will be filled.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

ellipse
`pygame.draw.ellipse(Surface, color, Rect, width=0) -> Rect`

Draws an elliptical shape on the Surface. The given rectangle is the area that the circle will fill. The width argument is the thickness to draw the outer edge. If width is zero then the ellipse will be filled.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

line
`pygame.draw.line(Surface, color, startpos, endpos, width=1) -> Rect`

Draws a line on a surface. This will respect the clipping rectangle. A bounding box of the effected area is returned as a rectangle.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

lines
`pygame.draw.lines(Surface, color, closed, point_array, width=1) -> Rect`

Draws a sequence on a surface. You must pass at least two points in the sequence of points. The closed argument is a simple boolean and if true, a line will be draw between the first and last points. Note that specifying a linewidth wider than 1 does not fill in the gaps between the lines. Therefore wide lines and sharp corners won't be joined seamlessly.
This will respect the clipping rectangle. A bounding box of the effected area is returned as a rectangle.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

polygon
`pygame.draw.polygon(Surface, color, pointslist, width=0) -> Rect`

Draws a polygonal shape on the Surface. The given pointlist is the vertices of the polygon. The width argument is the thickness to draw the outer edge. If width is zero then the polygon will be filled.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.

rect
`pygame.draw.rect(Surface, color, Rect, width=0) -> Rect`

Draws a rectangular shape on the Surface. The given Rect is the area of the rectangle. The width argument is the thickness to draw the outer edge. If width is zero then the rectangle will be filled.
The color argument can be either a RGB sequence or mapped color integer.
This function will temporarily lock the surface.
Keep in mind the Surface.fill() method works just as well for drawing filled rectangles. In fact the Surface.fill() can be hardware accelerated when the moons are in alignement.