gfxdraw - Pygame Documentation

pygame documentation | || Pygame Home || Help Contents || Reference Index || Camera || Cdrom || Color || Cursors || Display || Draw || Event || Examples || Font || Gfxdraw || Image || Joystick || Key || Locals || Mask || Midi || Mixer || Mouse || Movie || Music || Overlay || Pixelarray || Pygame || Rect || Scrap || Sndarray || Sprite || Surface || Surfarray || Tests || Time || Transform

pygame.gfxdraw

pygame module for drawing shapes

pygame.gfxdraw.pixel - place a pixel | place a pixel
pygame.gfxdraw.hline - draw a horizontal line | draw a horizontal line
pygame.gfxdraw.vline - draw a vertical line | draw a vertical line
pygame.gfxdraw.rectangle - draw a rectangle | draw a rectangle
pygame.gfxdraw.box - draw a box | draw a box
pygame.gfxdraw.line - draw a line | draw a line
pygame.gfxdraw.circle - draw a circle | draw a circle
pygame.gfxdraw.arc - draw an arc | draw an arc
pygame.gfxdraw.aacircle - draw an anti-aliased circle | draw an anti-aliased circle
pygame.gfxdraw.filled_circle - draw a filled circle | draw a filled circle
pygame.gfxdraw.ellipse - draw an ellipse | draw an ellipse
pygame.gfxdraw.aaellipse - draw an anti-aliased ellipse | draw an anti-aliased ellipse
pygame.gfxdraw.filled_ellipse - draw a filled ellipse | draw a filled ellipse
pygame.gfxdraw.pie - draw a pie | draw a pie
pygame.gfxdraw.trigon - draw a triangle | draw a triangle
pygame.gfxdraw.aatrigon - draw an anti-aliased triangle | draw an anti-aliased triangle
pygame.gfxdraw.filled_trigon - draw a filled trigon | draw a filled trigon
pygame.gfxdraw.polygon - draw a polygon | draw a polygon
pygame.gfxdraw.aapolygon - draw an anti-aliased polygon | draw an anti-aliased polygon
pygame.gfxdraw.filled_polygon - draw a filled polygon | draw a filled polygon
pygame.gfxdraw.textured_polygon - draw a textured polygon | draw a textured polygon
pygame.gfxdraw.bezier - draw a bezier curve | draw a bezier curve

Wraps SDL_gfx primatives.

`EXPERIMENTAL!:` meaning this api may change, or dissapear in later pygame releases. If you use this, your code will break with the next pygame release.

Most of the functions accept a color argument that is an `RGB` triplet. These can also accept an `RGBA` quadruplet. The color argument can also be an integer pixel value that is already mapped to the Surface's pixel format.

For all functions the arguments are strictly positional. Only integers are accepted for coordinates and radii.

For functions like rectangle that accept a rect argument any (x, y, w, h) sequence is accepted, though `pygame.Rect` instances are prefered. Note that for a `pygame.Rect` the drawing will not include `Rect.bottomright`. The right and bottom attributes of a Rect lie one pixel outside of the Rect's boarder.

New in pygame `1.9.0`.

pygame.gfxdraw.pixel

place a pixel
`pygame.gfxdraw.pixel(surface, x, y, color): return None`

pygame.gfxdraw.hline

draw a horizontal line
`pygame.gfxdraw.hline(surface, x1, x2, y, color): return None`

pygame.gfxdraw.vline

draw a vertical line
`pgyame.gfxdraw.vline(surface, x, y1, y2, color): return None`

pygame.gfxdraw.rectangle

draw a rectangle
`pgyame.gfxdraw.rectangle(surface, rect, color): return None`

pygame.gfxdraw.box

draw a box
`pgyame.gfxdraw.box(surface, rect, color): return None`

pygame.gfxdraw.line

draw a line
`pgyame.gfxdraw.line(surface, x1, y1, x2, y2, color): return None`

pygame.gfxdraw.circle

draw a circle
`pgyame.gfxdraw.circle(surface, x, y, r, color): return None`

pygame.gfxdraw.arc

draw an arc
`pgyame.gfxdraw.arc(surface, x, y, r, start, end, color): return None`

pygame.gfxdraw.aacircle

draw an anti-aliased circle
`pgyame.gfxdraw.aacircle(surface, x, y, r, color): return None`

pygame.gfxdraw.filled_circle

draw a filled circle
`pgyame.gfxdraw.filled_circle(surface, x, y, r, color): return None`

pygame.gfxdraw.ellipse

draw an ellipse
`pgyame.gfxdraw.ellipse(surface, x, y, rx, ry, color): return None`

pygame.gfxdraw.aaellipse

draw an anti-aliased ellipse
`pgyame.gfxdraw.aaellipse(surface, x, y, rx, ry, color): return None`

pygame.gfxdraw.filled_ellipse

draw a filled ellipse
`pgyame.gfxdraw.filled_ellipse(surface, x, y, rx, ry, color): return None`

pygame.gfxdraw.pie

draw a pie
`pgyame.gfxdraw.pie(surface, x, y, r, start, end, color): return None`

pygame.gfxdraw.trigon

draw a triangle
`pgyame.gfxdraw.trigon(surface, x1, y1, x2, y2, x3, y3, color): return None`

pygame.gfxdraw.aatrigon

draw an anti-aliased triangle
`pgyame.gfxdraw.aatrigon(surface, x1, y1, x2, y2, x3, y3, color): return None`

pygame.gfxdraw.filled_trigon

draw a filled trigon
`pgyame.gfxdraw.filled_trigon(surface, x1, y1, x3, y2, x3, y3, color): return None`

pygame.gfxdraw.polygon

draw a polygon
`pgyame.gfxdraw.polygon(surface, points, color): return None`

pygame.gfxdraw.aapolygon

draw an anti-aliased polygon
`pgyame.gfxdraw.aapolygon(surface, points, color): return None`

pygame.gfxdraw.filled_polygon

draw a filled polygon
`pgyame.gfxdraw.filled_polygon(surface, points, color): return None`

pygame.gfxdraw.textured_polygon

draw a textured polygon
`pgyame.gfxdraw.textured_polygon(surface, points, texture, tx, ty): return None`

`A` per-pixel alpha texture blit to a per-pixel alpha surface will differ from a `Surface.blit - draw one image onto another` blit. Also, a per-pixel alpha texture cannot be used with an 8-bit per pixel destination.

pygame.gfxdraw.bezier

draw a bezier curve
`pgyame.gfxdraw.bezier(surface, points, steps, color): return None`