Drawing - Primitives#
arcade.draw_arc_filled#
- arcade.draw_arc_filled(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], start_angle: float, end_angle: float, tilt_angle: float = 0, num_segments: int = 128)[source]#
Draw a filled in arc. Useful for drawing pie-wedges, or Pac-Man.
- Parameters
center_x (float) – x position that is the center of the arc.
center_y (float) – y position that is the center of the arc.
width (float) – width of the arc.
height (float) – height of the arc.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
start_angle (float) – start angle of the arc in degrees.
end_angle (float) – end angle of the arc in degrees.
tilt_angle (float) – angle the arc is tilted.
num_segments (float) – Number of line segments used to draw arc.
arcade.draw_arc_outline#
- arcade.draw_arc_outline(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], start_angle: float, end_angle: float, border_width: float = 1, tilt_angle: float = 0, num_segments: int = 128)[source]#
Draw the outside edge of an arc. Useful for drawing curved lines.
- Parameters
center_x (float) – x position that is the center of the arc.
center_y (float) – y position that is the center of the arc.
width (float) – width of the arc.
height (float) – height of the arc.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
start_angle (float) – start angle of the arc in degrees.
end_angle (float) – end angle of the arc in degrees.
border_width (float) – width of line in pixels.
tilt_angle (float) – angle the arc is tilted.
num_segments (int) – float of triangle segments that make up this circle. Higher is better quality, but slower render time.
arcade.draw_circle_filled#
- arcade.draw_circle_filled(center_x: float, center_y: float, radius: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0, num_segments: int = - 1)[source]#
Draw a filled-in circle.
- Parameters
center_x (float) – x position that is the center of the circle.
center_y (float) – y position that is the center of the circle.
radius (float) – width of the circle.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
tilt_angle (float) – Angle in degrees to tilt the circle. Useful for low segment count circles
num_segments (int) – Number of triangle segments that make up this circle. Higher is better quality, but slower render time. The default value of -1 means arcade will try to calculate a reasonable amount of segments based on the size of the circle.
arcade.draw_circle_outline#
- arcade.draw_circle_outline(center_x: float, center_y: float, radius: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0, num_segments: int = - 1)[source]#
Draw the outline of a circle.
- Parameters
center_x (float) – x position that is the center of the circle.
center_y (float) – y position that is the center of the circle.
radius (float) – width of the circle.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
border_width (float) – Width of the circle outline in pixels.
tilt_angle (float) – Angle in degrees to tilt the circle. Useful for low segment count circles
num_segments (int) – Number of triangle segments that make up this circle. Higher is better quality, but slower render time. The default value of -1 means arcade will try to calculate a reasonable amount of segments based on the size of the circle.
arcade.draw_ellipse_filled#
- arcade.draw_ellipse_filled(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0, num_segments: int = - 1)[source]#
Draw a filled in ellipse.
- Parameters
center_x (float) – x position that is the center of the circle.
center_y (float) – y position that is the center of the circle.
width (float) – width of the ellipse.
height (float) – height of the ellipse.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
tilt_angle (float) – Angle in degrees to tilt the ellipse.
num_segments (int) – Number of triangle segments that make up this circle. Higher is better quality, but slower render time. The default value of -1 means arcade will try to calculate a reasonable amount of segments based on the size of the circle.
arcade.draw_ellipse_outline#
- arcade.draw_ellipse_outline(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0, num_segments: int = - 1)[source]#
Draw the outline of an ellipse.
- Parameters
center_x (float) – x position that is the center of the circle.
center_y (float) – y position that is the center of the circle.
width (float) – width of the ellipse.
height (float) – height of the ellipse.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
border_width (float) – Width of the circle outline in pixels.
tilt_angle (float) – Angle in degrees to tilt the ellipse.
num_segments (int) – Number of triangle segments that make up this circle. Higher is better quality, but slower render time. The default value of -1 means arcade will try to calculate a reasonable amount of segments based on the size of the circle.
tilt_angle – Tile of the circle. Useful when drawing a circle with a low segment count
arcade.draw_line#
- arcade.draw_line(start_x: float, start_y: float, end_x: float, end_y: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Draw a line.
- Parameters
start_x (float) – x position of line starting point.
start_y (float) – y position of line starting point.
end_x (float) – x position of line ending point.
end_y (float) – y position of line ending point.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
line_width (float) – Width of the line in pixels.
arcade.draw_line_strip#
- arcade.draw_line_strip(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Draw a multi-point line.
- Parameters
point_list (PointList) – List of x, y points that make up this strip
color (Color) – Color of line strip
line_width (float) – Width of the line
arcade.draw_lines#
- arcade.draw_lines(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Draw a set of lines.
Draw a line between each pair of points specified.
- Parameters
point_list (PointList) – List of points making up the lines. Each point is in a list. So it is a list of lists.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
line_width (float) – Width of the line in pixels.
arcade.draw_lrtb_rectangle_filled#
- arcade.draw_lrtb_rectangle_filled(left: float, right: float, top: float, bottom: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]])[source]#
Draw a rectangle by specifying left, right, top, and bottom edges.
- Parameters
- Raises AttributeError
Raised if left > right or top < bottom.
arcade.draw_lrtb_rectangle_outline#
- arcade.draw_lrtb_rectangle_outline(left: float, right: float, top: float, bottom: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1)[source]#
Draw a rectangle by specifying left, right, top, and bottom edges.
- Parameters
left (float) – The x coordinate of the left edge of the rectangle.
right (float) – The x coordinate of the right edge of the rectangle.
top (float) – The y coordinate of the top of the rectangle.
bottom (float) – The y coordinate of the rectangle bottom.
color (Color) – The color of the rectangle.
border_width (float) – The width of the border in pixels. Defaults to one.
- Raises AttributeError
Raised if left > right or top < bottom.
arcade.draw_lrwh_rectangle_textured#
- arcade.draw_lrwh_rectangle_textured(bottom_left_x: float, bottom_left_y: float, width: float, height: float, texture: arcade.texture.Texture, angle: float = 0, alpha: int = 255)[source]#
Draw a texture extending from bottom left to top right.
- Parameters
bottom_left_x (float) – The x coordinate of the left edge of the rectangle.
bottom_left_y (float) – The y coordinate of the bottom of the rectangle.
width (float) – The width of the rectangle.
height (float) – The height of the rectangle.
texture (int) – identifier of texture returned from load_texture() call
angle (float) – rotation of the rectangle. Defaults to zero.
alpha (int) – Transparency of image. 0 is fully transparent, 255 (default) is visible
arcade.draw_parabola_filled#
- arcade.draw_parabola_filled(start_x: float, start_y: float, end_x: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0)[source]#
Draws a filled in parabola.
- Parameters
start_x (float) – The starting x position of the parabola
start_y (float) – The starting y position of the parabola
end_x (float) – The ending x position of the parabola
height (float) – The height of the parabola
color (Color) – The color of the parabola
tilt_angle (float) – The angle of the tilt of the parabola
arcade.draw_parabola_outline#
- arcade.draw_parabola_outline(start_x: float, start_y: float, end_x: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0)[source]#
Draws the outline of a parabola.
- Parameters
start_x (float) – The starting x position of the parabola
start_y (float) – The starting y position of the parabola
end_x (float) – The ending x position of the parabola
height (float) – The height of the parabola
color (Color) – The color of the parabola
border_width (float) – The width of the parabola
tilt_angle (float) – The angle of the tilt of the parabola
arcade.draw_point#
arcade.draw_points#
- arcade.draw_points(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], size: float = 1)[source]#
Draw a set of points.
- Parameters
point_list (PointList) – List of points Each point is in a list. So it is a list of lists.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
size (float) – Size of the point in pixels.
arcade.draw_polygon_filled#
- arcade.draw_polygon_filled(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]])[source]#
Draw a polygon that is filled in.
- Parameters
point_list (PointList) – List of points making up the lines. Each point is in a list. So it is a list of lists.
color (Color) – The color, specified in RGB or RGBA format.
arcade.draw_polygon_outline#
- arcade.draw_polygon_outline(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Draw a polygon outline. Also known as a “line loop.”
- Parameters
point_list (PointList) – List of points making up the lines. Each point is in a list. So it is a list of lists.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
line_width (int) – Width of the line in pixels.
arcade.draw_rectangle_filled#
- arcade.draw_rectangle_filled(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0)[source]#
Draw a filled-in rectangle.
- Parameters
center_x (float) – x coordinate of rectangle center.
center_y (float) – y coordinate of rectangle center.
width (float) – width of the rectangle.
height (float) – height of the rectangle.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
tilt_angle (float) – rotation of the rectangle. Defaults to zero.
arcade.draw_rectangle_outline#
- arcade.draw_rectangle_outline(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0)[source]#
Draw a rectangle outline.
- Parameters
center_x (float) – x coordinate of top left rectangle point.
center_y (float) – y coordinate of top left rectangle point.
width (float) – width of the rectangle.
height (float) – height of the rectangle.
color (Color) – color, specified in a list of 3 or 4 bytes in RGB or RGBA format.
border_width (float) – width of the lines, in pixels.
tilt_angle (float) – rotation of the rectangle. Defaults to zero.
arcade.draw_scaled_texture_rectangle#
- arcade.draw_scaled_texture_rectangle(center_x: float, center_y: float, texture: arcade.texture.Texture, scale: float = 1.0, angle: float = 0, alpha: int = 255)[source]#
Draw a textured rectangle on-screen.
Warning
This method can be slow!
Most users should consider using
arcade.Sprite
witharcade.SpriteList
instead of this function.OpenGL accelerates drawing by using batches to draw multiple things at once. This method doesn’t do that.
If you need finer control or less overhead than arcade allows, consider pyglet’s batching features.
- Parameters
center_x (float) – x coordinate of rectangle center.
center_y (float) – y coordinate of rectangle center.
texture (int) – identifier of texture returned from load_texture() call
scale (float) – scale of texture
angle (float) – rotation of the rectangle. Defaults to zero.
alpha (float) – Transparency of image. 0 is fully transparent, 255 (default) is fully visible
arcade.draw_texture_rectangle#
- arcade.draw_texture_rectangle(center_x: float, center_y: float, width: float, height: float, texture: arcade.texture.Texture, angle: float = 0, alpha: int = 255)[source]#
Draw a textured rectangle on-screen.
- Parameters
center_x (float) – x coordinate of rectangle center.
center_y (float) – y coordinate of rectangle center.
width (float) – width of texture
height (float) – height of texture
texture (int) – identifier of texture returned from load_texture() call
angle (float) – rotation of the rectangle. Defaults to zero.
alpha (float) – Transparency of image. 0 is fully transparent, 255 (default) is visible
arcade.draw_triangle_filled#
arcade.draw_triangle_outline#
- arcade.draw_triangle_outline(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1)[source]#
Draw a the outline of a triangle.
- Parameters
x1 (float) – x value of first coordinate.
y1 (float) – y value of first coordinate.
x2 (float) – x value of second coordinate.
y2 (float) – y value of second coordinate.
x3 (float) – x value of third coordinate.
y3 (float) – y value of third coordinate.
color (Color) – Color of triangle.
border_width (float) – Width of the border in pixels. Defaults to 1.
arcade.draw_xywh_rectangle_filled#
arcade.draw_xywh_rectangle_outline#
- arcade.draw_xywh_rectangle_outline(bottom_left_x: float, bottom_left_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1)[source]#
Draw a rectangle extending from bottom left to top right
- Parameters
bottom_left_x (float) – The x coordinate of the left edge of the rectangle.
bottom_left_y (float) – The y coordinate of the bottom of the rectangle.
width (float) – The width of the rectangle.
height (float) – The height of the rectangle.
color (Color) – The color of the rectangle.
border_width (float) – The width of the border in pixels. Defaults to one.