绘图-基本体#

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)[源代码]#

绘制一条实心圆弧。用于绘制馅饼楔形或Pac-Man。

参数
  • center_x (float) -- 作为圆弧中心的X位置。

  • center_y (float) -- 作为圆弧中心的Y位置。

  • width (float) -- 弧线的宽度。

  • height (float) -- 弧线的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • start_angle (float) -- 圆弧的起点角度(以度为单位)。

  • end_angle (float) -- 圆弧的终点角度,以度为单位。

  • tilt_angle (float) -- 角度弧线是倾斜的。

  • num_segments (float) -- 用于绘制圆弧的线段数。

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)[源代码]#

绘制圆弧的外边。对于绘制曲线非常有用。

参数
  • center_x (float) -- 作为圆弧中心的X位置。

  • center_y (float) -- 作为圆弧中心的Y位置。

  • width (float) -- 弧线的宽度。

  • height (float) -- 弧线的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • start_angle (float) -- 圆弧的起点角度(以度为单位)。

  • end_angle (float) -- 圆弧的终点角度,以度为单位。

  • border_width (float) -- 以像素为单位的线条宽度。

  • tilt_angle (float) -- 角度弧线是倾斜的。

  • num_segments (int) -- 组成此圆的三角形线段的浮动。越高,质量越好,但渲染时间越慢。

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)[源代码]#

画一个填满的圆圈。

参数
  • center_x (float) -- 作为圆中心的X位置。

  • center_y (float) -- Y位置,即圆的中心。

  • radius (float) -- 圆的宽度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • tilt_angle (float) -- 角度(以度为单位)以倾斜圆。适用于低段数圆

  • num_segments (int) -- 组成此圆的三角形线段的数量。越高,质量越好,但渲染时间越慢。默认值-1表示Arcade将尝试根据圆的大小计算合理数量的线段。

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)[源代码]#

画一个圆的轮廓。

参数
  • center_x (float) -- 作为圆中心的X位置。

  • center_y (float) -- Y位置,即圆的中心。

  • radius (float) -- 圆的宽度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • border_width (float) -- 圆形轮廓的宽度,以像素为单位。

  • tilt_angle (float) -- 角度(以度为单位)以倾斜圆。适用于低段数圆

  • num_segments (int) -- 组成此圆的三角形线段的数量。越高,质量越好,但渲染时间越慢。默认值-1表示Arcade将尝试根据圆的大小计算合理数量的线段。

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)[源代码]#

画一个带填充的椭圆。

参数
  • center_x (float) -- 作为圆中心的X位置。

  • center_y (float) -- Y位置,即圆的中心。

  • width (float) -- 椭圆的宽度。

  • height (float) -- 椭圆的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • tilt_angle (float) -- 倾斜椭圆的角度(以度为单位)。

  • num_segments (int) -- 组成此圆的三角形线段的数量。越高,质量越好,但渲染时间越慢。默认值-1表示Arcade将尝试根据圆的大小计算合理数量的线段。

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)[源代码]#

画出椭圆的轮廓。

参数
  • center_x (float) -- 作为圆中心的X位置。

  • center_y (float) -- Y位置,即圆的中心。

  • width (float) -- 椭圆的宽度。

  • height (float) -- 椭圆的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • border_width (float) -- 圆形轮廓的宽度,以像素为单位。

  • tilt_angle (float) -- 倾斜椭圆的角度(以度为单位)。

  • num_segments (int) -- 组成此圆的三角形线段的数量。越高,质量越好,但渲染时间越慢。默认值-1表示Arcade将尝试根据圆的大小计算合理数量的线段。

  • tilt_angle -- 圆圈的平铺。在绘制线段数较低的圆时非常有用

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)[源代码]#

划一条线。

参数
  • start_x (float) -- 直线起点的X位置。

  • start_y (float) -- 直线起点的Y位置。

  • end_x (float) -- 直线终点的X位置。

  • end_y (float) -- 直线终点的Y位置。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • line_width (float) -- 以像素为单位的线条宽度。

arcade.draw_line_strip#

arcade.draw_line_strip(point_list: Sequence[Union[Tuple[float, float], List[float]]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[源代码]#

绘制一条多点直线。

参数
  • point_list (PointList) -- 组成该条带的x,y点的列表

  • color (Color) -- 线条颜色

  • line_width (float) -- 线条宽度

arcade.draw_lines#

arcade.draw_lines(point_list: Sequence[Union[Tuple[float, float], List[float]]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[源代码]#

画一组线。

在指定的每一对点之间画一条线。

参数
  • point_list (PointList) -- 组成直线的点的列表。每一点都在一个列表中。所以这是一份清单清单。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • line_width (float) -- 以像素为单位的线条宽度。

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]])[源代码]#

通过指定左边缘、右边缘、上边缘和下边缘绘制矩形。

参数
  • left (float) -- 矩形左边缘的x坐标。

  • right (float) -- 矩形右边缘的x坐标。

  • top (float) -- 矩形顶部的y坐标。

  • bottom (float) -- 矩形底部的y坐标。

  • color (Color) -- 矩形的颜色。

引发AttributeError

如果左>右或上<下,则引发。

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)[源代码]#

通过指定左边缘、右边缘、上边缘和下边缘绘制矩形。

参数
  • left (float) -- 矩形左边缘的x坐标。

  • right (float) -- 矩形右边缘的x坐标。

  • top (float) -- 矩形顶部的y坐标。

  • bottom (float) -- 矩形底部的y坐标。

  • color (Color) -- 矩形的颜色。

  • border_width (float) -- 边框的宽度,以像素为单位。默认为1。

引发AttributeError

如果左>右或上<下,则引发。

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)[源代码]#

绘制一个从左下角到右上角的纹理。

参数
  • bottom_left_x (float) -- 矩形左边缘的x坐标。

  • bottom_left_y (float) -- 矩形底部的y坐标。

  • width (float) -- 矩形的宽度。

  • height (float) -- 矩形的高度。

  • texture (int) -- 从Load_Texture()调用返回的纹理的标识符

  • angle (float) -- 矩形的旋转。默认为零。

  • alpha (int) -- 图像的透明度。0为完全透明,255(默认)可见

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)[源代码]#

绘制一条填充的抛物线。

参数
  • start_x (float) -- 抛物线的起始x位置

  • start_y (float) -- 抛物线的起点y位置

  • end_x (float) -- 抛物线的终点x位置

  • height (float) -- 抛物线的高度

  • color (Color) -- 抛物线的颜色

  • tilt_angle (float) -- 抛物线的倾斜角度

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)[源代码]#

绘制抛物线的轮廓。

参数
  • start_x (float) -- 抛物线的起始x位置

  • start_y (float) -- 抛物线的起点y位置

  • end_x (float) -- 抛物线的终点x位置

  • height (float) -- 抛物线的高度

  • color (Color) -- 抛物线的颜色

  • border_width (float) -- 抛物线的宽度

  • tilt_angle (float) -- 抛物线的倾斜角度

arcade.draw_point#

arcade.draw_point(x: float, y: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], size: float)[源代码]#

画一个点。

参数
  • x (float) -- 点的X位置。

  • y (float) -- 点的Y位置。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • size (float) -- 以像素为单位的点大小。

arcade.draw_points#

arcade.draw_points(point_list: Sequence[Union[Tuple[float, float], List[float]]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], size: float = 1)[源代码]#

绘制一组点。

参数
  • point_list (PointList) -- 点的列表每个点都在列表中。所以这是一份清单清单。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • size (float) -- 以像素为单位的点大小。

arcade.draw_polygon_filled#

arcade.draw_polygon_filled(point_list: Sequence[Union[Tuple[float, float], List[float]]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]])[源代码]#

绘制一个填充的多边形。

参数
  • point_list (PointList) -- 组成直线的点的列表。每一点都在一个列表中。所以这是一份清单清单。

  • color (Color) -- 以RGB或RGBA格式指定的颜色。

arcade.draw_polygon_outline#

arcade.draw_polygon_outline(point_list: Sequence[Union[Tuple[float, float], List[float]]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[源代码]#

绘制一个多边形轮廓。也被称为“线循环”。

参数
  • point_list (PointList) -- 组成直线的点的列表。每一点都在一个列表中。所以这是一份清单清单。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • line_width (int) -- 以像素为单位的线条宽度。

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)[源代码]#

绘制一个填充的矩形。

参数
  • center_x (float) -- 矩形中心的X坐标。

  • center_y (float) -- 矩形中心的Y坐标。

  • width (float) -- 矩形的宽度。

  • height (float) -- 矩形的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • tilt_angle (float) -- 矩形的旋转。默认为零。

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)[源代码]#

画一个矩形轮廓。

参数
  • center_x (float) -- 左上角矩形点的X坐标。

  • center_y (float) -- 左上角矩形点的Y坐标。

  • width (float) -- 矩形的宽度。

  • height (float) -- 矩形的高度。

  • color (Color) -- 颜色,以RGB或RGBA格式在3个或4个字节的列表中指定。

  • border_width (float) -- 线条的宽度,以像素为单位。

  • tilt_angle (float) -- 矩形的旋转。默认为零。

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)[源代码]#

在屏幕上绘制一个带纹理的矩形。

参数
  • center_x (float) -- 矩形中心的X坐标。

  • center_y (float) -- 矩形中心的Y坐标。

  • texture (int) -- 从Load_Texture()调用返回的纹理的标识符

  • scale (float) -- 纹理比例

  • angle (float) -- 矩形的旋转。默认为零。

  • alpha (float) -- 图像的透明度。0为完全透明,255(默认)可见

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)[源代码]#

在屏幕上绘制一个带纹理的矩形。

参数
  • center_x (float) -- 矩形中心的X坐标。

  • center_y (float) -- 矩形中心的Y坐标。

  • width (float) -- 纹理的宽度

  • height (float) -- 纹理高度

  • texture (int) -- 从Load_Texture()调用返回的纹理的标识符

  • angle (float) -- 矩形的旋转。默认为零。

  • alpha (float) -- 图像的透明度。0为完全透明,255(默认)可见

arcade.draw_triangle_filled#

arcade.draw_triangle_filled(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]])[源代码]#

画一个填充的三角形。

参数
  • x1 (float) -- 第一个坐标的X值。

  • y1 (float) -- 第一个坐标的Y值。

  • x2 (float) -- 第二个坐标的X值。

  • y2 (float) -- 第二个坐标的Y值。

  • x3 (float) -- 第三个坐标的X值。

  • y3 (float) -- 第三个坐标的Y值。

  • color (Color) -- 三角形的颜色。

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)[源代码]#

画一个三角形的轮廓。

参数
  • x1 (float) -- 第一个坐标的X值。

  • y1 (float) -- 第一个坐标的Y值。

  • x2 (float) -- 第二个坐标的X值。

  • y2 (float) -- 第二个坐标的Y值。

  • x3 (float) -- 第三个坐标的X值。

  • y3 (float) -- 第三个坐标的Y值。

  • color (Color) -- 三角形的颜色。

  • border_width (float) -- 边框宽度(以像素为单位)。默认为1。

arcade.draw_xywh_rectangle_filled#

arcade.draw_xywh_rectangle_filled(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]])[源代码]#

绘制一个从左下角到右上角的实心矩形

参数
  • bottom_left_x (float) -- 矩形左边缘的x坐标。

  • bottom_left_y (float) -- 矩形底部的y坐标。

  • width (float) -- 矩形的宽度。

  • height (float) -- 矩形的高度。

  • color (Color) -- 矩形的颜色。

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)[源代码]#

画一个从左下角到右上角的矩形

参数
  • bottom_left_x (float) -- 矩形左边缘的x坐标。

  • bottom_left_y (float) -- 矩形底部的y坐标。

  • width (float) -- 矩形的宽度。

  • height (float) -- 矩形的高度。

  • color (Color) -- 矩形的颜色。

  • border_width (float) -- 边框的宽度,以像素为单位。默认为1。

arcade.get_image#

arcade.get_image(x: int = 0, y: int = 0, width: Optional[int] = None, height: Optional[int] = None) PIL.Image.Image[源代码]#

从屏幕上获取图像。

示例::

image = get_image()
image.save('screenshot.png', 'PNG')
参数
  • x (int) -- 起点(左)x位置

  • y (int) -- 起点(顶部)y位置

  • width (int) -- 图像的宽度。留空以抓取图像的其余部分

  • height (int) -- 图像的高度。留空以抓取图像的其余部分

返回

枕头形象

返回类型

PIL.Image.Image

arcade.get_pixel#

arcade.get_pixel(x: int, y: int, components: int = 3) Tuple[int, ...][源代码]#

给定x,y,将返回该点的颜色值。

参数
  • x (int) -- X位置

  • y (int) -- Y位置

  • components (int) -- 要提取的组件数。默认情况下,我们获取3 3组件(RGB)。4个组件将是RGBA。

返回类型

Color