pygame2.sdlext.draw – extended SDL drawing methods

Extension module containing simple 2D drawing methods for the pygame2 SDL modules. Several methods utilize code from the SDL_gfx library, and were optimised and changed in several ways.

Module Functions

pygame2.sdlext.draw.aaline(surface, color, x1, y1, x2, y2[, blend]) → :class:`pygame2.Rect`
pygame2.sdlext.draw.aaline(surface, color, point1, point2[, blend]) → :class:`pygame2.Rect`

Draws a fine anti-aliased line.

Draws an anti-aliased line on a surface. If blend is True, the shades will be be blended with existing pixel shades instead of overwriting them.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.aalines(surface, color, (point1, point2, ...)[, blend]) → :class:`pygame2.Rect`

Draws multiple contiguous anti-aliased line segments on a surface.

Draws a sequence of anti-aliased lines with a fixed width of 1px on a surface. If blend is True, the shades will be be blended with existing pixel shades instead of overwriting them.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.aapolygon(surface, color, (point1, point2, ...)[, blend]) → :class:`pygame2.Rect`

Draws an anti-aliased polygonal shape on a surface.

Draws an polygonal shape on a surface with an fixed line width of 1px. If blend is true, the shades will be be blended with existing pixel shades instead of overwriting them.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.arc(surface, color, rect, startangle, stopangle[, width]) → :class:`pygame2.Rect`

Draws an elliptical arc on a surface.

Draws an elliptical arc on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. If width is set to 0, a filled shape will be drawn. The startangle and stopangle arguments are the initial and final angle in degrees.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.circle(surface, color, x, y, radius[, width]) → :class:`pygame2.Rect`
pygame2.sdlext.draw.circle(surface, color, point, radius[, width]) → :class:`pygame2.Rect`

Draws a circular shape on a surface.

Draws a circular shape on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. If width is set to 0, a filled circular shape will be drawn. The x, y point denotes the center of the circle.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.ellipse(surface, color, rect[, width]) → :class:`pygame2.Rect`

Draws an elliptical shape on a surface.

Draws an elliptical shape on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. If width is set to 0, a filled elliptical shape will be drawn. The passed pygame2.Rect denotes the area, the elliptical shape will be drawn in.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.line(surface, color, x1, y1, x2, y2[, width]) → :class:`pygame2.Rect`
pygame2.sdlext.draw.line(surface, color, point1, point2[, width]) → :class:`pygame2.Rect`

Draws a straight line segment on a surface.

Draws a straight line segment on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. There are no endcaps, the ends are squared off for thick lines.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.lines(surface, color, (point1, point2, ...)[, width]) → :class:`pygame2.Rect`

Draws multiple contiguous line segments on a surface.

Draws a sequence of lines on a surface with an optionally specified line width. If the width argument is omitted, the lines will be 1px thick.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.polygon(surface, color, (point1, point2), ...)[, width]) → :class:`pygame2.Rect`

Draws a polygonal shape on a surface.

Draws a polygonal shape on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. If width is set to 0, a filled polygon will be drawn.

The returned pygame2.Rect describes the area affected by the changes.

pygame2.sdlext.draw.rect(surface, color, rect[, width]) → :class:`pygame2.Rect`

Draws a rectangular shape on a surface.

Draws a rectangular shape on a surface with an optionally specified line width. If the width argument is omitted, the line will be 1px thick. If the width is set to 0, a filled rectangular shape will be drawn.

The returned pygame2.Rect describes the area affected by the changes.